summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--update-me.in26
1 files changed, 18 insertions, 8 deletions
diff --git a/update-me.in b/update-me.in
index f5e08cb..cbd6fd9 100644
--- a/update-me.in
+++ b/update-me.in
@@ -66,6 +66,20 @@ if command -v check-kernel >/dev/null; then
postCmds+=('check-kernel -r')
fi
+command_needs_root() {
+ local cmd
+ cmd="$1"
+ cmd="${cmd%% *}"
+ cmd="${cmd##*/}"
+ if [ "${cmd}" = 'mount' ] \
+ || [ "${cmd}" = 'checkservices' ] \
+ || [ "${cmd}" = 'check-kernel' ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
opportunity_for_rescue_shell() {
if "${play_it_safe}"; then
printf '%s' "$$" >"${safety_file}"
@@ -161,16 +175,14 @@ fi
for cmd in "${preCmds[@]}"
do
- if [ -z "${cmd%%check-kernel*}" ] \
- || [ -z "${cmd%%mount*}" ]; then
+ if command_needs_root "${cmd}"; then
eval ${pre} ${cmd}
else
eval ${cmd}
fi
err=$?
while [ ${err} -ne 0 ] && nochmal_versuchen; do
- if [ -z "${cmd%%check-kernel*}" ] \
- || [ -z "${cmd%%mount*}" ]; then
+ if command_needs_root "${cmd}"; then
eval ${pre} ${cmd}
else
eval ${cmd}
@@ -200,16 +212,14 @@ opportunity_for_rescue_shell
for cmd in "${postCmds[@]}"
do
- if [ -z "${cmd%%check-kernel*}" ] \
- || [ -z "${cmd%%mount*}" ]; then
+ if command_needs_root "${cmd}"; then
eval ${pre} ${cmd}
else
eval ${cmd}
fi
err=$?
while [ ${err} -ne 0 ] && nochmal_versuchen; do
- if [ -z "${cmd%%check-kernel*}" ] \
- || [ -z "${cmd%%mount*}" ]; then
+ if command_needs_root "${cmd}"; then
eval ${pre} ${cmd}
else
eval ${cmd}