--- crypto-loop.initd +++ crypto-loop.initd @@ -18,7 +18,7 @@ ebegin "Starting crypto loop devices" - if [[ -e /etc/conf.d/crypto-loop ]] ; then + if [ -e /etc/conf.d/crypto-loop ] ; then egrep "^loop" /etc/conf.d/crypto-loop | \ while read loopline ; do eval ${loopline} @@ -26,17 +26,17 @@ local configured=$(awk -v MOUNT="${device}" \ '($2 == MOUNT) { print "yes" }' /proc/mounts) - if [[ ${configured} != "yes" ]] ; then + if [ "${configured}" != "yes" ] ; then einfo " Loop ${loop} on device ${device} (cipher ${cipher}, key size ${keysize}): " - if [[ -n ${hash} ]] ; then + 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 + for loop in /dev/loop[0-9] ; do + [ -e "${loop}" ] || continue + losetup ${loop} > /dev/null 2>&1 + if [ $? -eq 0 ] ; then + umount ${loop} >/dev/null 2>&1 || swapoff "${loop}" >/dev/null 2>&1 + if ! /sbin/losetup -d ${loop} > /dev/null 2>&1; then ewarn "Failure deconfiguring ${loop}." status=1 fi