X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=bin%2Flive-reconfigure;h=565bdea80f16e5cacdbab64c2666976e314c2137;hb=fdd8036ba32ad88e83a61191cc4597ae060355d2;hp=4e29768bfb502537940b985be09961abbfc09072;hpb=140b179f0ff73f3cc1c081f6e6641417a5a0788d;p=live-boot-grml.git diff --git a/bin/live-reconfigure b/bin/live-reconfigure index 4e29768..565bdea 100755 --- a/bin/live-reconfigure +++ b/bin/live-reconfigure @@ -1,40 +1,57 @@ #! /bin/sh set -e + export PATH=/usr/bin:/usr/sbin:/sbin:/bin frontend=noninteractive -findcommandinroot() { - ROOT="$1/" - shift - while [ "$#" -ge 1 ]; do - P="$PATH" - while [ "$P" ]; do - D=${P%%:*} - P=${P#*:} - if [ "$D" = "$P" ]; then - P= - fi - if [ -z "$D" ]; then - D=. - fi - if [ -x "$ROOT$D/$1" ]; then - echo "$D/$1" - return 0 - fi - done - shift - done - return 1 +findcommandinroot () +{ + ROOT="$1/" + shift + + while [ "$#" -ge 1 ] + do + P="$PATH" + + while [ "$P" ] + do + D=${P%%:*} + P=${P#*:} + + if [ "$D" = "$P" ] + then + P= + fi + + if [ -z "$D" ] + then + D=. + fi + + if [ -x "$ROOT$D/$1" ] + then + echo "$D/$1" + return 0 + fi + done + + shift + done + + return 1 } -runcommandinroot() { - C=$(findcommandinroot "$1" "$2") - ROOT="$1" - shift - shift - [ -n "$C" ] && chroot "$ROOT" "$C" "$@" +runcommandinroot () +{ + C=$(findcommandinroot "$1" "$2") + ROOT="$1" + + shift + shift + + [ -n "$C" ] && chroot "$ROOT" "$C" "$@" } root="$1" @@ -42,9 +59,10 @@ package="$2" version=$(runcommandinroot "$root" dpkg-query -W --showformat='${Version}' "$package" 2>/dev/null) || version="" -if [ -z "$version" ]; then - echo >&2 "$0: package '$package' is not installed" - exit 0 +if [ -z "$version" ] +then + echo >&2 "$0: package '$package' is not installed" + exit 0 fi runcommandinroot "$root" dpkg-reconfigure -fnoninteractive --no-reload "$package"