* 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
44 lines
743 B
Bash
Executable File
44 lines
743 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
case $1 in
|
|
preinst)
|
|
exit 0
|
|
;;
|
|
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
|
|
chroot ${TARGET} snap refresh
|
|
else
|
|
snap refresh
|
|
fi
|
|
exit 0
|
|
;;
|
|
prerm)
|
|
exit 0
|
|
;;
|
|
postrm)
|
|
exit 0
|
|
;;
|
|
esac
|