- Moved away from versioned directory for better tracking
- Modified usher to set root password if not already set - Modified snap to deal with circular dependencies properly - Now snap properly checks exit value for usher postinst
This commit is contained in:
30
SNAP/usher
30
SNAP/usher
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
PASSWD="root:x:0:0:root:/root:/bin/bash
|
||||
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
|
||||
@@ -84,18 +84,38 @@ case $1 in
|
||||
|
||||
if [ ! -f ${TARGET}/etc/passwd ]; then
|
||||
echo "Creating /etc/passwd"
|
||||
echo ${PASSWD} > ${TARGET}/etc/passwd
|
||||
echo "${PASSWD}" > ${TARGET}/etc/passwd
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/group ]; then
|
||||
echo "Creating /etc/group"
|
||||
echo ${GROUP} > ${TARGET}/etc/group
|
||||
echo "${GROUP}" > ${TARGET}/etc/group
|
||||
fi
|
||||
;;
|
||||
postinst)
|
||||
setpass=`cat ${TARGET}/etc/shadow|grep ^root|awk -F':' '{print $2}'`
|
||||
|
||||
if [ "$setpass" == 'SETPASS' ]; then
|
||||
echo "Setting root password"
|
||||
|
||||
if [[ ${TARGET} ]]; then
|
||||
if ! mountpoint ${TARGET}/dev; then
|
||||
mount -o ro -t devtmpfs devtmpfs ${TARGET}/dev
|
||||
chroot ${TARGET} passwd root
|
||||
umount ${TARGET}/dev
|
||||
else
|
||||
chroot ${TARGET} passwd root
|
||||
fi
|
||||
else
|
||||
passwd root
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Refreshing snap"
|
||||
|
||||
if [[ ${TARGET} ]]; then
|
||||
echo "Refreshing snap"
|
||||
chroot ${TARGET} snap refresh
|
||||
else
|
||||
snap refresh
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user