From ec0c7a74bbf5824adc4efa54e1f91984ac870a8e Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 6 May 2009 09:53:36 +0000 Subject: move to .in files --- setup-cryptswap.in | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 setup-cryptswap.in (limited to 'setup-cryptswap.in') diff --git a/setup-cryptswap.in b/setup-cryptswap.in new file mode 100755 index 0000000..0ec11fc --- /dev/null +++ b/setup-cryptswap.in @@ -0,0 +1,48 @@ +#!/bin/sh + +PREFIX= +. "$PREFIX/lib/libalpine.sh" + + +list_partitions() { + awk '$1 ~ /[0-9]/ {print " " $4}' /proc/partitions +} + + +if [ -z "$1" ] ; then + while [ "x$verify" != "xy" ] ; do + echo "Available partitions: " $(list_partitions) + echon "Use what partition for encrypted swap? [none] " + default_read part "none" + + # check if user requested to abort + if [ "x$part" = "xabort" ] || [ "x$part" = "xnone" ] ; then + exit + fi + # check if device exist + [ -e /dev/$part ] || continue + + # let the user verify + echon "Warning! you will lose all data on $part. Continue? (y/n) [n] " + default_read verify "n" + done +else + part=$1 +fi + + +apk_add cryptsetup-luks + +# set the device in /etc/conf.f/cryptswap +if grep ^DEVICE= /etc/conf.d/cryptswap >/dev/null ; then + sed -i 's:^DEVICE=.*:DEVICE=/dev/'$part':' /etc/conf.d/cryptswap +else + echo "DEVICE=/dev/$part" >> /etc/conf.d/cryptswap +fi + +rc_add -k -s 05 cryptswap +rc_add -k -s 06 swap + +/etc/init.d/cryptswap start +/etc/init.d/swap start + -- cgit v1.2.3