From 47b459fe55a098076bd167f8b13d79e3a0705d1d Mon Sep 17 00:00:00 2001 From: toni Date: Sat, 12 Apr 2014 02:27:35 +0200 Subject: initial commit --- debian/preinst | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 debian/preinst (limited to 'debian/preinst') diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..0e9ba2d --- /dev/null +++ b/debian/preinst @@ -0,0 +1,42 @@ +#!/bin/sh +# postinst script for naskpass +# +# see: dh_installdeb(1) + +set -e + + +export RDSUM="5924c70e5c9fabf0398050349c3f4f283ab80091b23ea8c677249ee7bdd41f6e4910ce5e1bc32577e67763dc30d9b96cc3528256e1cc63dba959a5e3866ec21f" +export ORGFILE="/usr/share/initramfs-tools/scripts/local-top/cryptroot" +export DIVFILE="/usr/share/naskpass/cryptroot.orig" + +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} = "$(/usr/bin/sha512sum ${ORGFILE} | grep -Eo '^[0-9a-zA-Z]*')" ]; then + dpkg-divert --package naskpass --divert ${DIVFILE} --rename --add ${ORGFILE} + update-initramfs -u + else + whiptail --title "Wrong SHA checksum" --msgbox "in /usr/share/initramfs-tools/scripts/local-top/cryptroot\n\nabort .." 9 70 + fi + fi + ;; + + upgrade) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 -- cgit v1.2.3