From b49e98af69db2811c9dd0d483a9b56dbed0b3c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 26 Mar 2014 16:40:19 +0100 Subject: [PATCH] Fix support of multi-partitions keys. --- fs/opt/groomer/constraint.sh | 3 ++- fs/opt/groomer/groomer.sh | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/opt/groomer/constraint.sh b/fs/opt/groomer/constraint.sh index 3b220e2..2290d47 100644 --- a/fs/opt/groomer/constraint.sh +++ b/fs/opt/groomer/constraint.sh @@ -6,7 +6,7 @@ USERNAME='kitten' HOME="/home/${USERNAME}" MUSIC="/opt/midi/" -TMP="/tmp/" +TMP="/tmp" # Paths used in multiple scripts SRC="${TMP}/src" @@ -21,6 +21,7 @@ SUDO='/usr/bin/sudo' ID=`/usr/bin/id -u` SYNC='/bin/sync' TIMIDITY='/usr/bin/timidity' +MOUNT='/bin/mount' # root commands. # To avoid the risk that an attacker use -o remount on mount and other nasty diff --git a/fs/opt/groomer/groomer.sh b/fs/opt/groomer/groomer.sh index c0bcd80..4fd65eb 100755 --- a/fs/opt/groomer/groomer.sh +++ b/fs/opt/groomer/groomer.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -#set -x +set -x source ./constraint.sh if ! [ "${ID}" -ge "1000" ]; then @@ -37,7 +37,7 @@ if [ ! -b ${DEV_SRC} ]; then fi # Find the partition names on the source device DEV_PARTITIONS=`ls "${DEV_SRC}"* | grep "${DEV_SRC}[1-9][0-6]*" || true` -if [ -z ${DEV_PARTITIONS} ]; then +if [ -z "${DEV_PARTITIONS}" ]; then echo "${DEV_SRC} does not have any partitions." exit fi @@ -86,7 +86,7 @@ for partition in ${DEV_PARTITIONS} do # Processing a partition echo "Processing partition: ${partition}" - if ${MOUNT}|grep ${SRC}; then + if [ `${MOUNT} | grep -c ${SRC}` -ne 0 ]; then ${SUDO} ${UMOUNT} ${SRC} fi