Completely re-written to be more modular (hopefully easier to follow):
* Separated logic in Snap.pm, Commands.pm, Package.pm, and Sources.pm * Removed usher creation of directory structure (now in files.tar.gz) * Files like /etc/passwd now handled by snap-base
This commit is contained in:
87
SNAP/usher
87
SNAP/usher
@@ -2,94 +2,9 @@
|
||||
|
||||
set -e
|
||||
|
||||
PASSWD="root:SETPASS:0:0:root:/root:/bin/bash
|
||||
bin:x:1:1:bin:/dev/null:/bin/false
|
||||
daemon:x:6:6:Daemon User:/dev/null:/bin/false
|
||||
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
|
||||
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false"
|
||||
|
||||
GROUP="root:x:0:
|
||||
bin:x:1:daemon
|
||||
sys:x:2:
|
||||
kmem:x:3:
|
||||
tape:x:4:
|
||||
tty:x:5:
|
||||
daemon:x:6:
|
||||
floppy:x:7:
|
||||
disk:x:8:
|
||||
lp:x:9:
|
||||
dialout:x:10:
|
||||
audio:x:11:
|
||||
video:x:12:
|
||||
utmp:x:13:
|
||||
usb:x:14:
|
||||
cdrom:x:15:
|
||||
adm:x:16:
|
||||
messagebus:x:18:
|
||||
input:x:24:
|
||||
mail:x:34:
|
||||
nogroup:x:99:
|
||||
users:x:999:"
|
||||
|
||||
case $1 in
|
||||
preinst)
|
||||
echo "Creating base directory structure"
|
||||
install -d -m 755 ${TARGET}/etc/{ld.so,conf.d,opt}
|
||||
install -d -m 755 ${TARGET}/usr/bin
|
||||
install -d -m 755 ${TARGET}/bin
|
||||
install -d -m 755 ${TARGET}/boot
|
||||
install -d -m 755 ${TARGET}/dev
|
||||
install -d -m 755 ${TARGET}/home
|
||||
install -d -m 755 ${TARGET}/lib
|
||||
install -d -m 755 ${TARGET}/media/{cdrom,floppy}
|
||||
install -d -m 755 ${TARGET}/mnt
|
||||
install -d -m 755 ${TARGET}/opt
|
||||
install -d -m 755 ${TARGET}/proc
|
||||
install -d -m 750 ${TARGET}/root
|
||||
install -d -m 755 ${TARGET}/run/lock
|
||||
install -d -m 755 ${TARGET}/sbin
|
||||
install -d -m 755 ${TARGET}/srv
|
||||
install -d -m 755 ${TARGET}/sys
|
||||
install -d -m 1777 ${TARGET}/tmp
|
||||
install -d -m 755 ${TARGET}/usr/{bin,include,lib,libexec,local}
|
||||
install -d -m 755 ${TARGET}/usr/local/{bin,include,lib,sbin,share}
|
||||
install -d -m 755 \
|
||||
${TARGET}/usr/local/share/{color,dict,doc,info,locale,man}
|
||||
install -d -m 755 ${TARGET}/usr/local/share/man/man{1..8}
|
||||
install -d -m 755 ${TARGET}/usr/local/share/{misc,terminfo,zoneinfo}
|
||||
install -d -m 755 ${TARGET}/usr/local/src
|
||||
install -d -m 755 ${TARGET}/usr/{sbin,share}
|
||||
install -d -m 755 ${TARGET}/usr/share/{color,dict,doc,info,locale}
|
||||
install -d -m 755 ${TARGET}/usr/share/man/man{1..8}
|
||||
install -d -m 755 ${TARGET}/usr/share/{misc,snap,terminfo,zoneinfo}
|
||||
install -d -m 755 ${TARGET}/usr/src
|
||||
install -d -m 755 ${TARGET}/var/cache/nscd
|
||||
install -d -m 755 ${TARGET}/var/lib/{color,locate,misc}
|
||||
install -d -m 755 ${TARGET}/var/{local,log,mail,opt,snap,spool}
|
||||
install -d -m 1777 ${TARGET}/var/tmp
|
||||
install -m 600 /dev/null ${TARGET}/var/log/btmp
|
||||
install -m 644 /dev/null ${TARGET}/var/log/wtmp
|
||||
install -m 664 /dev/null ${TARGET}/var/log/lastlog
|
||||
ln -sf /proc/self/mounts ${TARGET}/etc/mtab
|
||||
ln -sf lib ${TARGET}/lib64
|
||||
ln -sf lib ${TARGET}/usr/lib64
|
||||
ln -sf lib ${TARGET}/usr/local/lib64
|
||||
ln -sf /run/lock ${TARGET}/var/lock
|
||||
ln -sf /run ${TARGET}/var/run
|
||||
|
||||
if [ ! -f ${TARGET}/etc/resolv.conf ]&&[ -f /etc/resolv.conf ]; then
|
||||
echo "Copying resolv.conf from temporary system"
|
||||
cp /etc/resolv.conf ${TARGET}/etc/resolv.conf
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/passwd ]; then
|
||||
echo "Creating /etc/passwd"
|
||||
echo "${PASSWD}" > ${TARGET}/etc/passwd
|
||||
fi
|
||||
if [ ! -f ${TARGET}/etc/group ]; then
|
||||
echo "Creating /etc/group"
|
||||
echo "${GROUP}" > ${TARGET}/etc/group
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
postinst)
|
||||
setpass=`cat ${TARGET}/etc/shadow|grep ^root|awk -F':' '{print $2}'`
|
||||
|
||||
Reference in New Issue
Block a user