aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdebian/naskpass.prerm1
-rwxr-xr-xdebian/rules7
-rwxr-xr-xscripts/naskpass.initconf7
-rwxr-xr-xscripts/naskpass.inithook8
-rwxr-xr-xscripts/naskpass.initscript4
-rwxr-xr-xscripts/naskpass.post5
-rwxr-xr-xscripts/naskpass.pre21
-rw-r--r--src/opt.c6
8 files changed, 52 insertions, 7 deletions
diff --git a/debian/naskpass.prerm b/debian/naskpass.prerm
index 5b1c46d..afcf9b1 100755
--- a/debian/naskpass.prerm
+++ b/debian/naskpass.prerm
@@ -13,6 +13,7 @@ case "$1" in
remove|purge)
nask_deactivate
db_purge
+ update-initramfs -u
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
diff --git a/debian/rules b/debian/rules
index 1c41e7c..5375c6b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -39,9 +39,12 @@ install: build
dh_installdebconf
$(MAKE) install prefix=$(CURDIR)/debian/naskpass
mkdir -p $(CURDIR)/debian/naskpass/usr/share/naskpass
- install -D -m755 ./scripts/naskconf $(CURDIR)/debian/naskpass/usr/share/naskpass/
- install -D -m755 ./scripts/naskpass.inithook $(CURDIR)/debian/naskpass/usr/share/naskpass/
+ install -D -m755 ./scripts/naskconf $(CURDIR)/debian/naskpass/usr/share/naskpass/
+ install -D -m755 ./scripts/naskpass.inithook $(CURDIR)/debian/naskpass/usr/share/naskpass/
install -D -m755 ./scripts/naskpass.initscript $(CURDIR)/debian/naskpass/usr/share/naskpass/
+ install -D -m755 ./scripts/naskpass.initconf $(CURDIR)/debian/naskpass/usr/share/naskpass/
+ install -D -m755 ./scripts/naskpass.pre $(CURDIR)/debian/naskpass/usr/share/naskpass/
+ install -D -m755 ./scripts/naskpass.post $(CURDIR)/debian/naskpass/usr/share/naskpass/
binary-indep: build install
diff --git a/scripts/naskpass.initconf b/scripts/naskpass.initconf
new file mode 100755
index 0000000..2e16e82
--- /dev/null
+++ b/scripts/naskpass.initconf
@@ -0,0 +1,7 @@
+# initramfs naskpass config file
+
+# network device
+NETDEV=eth0
+
+# maximum ip wait time in seconds
+MAXWAIT=10
diff --git a/scripts/naskpass.inithook b/scripts/naskpass.inithook
index 074dff3..01dbf24 100755
--- a/scripts/naskpass.inithook
+++ b/scripts/naskpass.inithook
@@ -18,8 +18,12 @@ esac
. /usr/share/initramfs-tools/hook-functions
-copy_exec /lib/cryptsetup/naskpass /lib/cryptsetup
-copy_exec /lib/cryptsetup/naskpass_check /lib/cryptsetup
+copy_exec /lib/cryptsetup/naskpass /lib/cryptsetup
+copy_exec /lib/cryptsetup/naskpass_check /lib/cryptsetup
+copy_exec /usr/share/naskpass/naskpass.pre /lib/cryptsetup
+copy_exec /usr/share/naskpass/naskpass.post /lib/cryptsetup
+cp /usr/share/naskpass/naskpass.initconf /etc/naskpass.conf
+
mkdir -p ${DESTDIR}/lib/terminfo/l
cp /lib/terminfo/l/linux ${DESTDIR}/lib/terminfo/l/
diff --git a/scripts/naskpass.initscript b/scripts/naskpass.initscript
index 98fd1dc..5f2c919 100755
--- a/scripts/naskpass.initscript
+++ b/scripts/naskpass.initscript
@@ -312,14 +312,14 @@ setup_mapping()
continue
fi
else
- dmesg -n 1
+ /lib/cryptsetup/naskpass.pre
if ! $cryptkeyscript -c "/sbin/cryptsetup -T 1 open $cryptsource $crypttarget"; then
message "naskpass: failed"
continue
else
message "naskpass: success"
fi
- dmesg -n 4
+ /lib/cryptsetup/naskpass.post
fi
fi
diff --git a/scripts/naskpass.post b/scripts/naskpass.post
new file mode 100755
index 0000000..f443bea
--- /dev/null
+++ b/scripts/naskpass.post
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+
+. /etc/naskpass.conf
+dmesg -E
diff --git a/scripts/naskpass.pre b/scripts/naskpass.pre
new file mode 100755
index 0000000..8a2d25d
--- /dev/null
+++ b/scripts/naskpass.pre
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+
+. /etc/naskpass.conf
+
+
+echo -n 'waiting for ip ...'
+CURWAIT=$MAXWAIT
+
+if [ -x /sbin/dropbear ]; then
+while ! $(ifconfig -a | grep -oE 'inet addr:'); do
+ echo -n '.'
+ if [ $CURWAIT -le 0 ]; then
+ echo ' got no ip, continue anyway.'
+ break
+ fi
+ expr $CURWAIT - 1
+done
+fi
+
+dmesg -D
diff --git a/src/opt.c b/src/opt.c
index 0c2071a..996b4bb 100644
--- a/src/opt.c
+++ b/src/opt.c
@@ -20,7 +20,11 @@ usage(char *arg0)
fprintf(stderr, " Written by %s (%s).\n", AUTHOR, AUTHOR_EMAIL);
fprintf(stderr, " License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n\n");
fprintf(stderr, " Command:\n\t%s [args]\n", arg0);
- fprintf(stderr, " Arguments:\n\t-h this\n\t-l [logfile]\n\t-f [passfifo] default: %s\n\t-c [cryptcreate]\n", GETOPT(FIFO_PATH).str);
+ fprintf(stderr, " Arguments:\n"
+ "\t-h this\n"
+ "\t-l [logfile]\n"
+ "\t-f [passfifo] default: %s\n"
+ "\t-c [cryptcreate]\n", GETOPT(FIFO_PATH).str);
}
int