From ca9627e70852f6b2e835660df870fe3ab405882d Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 1 Sep 2019 00:00:32 +0200 Subject: Initial import --- sys-apps/util-linux/files/crypto-loop.initd | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 sys-apps/util-linux/files/crypto-loop.initd (limited to 'sys-apps/util-linux/files/crypto-loop.initd') diff --git a/sys-apps/util-linux/files/crypto-loop.initd b/sys-apps/util-linux/files/crypto-loop.initd new file mode 100755 index 0000000..2886982 --- /dev/null +++ b/sys-apps/util-linux/files/crypto-loop.initd @@ -0,0 +1,70 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/files/crypto-loop.initd,v 1.3 2008/02/01 12:36:44 flameeyes Exp $ + +depend() { + if [ -x /etc/init.d/root ]; then + need root + else + need checkroot + fi + need modules + before localmount +} + +start() { + local status="0" + + ebegin "Starting crypto loop devices" + + if [[ -e /etc/conf.d/crypto-loop ]] ; then + egrep "^loop" /etc/conf.d/crypto-loop | \ + while read loopline ; do + eval ${loopline} + + local configured=$(awk -v MOUNT="${device}" \ + '($2 == MOUNT) { print "yes" }' /proc/mounts) + + if [[ ${configured} != "yes" ]] ; then + einfo " Loop ${loop} on device ${device} (cipher ${cipher}, key size ${keysize}): " + + if [[ -n ${hash} ]] ; then + /usr/sbin/hashalot -n ${keysize} ${hash} /dev/null + if [[ $? == 0 ]] ; then + umount ${loop} &>/dev/null || swapoff "${loop}" &>/dev/null + if ! /sbin/losetup -d ${loop} &> /dev/null ; then + ewarn "Failure deconfiguring ${loop}." + status=1 + fi + fi + done + ewend ${status} +} + + +# vim:ts=4 -- cgit v1.2.3