2009-03-12 11:16:08 +01:00
|
|
|
#
|
|
|
|
# This script creates default /etc/passwd and /etc/group
|
|
|
|
# files if they are unexistent.
|
|
|
|
#
|
|
|
|
# Also shadow passwords are enabled.
|
2009-01-27 19:28:31 +01:00
|
|
|
|
|
|
|
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:
|
2009-03-05 01:39:13 +01:00
|
|
|
wheel:x:4:
|
|
|
|
tty:x:5:
|
|
|
|
tape:x:6:
|
|
|
|
daemon:x:7:
|
|
|
|
floppy:x:8:
|
|
|
|
disk:x:9:
|
|
|
|
lp:x:10:
|
2009-04-02 04:00:47 +02:00
|
|
|
dialout:x:11:
|
2009-03-05 01:39:13 +01:00
|
|
|
audio:x:12:
|
|
|
|
video:x:13:
|
|
|
|
utmp:x:14:
|
|
|
|
usb:x:15:
|
|
|
|
cdrom:x:16:
|
2009-04-02 04:00:47 +02:00
|
|
|
optical:x:17:
|
2009-03-05 01:39:13 +01:00
|
|
|
mail:x:18:
|
2009-04-02 04:00:47 +02:00
|
|
|
storage:x:19:
|
|
|
|
scanner:x:20:
|
2010-04-16 16:52:15 +02:00
|
|
|
plugdev:x:21:
|
2009-01-27 19:28:31 +01:00
|
|
|
nogroup:x:99:
|
2012-07-31 09:31:00 +02:00
|
|
|
users:x:100:
|
2009-01-27 19:28:31 +01:00
|
|
|
_EOF
|
|
|
|
echo "Created default /etc/group file."
|
|
|
|
}
|
|
|
|
|
2009-04-08 03:24:02 +02:00
|
|
|
case "${ACTION}" in
|
2009-02-03 17:32:51 +01:00
|
|
|
post)
|
2009-04-08 03:24:02 +02:00
|
|
|
echo "Running ${PKGNAME}-${VERSION} post installation hooks..."
|
2009-01-27 19:28:31 +01:00
|
|
|
|
|
|
|
[ ! -f ./etc/passwd ] && create_passwd
|
|
|
|
[ ! -f ./etc/group ] && create_group
|
|
|
|
|
|
|
|
if [ ! -f ./etc/shadow ]; then
|
2009-04-08 03:24:02 +02:00
|
|
|
echo "Enabling shadowed (group) passwords..."
|
|
|
|
pwconv && grpconv
|
2009-01-27 19:28:31 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|