pkg-manager.sh: Remove eval from shell commands

Installing packages breaks with eval, because it removes quotes,
notably around perl(XYZ) capabilities. Works just as well without
eval, remove it

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2024-06-30 16:55:44 +00:00
commit b87099bd3a

View file

@ -26,7 +26,7 @@ usage()
run()
{
log "Running ==== $@"
eval "$@"
"$@"
}
cmd_install()
@ -51,24 +51,24 @@ cmd_install()
opts="--force-resolution --auto-agree-with-licenses"
global_opts="$global_opts --non-interactive --gpg-auto-import-keys --no-gpg-checks"
}
eval run sudo $env -S zypper $global_opts install $opts "$@"
run sudo $env -S zypper $global_opts install $opts "$@"
;;
debian|ubuntu|raspbian)
[ "$non_interactive" = 1 ] && {
global_opts="$global_opts -yq"
env="$env DEBIAN_FRONTEND=noninteractive"
}
eval run sudo $env -S apt-get $global_opts install "$@"
run sudo $env -S apt-get $global_opts install "$@"
;;
arch)
[ "$non_interactive" = 1 ] && {
global_opts="$global_opts --noconfirm"
env="$env DEBIAN_FRONTEND=noninteractive"
}
eval run sudo $env -S pacman $global_opts -S --needed "$@"
run sudo $env -S pacman $global_opts -S --needed "$@"
;;
centos)
eval run sudo $env -S yum $global_opts install -y "$@"
run sudo $env -S yum $global_opts install -y "$@"
;;
*)
fatal "Tried to install on unsupported platform \"$ID\""
@ -97,14 +97,14 @@ cmd_refresh()
[ "$non_interactive" = 1 ] && {
global_opts="$global_opts --non-interactive --gpg-auto-import-keys --no-gpg-checks"
}
eval run sudo $env -S zypper $global_opts refresh $opts "$@"
run sudo $env -S zypper $global_opts refresh $opts "$@"
;;
debian|ubuntu|raspbian)
eval run sudo $env -S apt-get $global_opts update "$@"
run sudo $env -S apt-get $global_opts update "$@"
;;
centos)
eval run sudo $env -S yum $global_opts clean expire-cache "$@"
eval run sudo $env -S yum $global_opts makecache "$@"
run sudo $env -S yum $global_opts clean expire-cache "$@"
run sudo $env -S yum $global_opts makecache "$@"
;;
*)
fatal "Tried to update unsupported platform \"$ID\""
@ -118,5 +118,4 @@ myname=`basename $0`
ID=${ID%%-*}
cmd="$1"
shift
eval cmd_$cmd "$@"
cmd_$cmd "$@"