2009-01-27 19:28:31 +01:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
|
|
|
|
|
|
|
# $1 = chrootdir
|
|
|
|
# $2 = action
|
|
|
|
# $3 = pkgname
|
|
|
|
# $4 = version
|
|
|
|
|
|
|
|
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:
|
|
|
|
uucp:x:11:
|
|
|
|
audio:x:12:
|
|
|
|
video:x:13:
|
|
|
|
utmp:x:14:
|
|
|
|
usb:x:15:
|
|
|
|
cdrom:x:16:
|
|
|
|
man:x:17:
|
|
|
|
mail:x:18:
|
|
|
|
dialout:x:19:
|
2009-01-27 19:28:31 +01:00
|
|
|
nogroup:x:99:
|
|
|
|
users:x:1000:
|
|
|
|
_EOF
|
|
|
|
echo "Created default /etc/group file."
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$2" in
|
2009-02-03 17:32:51 +01:00
|
|
|
pre)
|
2009-01-27 19:28:31 +01:00
|
|
|
;;
|
2009-02-03 17:32:51 +01:00
|
|
|
post)
|
2009-02-26 18:01:18 +01:00
|
|
|
echo "Running $3-$4 post installation hooks..."
|
2009-01-27 19:28:31 +01:00
|
|
|
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..."
|
2009-02-03 17:32:51 +01:00
|
|
|
${run_cmd}
|
2009-01-27 19:28:31 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|