summaryrefslogtreecommitdiff
path: root/veracrypt/debian/veracrypt.init
diff options
context:
space:
mode:
Diffstat (limited to 'veracrypt/debian/veracrypt.init')
-rw-r--r--veracrypt/debian/veracrypt.init56
1 files changed, 56 insertions, 0 deletions
diff --git a/veracrypt/debian/veracrypt.init b/veracrypt/debian/veracrypt.init
new file mode 100644
index 0000000..398838a
--- /dev/null
+++ b/veracrypt/debian/veracrypt.init
@@ -0,0 +1,56 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: veracrypt
+# Required-Start:
+# Required-Stop: $remote_fs
+# Should-Start:
+# Should-Stop:
+# Default-Start:
+# Default-Stop: 0 1 6
+# Short-Description: Remove remaining VeraCrypt device mappings.
+# Description: This init script will dismount mounted VeraCrypt partitions before shutdown.
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+VERACRYPT_SHUTDOWN_UNMOUNT="yes"
+
+. /lib/lsb/init-functions
+
+[ -x /usr/bin/veracrypt ] || exit 0
+
+if [ -r /etc/default/veracrypt ]; then
+ . /etc/default/veracrypt
+fi
+
+case "${VERACRYPT_SHUTDOWN_UNMOUNT}" in
+[Nn]*)
+ exit 0
+ ;;
+esac
+
+do_stop()
+{
+ log_action_begin_msg "Removing VeraCrypt device mappings"
+ veracrypt -d
+ log_action_end_msg $?
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ status)
+ veracrypt --list
+ ;;
+ restart|reload|force-reload)
+ # No-op
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo "Usage: $0 stop|status" >&2
+ exit 3
+ ;;
+esac
+
bgstack15