void-packages/templates/shadow/INSTALL
Juan RP 605e166253 shadow: reorder groups created by the INSTALL script. Bump revision.
--HG--
extra : convert_revision : ed7589001693b4d696d7f041173c0ec08bbd0a53
2009-04-02 04:00:47 +02:00

66 lines
1 KiB
Text

#
# This script creates default /etc/passwd and /etc/group
# files if they are unexistent.
#
# Also shadow passwords are enabled.
create_passwd()
{
cat > ./etc/passwd <<_EOF
root:x:0:0:root:/root:/bin/bash
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
_EOF
echo "Created default /etc/passwd file."
}
create_group()
{
# Default group list as specified by LFS.
cat > ./etc/group <<_EOF
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
wheel:x:4:
tty:x:5:
tape:x:6:
daemon:x:7:
floppy:x:8:
disk:x:9:
lp:x:10:
dialout:x:11:
audio:x:12:
video:x:13:
utmp:x:14:
usb:x:15:
cdrom:x:16:
optical:x:17:
mail:x:18:
storage:x:19:
scanner:x:20:
nogroup:x:99:
users:x:1000:
_EOF
echo "Created default /etc/group file."
}
case "$2" in
pre)
;;
post)
echo "Running $3-$4 post installation hooks..."
if [ "$1" = "NOTSET" ]; then
run_cmd="pwconv"
else
run_cmd="chroot $1 pwconv"
fi
[ ! -f ./etc/passwd ] && create_passwd
[ ! -f ./etc/group ] && create_group
if [ ! -f ./etc/shadow ]; then
echo "Enabling shadow passwords..."
${run_cmd}
fi
;;
esac