summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-01-02 20:52:08 +0100
committerErich Eckner <git@eckner.net>2021-01-02 20:52:08 +0100
commit79fd68d3d2c412ead7cb655ab813a0b25d5e1a6f (patch)
treec968c50bff1cde62e8296791dbfeea8da91bc2b1
parentf764698c8ab5080a7cbe308a3c653cc4652aea5a (diff)
downloadupdate-all-79fd68d3d2c412ead7cb655ab813a0b25d5e1a6f.tar.xz
update-me: correctly unwrap `bash -c "..."`
-rw-r--r--update-me.in11
1 files changed, 8 insertions, 3 deletions
diff --git a/update-me.in b/update-me.in
index dcac3af..0c84c16 100644
--- a/update-me.in
+++ b/update-me.in
@@ -72,9 +72,14 @@ fi
command_needs_root() {
local cmd
- cmd="$1"
- cmd="${cmd%% *}"
- cmd="${cmd##*/}"
+ cmd=$(
+ printf '%s\n' "$1" \
+ | sed '
+ s@^bash -c "\(.*\)"$@\1@
+ s@ .*$@@
+ s@^.*/@@
+ '
+ )
if [ "${cmd}" = 'mount' ] \
|| [ "${cmd}" = 'checkservices' ] \
|| [ "${cmd}" = 'check-kernel' ]; then