mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
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:
parent
c41be45610
commit
b87099bd3a
1 changed files with 10 additions and 11 deletions
|
|
@ -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 "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue