Commit 3840fe47 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-install: rewrite pkg_(non)installed for get correct return status

parent 99f74d79
...@@ -48,6 +48,38 @@ __use_zypper_no_gpg_checks() ...@@ -48,6 +48,38 @@ __use_zypper_no_gpg_checks()
a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks" a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
} }
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd_foreach()
{
local cmd_re=$1
local cmd_in=$2
shift 2
separate_installed $@
if [ -n "$pkg_noninstalled" ] ; then
sudocmd_foreach "$cmd_re" $pkg_noninstalled || return
fi
if [ -n "$pkg_installed" ] ; then
sudocmd_foreach "$cmd_in" $pkg_installed || return
fi
return 0
}
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd()
{
local cmd_re=$1
local cmd_in=$2
shift 2
separate_installed $@
if [ -n "$pkg_noninstalled" ] ; then
sudocmd "$cmd_re" $pkg_noninstalled || return
fi
if [ -n "$pkg_installed" ] ; then
sudocmd "$cmd_in" $pkg_installed || return
fi
return 0
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
...@@ -92,29 +124,21 @@ epm_install_names() ...@@ -92,29 +124,21 @@ epm_install_names()
sudocmd mpkg install $@ sudocmd mpkg install $@
return ;; return ;;
npackd) npackd)
separate_installed $@ # FIXME: correct arg
# FIXME: fix return status __separate_sudocmd_foreach "npackdcl add --package=" "npackdcl update --package=" $@
[ -n "$pkg_noninstalled" ] && sudocmd npackdcl add --package=$@ $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd npackdcl update --package=$@ $pkg_installed
return ;; return ;;
slackpkg) slackpkg)
separate_installed $@ __separate_sudocmd_foreach "/usr/sbin/slackpkg install" "/usr/sbin/slackpkg upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/usr/sbin/slackpkg install" $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd_foreach "/usr/sbin/slackpkg upgrade" $pkg_installed
return ;; return ;;
homebrew) homebrew)
separate_installed $@ __separate_sudocmd "brew install" "brew upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd brew install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd brew upgrade $pkg_installed
return ;; return ;;
ipkg) ipkg)
[ -n "$force" ] && force=-force-depends [ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@ sudocmd ipkg $force install $@
return ;; return ;;
nix) nix)
separate_installed $@ __separate_sudocmd "nix-env --install" "nix-env --upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd nix-env --install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd nix-env --upgrade $pkg_installed
return ;; return ;;
*) *)
fatal "Have no suitable install command for $PMTYPE" fatal "Have no suitable install command for $PMTYPE"
...@@ -166,10 +190,8 @@ epm_ni_install_names() ...@@ -166,10 +190,8 @@ epm_ni_install_names()
sudocmd nix-env --install $@ sudocmd nix-env --install $@
return ;; return ;;
slackpkg) slackpkg)
separate_installed $@
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" $pkg_noninstalled __separate_sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $@
[ -n "$pkg_installed" ] && sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $pkg_installed
return ;; return ;;
*) *)
fatal "Have no suitable appropriate install command for $PMTYPE" fatal "Have no suitable appropriate install command for $PMTYPE"
...@@ -269,10 +291,8 @@ epm_install_files() ...@@ -269,10 +291,8 @@ epm_install_files()
return ;; return ;;
slackpkg) slackpkg)
# FIXME: check for full package name # FIXME: check for full package name
separate_installed $@
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/sbin/installpkg" $pkg_noninstalled __separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
[ -n "$pkg_installed" ] && sudocmd_foreach "/sbin/upgradepkg" $pkg_installed
return ;; return ;;
esac esac
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment