aboutsummaryrefslogtreecommitdiff
path: root/debian/postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/postinst')
-rw-r--r--debian/postinst50
1 files changed, 11 insertions, 39 deletions
diff --git a/debian/postinst b/debian/postinst
index 95897c1..b951d83 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -5,56 +5,28 @@
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"
-
+. /usr/share/debconf/confmodule
+. /usr/share/naskpass/naskconf
case "$1" in
install)
;;
configure|upgrade)
- if [ ${RDSUM} = "$(sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then
- active=0
- text="NOT active. Activate?"
+ db_input high naskpass/activate || true
+ db_go
+ db_get naskpass/activate
+ if [ "$RET" = "true" ]; then
+ nask_activate
else
- active=1
- text="active. Deactivate?"
+ nask_deactivate
fi
- set +e
- whiptail --yesno "naskpass is $text" --defaultno 10 70
- choice=$?
- set -e
- case ${choice} in
- 0)
- if [ ${active} -eq 0 ]; then
- echo "Activating naskpass .." >&2
- mv ${ORGFILE} ${DIVFILE} || true
- mv ${BCKFILE} ${ORGFILE} || true
- update-initramfs -u
- elif [ ${active} -eq 1 ]; then
- echo "Deactivating naskpass .." >&2
- mv ${ORGFILE} ${BCKFILE} || true
- cp ${DIVFILE} ${ORGFILE} || true
- update-initramfs -u
- else
- echo "Doin' nothing .." >&2
- fi
- ;;
- 1)
- echo "Keeping naskpass' status .." >&2
- update-initramfs -u
- ;;
- *)
- echo "Unknown whiptail error occured .." >&2
- ;;
- esac
+ echo
+ update-initramfs -u
;;
abort-upgrade)
+ db_purge
;;
*)