summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--update-me.in29
1 files changed, 14 insertions, 15 deletions
diff --git a/update-me.in b/update-me.in
index 00864ee..f3854fb 100644
--- a/update-me.in
+++ b/update-me.in
@@ -22,19 +22,8 @@ fi
. #ETCDIR#/update-me.conf
-if "${hasSudo}" && \
- command -v sudo >/dev/null; then
- for ((i=0; i<${#preCmds[@]}; i++)); do
- if [ -z "${preCmds[${i}]%%mount*}" ]; then
- preCmds[${i}]='sudo '"${preCmds[${i}]}";
- fi
- done
- for ((i=0; i<${#postCmds[@]}; i++)); do
- if [ "${postCmds[${i}]}" = 'check-kernel -r' ] \
- || [ -z "${postCmds[${i}]%%mount*}" ]; then
- postCmds[${i}]='sudo '"${postCmds[${i}]}";
- fi
- done
+if ! command -v sudo >/dev/null; then
+ hasSudo=false
fi
if [ ! "$(whoami)" == "root" ]; then
@@ -74,7 +63,12 @@ fi
for cmd in "${preCmds[@]}"
do
- ${cmd}
+ if [ -z "${cmd%%check-kernel*}" ] \
+ || [ -z "${cmd%%mount*}" ]; then
+ ${pre} ${cmd}
+ else
+ ${cmd}
+ fi
err=$?
if [ ${err} -ne 0 ]
then
@@ -98,7 +92,12 @@ done
for cmd in "${postCmds[@]}"
do
- ${cmd}
+ if [ -z "${cmd%%check-kernel*}" ] \
+ || [ -z "${cmd%%mount*}" ]; then
+ ${pre} ${cmd}
+ else
+ ${cmd}
+ fi
err=$?
if [ ${err} -ne 0 ]
then