diff options
author | toni <matzeton@googlemail.com> | 2014-04-22 08:25:24 +0200 |
---|---|---|
committer | toni <matzeton@googlemail.com> | 2014-04-22 08:25:24 +0200 |
commit | 597e1d4918ce533a977f7214868cf00a201ace7d (patch) | |
tree | 72e6a8ac9af1c8c94df6f2912802cdaf6a8e3ad0 | |
parent | 85630c7a02d90a5e1a2e317349578a66bb8b67bc (diff) |
added activate/deactivate feature (9)
-rw-r--r-- | debian/postinst | 25 | ||||
-rw-r--r-- | debian/preinst | 8 |
2 files changed, 13 insertions, 20 deletions
diff --git a/debian/postinst b/debian/postinst index ee72917..3177933 100644 --- a/debian/postinst +++ b/debian/postinst @@ -14,19 +14,9 @@ export BCKFILE="/var/backups/cryptroot.naskpass" case "$1" in install) - mkdir -p /usr/share/naskpass - if [ ! -f ${ORGFILE} ]; then - whiptail --title "Missing file" --msgbox "/usr/share/initramfs-tools/scripts/local-top/cryptroot is missing!\nabort .." 9 70 - else - if [ ${RDSUM} = "$(sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then - dpkg-divert --package naskpass --divert ${DIVFILE} --rename --add ${ORGFILE} - else - whiptail --title "Wrong SHA checksum" --msgbox "in /usr/share/initramfs-tools/scripts/local-top/cryptroot\n\nabort .." 9 70 - fi - fi ;; - configure) + configure|upgrade) if [ ${RDSUM} = "$(sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then active=0 text="NOT active. Activate?" @@ -42,15 +32,13 @@ case "$1" in 0) if [ ${active} -eq 0 ]; then echo "Activating naskpass .." >&2 - dpkg-divert --package naskpass --divert ${DIVFILE} --rename --add ${ORGFILE} || true - if [ ! -r ${ORGFILE} ]; then - mv ${BCKFILE} ${ORGFILE} 2>/dev/null || true - fi + mv ${ORGFILE} ${DIVFILE} || true + mv ${BCKFILE} ${ORGFILE} || true update-initramfs -u elif [ ${active} -eq 1 ]; then echo "Deactivating naskpass .." >&2 - mv ${ORGFILE} ${BCKFILE} 2>/dev/null || true - dpkg-divert --package naskpass --remove --rename ${ORGFILE} || true + mv ${ORGFILE} ${BCKFILE} || true + cp ${DIVFILE} ${ORGFILE} || true update-initramfs -u else echo "Doin' nothing .." >&2 @@ -65,8 +53,7 @@ case "$1" in esac ;; - upgrade|abort-upgrade) - update-initramfs -u + abort-upgrade) ;; *) diff --git a/debian/preinst b/debian/preinst index e6e374c..f50aa9f 100644 --- a/debian/preinst +++ b/debian/preinst @@ -9,9 +9,15 @@ set -e export RDSUM="5924c70e5c9fabf0398050349c3f4f283ab80091b23ea8c677249ee7bdd41f6e4910ce5e1bc32577e67763dc30d9b96cc3528256e1cc63dba959a5e3866ec21f" export ORGFILE="/usr/share/initramfs-tools/scripts/local-top/cryptroot" export DIVFILE="/usr/share/naskpass/cryptroot.orig" +export BCKFILE="/var/backups/cryptroot.naskpass" case "$1" in - install|upgrade) + upgrade) + if [ -f ${BCKFILE} ]; then + mv ${BCKFILE} ${ORGFILE} || true + fi + ;; + install) mkdir -p /usr/share/naskpass if [ ! -f ${ORGFILE} ]; then whiptail --title "Missing file" --msgbox "/usr/share/initramfs-tools/scripts/local-top/cryptroot is missing!\nabort .." 9 70 |