Files
snap/SNAP/usher
Jay Larson 47dfb92801 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
2017-05-17 10:27:15 -05:00

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