Commit 3f486672 authored by Vitaly Lipatov's avatar Vitaly Lipatov

introduce PMTYPE (apt-rpm, apt-dpkg) and use it

parent 7ce6c057
...@@ -81,6 +81,9 @@ for opt in "$@" ; do ...@@ -81,6 +81,9 @@ for opt in "$@" ; do
-e|remove) -e|remove)
epm_cmd=remove epm_cmd=remove
;; ;;
dist-upgrade|upgrade)
epm_cmd=upgrade
;;
-s|search) -s|search)
epm_cmd=search epm_cmd=search
;; ;;
...@@ -117,6 +120,8 @@ DISTRVENDOR=distr_vendor ...@@ -117,6 +120,8 @@ DISTRVENDOR=distr_vendor
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env set_target_pkg_env
set_pm_type
[ -n "$epm_cmd" ] || fatal "Run without command" [ -n "$epm_cmd" ] || fatal "Run without command"
epm_cmd_file=$(dirname $0)/epm-$epm_cmd epm_cmd_file=$(dirname $0)/epm-$epm_cmd
......
...@@ -67,3 +67,33 @@ fatal() ...@@ -67,3 +67,33 @@ fatal()
fi fi
exit 1 exit 1
} }
# FIXME: detect if not recognized
set_pm_type()
{
local CMD
case $DISTRNAME in
"ALTLinux"|"PCLinux")
CMD="apt-rpm"
;;
"FreeBSD")
CMD="pkg_add"
;;
"Ubuntu"|"Debian")
CMD="apt-dpkg"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum-rpm"
;;
"Mandriva")
CMD="urpm-rpm"
;;
"SUSE")
CMD="zypper-rpm"
;;
*)
fatal "Do not known command for DISTRNAME $DISTRNAME"
;;
esac
PMTYPE=$CMD
}
...@@ -22,13 +22,12 @@ ...@@ -22,13 +22,12 @@
epm_update() epm_update()
{ {
#docmd $CMD $pkg_files $pkg_names case $PMTYPE in
"apt-rpm")
case $DISTRNAME in apt-get update || exit
"ALTLinux") apt-get -f install || exit
exit 0
;; ;;
"Ubuntu"|"Debian"|"PCLinux") "apt-dpkg")
apt-get update || exit apt-get update || exit
apt-get -f install || exit apt-get -f install || exit
apt-get autoremove apt-get autoremove
......
...@@ -18,31 +18,29 @@ ...@@ -18,31 +18,29 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# copied from korinf/tools/run-script/scripts/search epm_upgrade()
epm_search()
{ {
[ -n "$pkg_filenames" ] || fatal "Run search without names" [ -n "$pkg_filenames" ] && fatal "No need any args for upgrade command"
case $DISTRNAME in echo "Run command for upgrade packages"
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux") case $PMTYPE in
apt-rpm|apt-dpkg)
# FIXME: apt-get update before
CMD="apt-get dist-upgrade" CMD="apt-get dist-upgrade"
;; ;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific") yum-rpm)
CMD="yum update" CMD="yum update"
;; ;;
# "Mandriva") urpm-rpm)
# CMD="urpmf" CMD="urpmi --auto-update"
# ;; ;;
"SUSE") zypper-rpm)
CMD="zypper update" CMD="zypper update"
;; ;;
*) *)
RET=1 fatal "Do not known command for $PMTYPE"
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;; ;;
esac esac
docmd $CMD $pkg_filenames
docmd $CMD
} }
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