Commit e96eae97 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60P as 0.9.1-alt0.M60P.1 (with rpmbph script)

parents 71eed66a 329fd167
1. Разобраться с поиском по локальным пакетам
2. Дописать таблицу на вики и по ней справку
3. Переделать по возможности все команды на PMTYPE
4. Проверить, что в общем всё работает
5. Там, где нужно, добавить $SUDO
6. rpmqf, если не найдёт в локальной базе, могла бы искать в глобальной
6. rpmqf, если не найдёт в локальной базе, могла бы искать в глобальной (search_file)
7. Дописать начатый reinstall (повторную установку), с --force при установке пакета
Отказаться от distr_vendor в rpm-build-altlinux-compat и использовать distr_info отсюда.
Replace rpmU with epmi
Возможность вывода/возврата команды, планируемой к выполнению
(префикс $OUTPUT перед всеми командами?)
test requies делать перед сборкой! :)
......@@ -48,16 +48,21 @@ $(get_help HELPOPT)
print_version()
{
echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012"
echo "This program may be freely redistributed under the terms of the GNU GPL"
echo "This program may be freely redistributed under the terms of the GNU GPL."
}
Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager"
set_pm_type
verbose=
quiet=
nodeps=
non_interactive=
skip_installed=
epm_cmd=
pkg_files=
pkg_names=
......@@ -76,30 +81,19 @@ case $progname in
epmqf)
epm_cmd=query_file
;;
epm)
epm|upm)
;;
*)
fatal "Unknown command: $progname"
;;
esac
for opt in "$@" ; do
case $opt in
-h|--help|help) # HELPOPT: this help
phelp; exit 0
;;
-v|--version) # HELPOPT: print version
print_version; exit 0
;;
--verbose) # HELPOPT: verbose mode
verbose=1
;;
--quiet) # HELPOPT: quiet mode (do not print commands before exec)
quiet=1
;;
--auto) # HELPOPT: non interactive mode
non_interactive=1
;;
check_command()
{
# do not override command
[ -z "$epm_cmd" ] || return
case $1 in
-i|install|add) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install
;;
......@@ -133,17 +127,66 @@ for opt in "$@" ; do
-qf|which) # HELPCMD: query package(s) owning file
epm_cmd=query_file
;;
filesearch) # HELPCMD: search in which package a file is included
epm_cmd=search_file
;;
-ql|filelist) # HELPCMD: print package file list
epm_cmd=filelist
;;
check|simulate) # HELPCMD: simulate install (check requires)
epm_cmd=$opt
check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=check
;;
checkpkg|integrity) # HELPCMD: check package integrity
epm_cmd=checkpkg
;;
simulate) # HELPCMD: simulate install (check requires)
epm_cmd=simulate
;;
addrepo) # HELPCMD: add package repo
epm_cmd=addrepo
;;
repolist|sl) # HELPCMD: print repo list
epm_cmd=repolist
;;
removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo
;;
*)
return 1
esac
return 0
}
for opt in "$@" ; do
check_command $opt && continue
case $opt in
-h|--help|help) # HELPOPT: this help
phelp; exit 0
;;
-v|--version) # HELPOPT: print version
print_version; exit 0
;;
--verbose) # HELPOPT: verbose mode
verbose=1
;;
--skip-installed) # HELPOPT: skip already install during install
skip_installed=1
;;
--quiet) # HELPOPT: quiet mode (do not print commands before exec)
quiet=1
;;
--nodeps) # HELPOPT: skip dependency check (during install/simulate and so on)
fatal "--nodeps not realized yet"
nodeps="--nodeps"
;;
--auto) # HELPOPT: non interactive mode
non_interactive=1
;;
*)
if [ -f "$opt" ] ; then
pkg_files="$pkgfiles $opt"
pkg_files="$pkg_files $opt"
else
pkg_names="$pkgnames $opt"
pkg_names="$pkg_names $opt"
fi
;;
esac
......@@ -157,13 +200,6 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
echover "pkg_files=$pkg_files"
echover "pkg_names=$pkg_names"
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
DISTRVENDOR=$PROGDIR/distr_info
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d)
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env
set_pm_type
# Run helper for command
if [ -z "$epm_cmd" ] ; then
print_version
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
epm_addrepo()
{
case $PMTYPE in
#apt-rpm|apt-dpkg)
# docmd $SUDO apt-get check || exit
# ;;
#yum-rpm)
# docmd $SUDO yum repolist || exit
# ;;
urpm-rpm)
docmd $SUDO urpmi.addmedia --distrib $pkg_filenames
;;
zypper-rpm)
docmd $SUDO zypper ar $pkg_filenames || exit
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
......@@ -24,13 +24,25 @@ epm_check()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get check || exit
#docmd $SUDO apt-get check || exit
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
;;
apt-dpkg)
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
docmd $SUDO apt-get autoremove
;;
yum-rpm)
docmd package-cleanup --leaves
package-cleanup --leaves | xargs yum remove
;;
urpm-rpm)
docmd $SUDO urpme --auto-orphans
;;
zypper-rpm)
docmd $SUDO zypper verify || exit
;;
*)
fatal "Do not known command for $PMTYPE"
;;
......
......@@ -81,6 +81,8 @@ check_pkg_integrity()
epm_checkpkg()
{
[ -n "$pkg_files" ] || fatal "Run without names"
for i in $pkg_files ; do
check_pkg_integrity $i || fatal "Broken package $i"
done
......
......@@ -20,18 +20,18 @@
epm_clean()
{
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get clean
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
yum-rpm)
docmd $SUDO yum clean all
docmd $SUDO yum makecache
;;
"Mandriva")
urpm-rpm)
docmd $SUDO urpmi --clean
;;
"SUSE")
zypper-rpm)
docmd $SUDO zypper clean
;;
*)
......
......@@ -24,22 +24,25 @@ epm_filelist()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
case $DISTRNAME in
"ALTLinux"|"PCLinux")
case $PMTYPE in
apt-rpm)
CMD="rpm -ql"
;;
"Ubuntu"|"Debian")
apt-dpkg)
CMD="dpkg -L"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
yum-rpm)
CMD="rpm -ql"
;;
"Mandriva")
urpm-rpm)
CMD="rpm -ql"
;;
"SUSE")
zypper-rpm)
CMD="rpm -ql"
;;
pacman)
CMD="pacman -Ql"
;;
*)
fatal "Do not known query command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
epm_info()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd apt-cache show $pkg_names
;;
yum-rpm)
docmd yum info $pkg_names
;;
zypper-rpm)
docmd zypper info $pkg_names
;;
pacman)
docmd pacman -Si $pkg_names
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
......@@ -18,25 +18,63 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# TODO: use when run install with epm --skip-installed install
filter_out_installed_packages()
{
[ -z "$skip_installed" ] && cat && return
# TODO: use this more effectively way
#for i in $(cat) ; do
# rpm -q $i >/dev/null && continue
# echo $i
#done |
case $PKGFORMAT in
"rpm")
LANG=C LC_ALL=C xargs -n1 rpm -q 2>&1 | grep 'is not installed' |
sed -e 's|^.*package \(.*\) is not installed.*|\1|g'
;;
"deb")
LANG=C LC_ALL=C xargs -n1 dpkg -L 2>&1 | grep 'is not installed.' |
sed -e 's|^Package .\(.*\). is not installed.*|\1|g'
;;
*)
cat
;;
esac | sed -e "s|rpm-build-altlinux-compat||g" | filter_strip_spaces
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names()
{
[ -n "$1" ] || return
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get install $@
return ;;
yum-rpm)
docmd $SUDO yum install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
return ;;
emerge)
docmd $SUDO emerge -uD $@
return ;;
pacman)
docmd $SUDO pacman -S $@
return ;;
yum-rpm)
docmd $SUDO yum install $@
return ;;
zypper-rpm)
docmd $SUDO zypper install $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
mpkg)
docmd $SUDO mpkg install $@
return ;;
pkgtool)
docmd $SUDO installpkg $@
return ;;
*)
fatal "Do not known install command for $PMTYPE"
......@@ -63,31 +101,47 @@ epm_ni_install_names()
pkg_add)
docmd $SUDO pkg_add -r $@
return ;;
pacman)
docmd $SUDO pacman -S --noconfirm $@
return ;;
pkgtool)
docmd $SUDO installpkg $@
return ;;
*)
fatal "Do not known appropriate install command for $PMTYPE"
;;
esac
}
# for low level install
#is_alt && FANCYPERCENT=--fancypercent
#docmd $SUDO rpm -Uvh $FANCYPERCENT "$@"
epm_install_files()
{
[ -z "$1" ] && return
case $DISTRNAME in
ALTLinux|PCLinux)
ALTLinux)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO apt-get install $@
return ;;
PCLinux)
docmd $SUDO rpm -Uvh --force $@
return ;;
FreeBSD)
docmd $SUDO pkg_add $@
return ;;
Ubuntu|Debian|Mint)
esac
case $PMTYPE in
apt-dpkg)
docmd $SUDO dpkg -i $@
docmd $SUDO apt-get -f install
return ;;
yum-rpm)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO yum --nogpgcheck local install $@
return ;;
pacman)
docmd $SUDO pacman -U $@
return ;;
esac
# other systems can install file package via ordinary command
......@@ -99,13 +153,16 @@ epm_install()
{
[ -n "$pkg_files$pkg_names" ] || fatal "Run install without packages"
local names=$(echo $pkg_names | filter_out_installed_packages)
local files=$(echo $pkg_files | filter_out_installed_packages)
[ -z "$files$names" ] && echo "Skip empty install list" && return 2
if [ -n "$non_interactive" ] ; then
epm_ni_install_names $pkg_names
epm_ni_install_names $names || return
else
epm_install_names $pkg_names
epm_install_names $names || return
fi
epm_install_files $pkg_files
epm_install_files $files
}
......@@ -23,25 +23,27 @@
epm_packages()
{
case $DISTRNAME in
"ALTLinux"|"PCLinux")
case $PMTYPE in
apt-rpm)
CMD="rpm -qa"
;;
"Ubuntu"|"Debian")
apt-dpkg)
CMD="dpkg -l"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
yum-rpm)
CMD="rpm -qa"
;;
"Mandriva")
urpm-rpm)
CMD="rpm -qa"
;;
"SUSE")
zypper-rpm)
CMD="rpm -qa"
;;
pacman)
CMD="pacman -Qs"
;;
*)
RET=1
CMD="echo \"Do not known query command for DISTRNAME $DISTRNAME\""
fatal "Do not known query command for $PMTYPE"
;;
esac
......
......@@ -24,22 +24,13 @@ epm_query()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
case $DISTRNAME in
"ALTLinux"|"PCLinux")
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
CMD="rpm -q"
;;
"Ubuntu"|"Debian")
apt-dpkg)
CMD="dpkg -l"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="rpm -q"
;;
"Mandriva")
CMD="rpm -q"
;;
"SUSE")
CMD="rpm -q"
;;
*)
fatal "Do not known command for $PMTYPE"
;;
......
......@@ -61,6 +61,9 @@ __do_query()
zypper-rpm)
CMD="rpm -qf"
;;
pacman)
CMD="pacman -Qo"
;;
*)
fatal "Do not known query command for $PMTYPE"
;;
......
......@@ -38,6 +38,9 @@ epm_reinstall_names()
pkg_add)
docmd $SUDO pkg_add -r $@
return ;;
pacman)
docmd $SUDO pacman -U $@
return ;;
*)
fatal "Do not known install command for $PMTYPE"
;;
......@@ -54,7 +57,8 @@ epm_reinstall_files()
case $DISTRNAME in
ALTLinux|PCLinux)
docmd $SUDO rpm -Uvh --force $@
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO apt-get --reinstall install $@
return ;;
Ubuntu|Debian|Mint)
docmd $SUDO dpkg -i $@
......
......@@ -23,30 +23,84 @@
# TODO
epm_remove_low()
{
case $DISTRNAME in
"Ubuntu"|"Debian")
CMD="dpkg -P"
;;
"ALTLinux"|"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific"|"PCLinux"|"Mandriva"|"SUSE")
CMD="rpm -e"
;;
"ArchLinux")
CMD="pacman -R"
;;
"MOPSLinux")
CMD="mpkg remove"
;;
"Gentoo")
CMD="emerge --unmerge"
;;
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
docmd $SUDO rpm -e $@
return ;;
apt-dpkg)
docmd $SUDO dpkg -P $@
return ;;
pkg_add)
docmd $SUDO pkg_delete -r $@
return ;;
emerge)
docmd $SUDO emerge -unmerge $@
return ;;
pacman)
docmd $SUDO pacman -R $@
return ;;
mpkg)
docmd $SUDO mpkg remove $@
return ;;
pkgtool)
docmd $SUDO removepkg $@
return ;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
fatal "Do not known command for $PMTYPE"
;;
esac
}
epm_remove()
{
[ -n "$pkg_file$pkg_names" ] || fatal "Run remove without names"
epm_remove_names $pkg_names || return
}
epm_remove_names()
{
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get remove --purge $@
return ;;
urpm-rpm)
docmd $SUDO urpme $@
return ;;
pkg_add) # without dependencies
docmd $SUDO pkg_delete $@
return ;;
emerge)
docmd $SUDO emerge --unmerge $@
return ;;
pacman)
docmd $SUDO pacman -R --noconfirm $@
return ;;
yum-rpm)
docmd $SUDO yum remove $@
return ;;
zypper-rpm)
docmd $SUDO zypper remove $@
return ;;
mpkg)
docmd $SUDO mpkg remove $@
return ;;
pkgtool)
docmd $SUDO removepkg $@
return ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
#docmd $SUDO $CMD $pkg_names $pkg_files
}
# TODO
epm_remove_nonint()
{
......@@ -71,28 +125,3 @@ esac
}
epm_remove()
{
[ -n "$pkg_filenames" ] || fatal "Run remove without names"
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-get remove --purge"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum remove"
;;
"Mandriva")
CMD="urpme"
;;
"SUSE")
CMD="zypper remove"
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
docmd $CMD $pkg_names $pkg_files
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
epm_removerepo()
{
case $PMTYPE in
#apt-rpm|apt-dpkg)
# docmd $SUDO apt-get check || exit
# ;;
#yum-rpm)
# docmd $SUDO yum repolist || exit
# ;;
zypper-rpm)
docmd $SUDO zypper removerepo $pkg_names || exit
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
......@@ -25,7 +25,10 @@ case $PMTYPE in
# docmd $SUDO apt-get check || exit
# ;;
yum-rpm)
docmd $SUDO yum repolist || exit
docmd $SUDO yum repolist
;;
zypper-rpm)
docmd $USDO zypper sl -d
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -24,23 +24,24 @@ epm_search()
{
[ -n "$pkg_filenames" ] || fatal "Run search without names"
#CMD=$(get_install_package_command $DISTRNAME interactive)
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-cache search"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
yum-rpm)
CMD="yum search"
;;
"Mandriva")
CMD="urpmf"
urpm-rpm)
CMD="urpmq -y"
;;
"SUSE")
zypper-rpm)
CMD="zypper search"
;;
pacman)
CMD="pacman -Ss"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
fatal "Do not known search command for $PMTYPE"
;;
esac
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
epm_search_file()
{
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-file update
docmd apt-file search $pkg_filenames
return ;;
yum-rpm)
fatal "TODO"
CMD="yum search"
;;
urpm-rpm)
CMD="urpmf"
;;
zupper-rpm)
CMD="zypper wp vi"
;;
*)
fatal "Do not known search file command for $PMTYPE"
;;
esac
docmd $CMD $pkg_filenames
}
......@@ -69,7 +69,7 @@ realpath()
}
# Print command line and run command line
docmd()
showcmd()
{
if [ -z "$quiet" ] ; then
set_boldcolor $GREEN
......@@ -78,9 +78,22 @@ docmd()
echo " $PROMTSIG $@"
restore_color
fi
}
# Print command line and run command line
docmd()
{
showcmd "$@"
"$@"
}
# Print command line and run command line with SUDO
docmds()
{
showcmd "$@"
"$SUDO $@"
}
filter_strip_spaces()
{
# possible use just
......@@ -131,23 +144,39 @@ get_help()
set_pm_type()
{
local CMD
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
DISTRVENDOR=$PROGDIR/distr_info
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d)
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env
case $DISTRNAME in
ALTLinux|PCLinux)
CMD="apt-rpm"
;;
Ubuntu|Debian|Mint)
CMD="apt-dpkg"
;;
Mandriva|ROSA)
CMD="urpm-rpm"
;;
FreeBSD)
CMD="pkg_add"
;;
Ubuntu|Debian)
CMD="apt-dpkg"
Gentoo)
CMD="emerge"
;;
ArchLinux)
CMD="pacman"
;;
LinuxXP|Fedora|ASPLinux|CentOS|RHEL|Scientific)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm"
;;
Mandriva|ROSA)
CMD="urpm-rpm"
Slackware)
CMD="pkgtool"
;;
SUSE)
SUSE|SLED|SLES)
CMD="zypper-rpm"
;;
*)
......
......@@ -18,38 +18,44 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# TODO
epm_install_sim()
{
case $DISTRNAME in
"ALTLinux"|"PCLinux")
CMD="apt-get --simulate install"
;;
"Ubuntu"|"Debian")
CMD="apt-get --simulate install"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum provides"
;;
"Mandriva")
CMD="urpmi --test --auto"
;;
"SUSE")
CMD="zypper --non-interactive install --dry-run"
;;
*)
fatal "Do not known install command for DISTRNAME $DISTRNAME"
;;
esac
echo $CMD
}
load_helper epm-install
epm_simulate()
{
[ -n "$pkg_names" ] || fatal "Run $epm_cmd without packages"
local CMD
[ -n "$pkg_filenames" ] || fatal "Run $epm_cmd without packages"
local filenames=$(echo $pkg_filenames | filter_out_installed_packages)
# FIXME: can't correct receive status 2 in mandriva?
[ -z "$filenames" ] && echo "Skip empty simulate list" && return 0 #&& return 2
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-get --simulate install"
;;
yum-rpm)
CMD="yum provides"
;;
urpm-rpm)
CMD="urpmi --test --auto"
;;
zypper-rpm)
CMD="zypper --non-interactive install --dry-run"
;;
emerge)
echo "FIXME: Skip with emerge"
return ;;
pacman)
showcmd $SUDO pacman -v -S $filenames
echo no | $SUDO pacman -v -S $filenames
return ;;
pkgtool)
return 0 ;;
*)
fatal "Do not known simulate command for $PMTYPE"
;;
esac
CMD=$(epm_install_sim $DISTRNAME)
docmd $SUDO $CMD $pkg_names
docmd $SUDO $CMD $filenames
}
......@@ -25,28 +25,22 @@ epm_update()
case $PMTYPE in
"apt-rpm")
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
#docmd $SUDO apt-get -f install || exit
;;
"apt-dpkg")
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
#docmd $SUDO apt-get -f install || exit
#docmd $SUDO apt-get autoremove
;;
urpm-rpm)
docmd $SUDO urpmi.update -a
;;
# skip, will do it automagically
# "LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
# CMD="yum update"
# ;;
# "Mandriva")
# CMD="urpmf"
# ;;
# skip, will do it automagically
# "SUSE")
# CMD="zypper update"
# ;;
pacman)
docmd $SUDO pacman -S -y
;;
zypper-rpm)
docmd $SUDO zypper refresh
;;
*)
RET=1
echo \"Do not known install command for DISTRNAME $DISTRNAME\"
......
......@@ -32,16 +32,19 @@ epm_upgrade()
CMD="yum update"
;;
urpm-rpm)
# or --auto-update
CMD="urpmi --auto-select"
# or --auto-select
CMD="urpmi --auto-update --replace-files"
;;
zypper-rpm)
CMD="zypper update"
CMD="zypper dist-upgrade"
;;
pacman)
CMD="zypper -S -u"
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
docmd $CMD
docmd $SUDO $CMD
}
epm
\ No newline at end of file
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
#
Name: epm
Version: 0.5
Name: eepm
Version: 0.9.1
Release: alt0.M60P.1
Summary: EPM package manager
Summary: Etersoft EPM package manager
License: GPLv2
Group: System/Configuration/Packaging
......@@ -18,7 +18,7 @@ Source: ftp://updates.etersoft.ru/pub/Etersoft/Sisyphus/sources/tarball/%name-%v
BuildArchitectures: noarch
%description
EPM is the package manager for any platform
Etersoft EPM is the package manager for any platform
and any platform version. It provides
universal interface to any package manager.
Can be useful for system administrators working
......@@ -37,12 +37,44 @@ with various distros.
%files
%doc README TODO
%_bindir/epm*
%_bindir/upm
%_bindir/distr_info
%changelog
* Sat Jul 21 2012 Vitaly Lipatov <lav@altlinux.ru> 0.5-alt0.M60P.1
* Tue Jul 31 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.1-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Sat Jul 28 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.1-alt1
- epm-simulate: add support for --skip-installed
- add more distr in epm -i, epm -e and add some bugs in epm -e
- add initial Slackware support (pkgtool)
* Fri Jul 27 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9-alt1
- epm: add --nodeps options recognize
- add showcmd in addition to docmd
- add ArchLinux support (pacman) to all commands
* Fri Jul 27 2012 Vitaly Lipatov <lav@altlinux.ru> 0.8-alt1
- rename package to eepm
- add upm alias
- epm info fix: on apt, add: on yum
- add some Gentoo support, add some commands
* Thu Jul 26 2012 Vitaly Lipatov <lav@altlinux.ru> 0.7-alt1
- add commands: addrepo, removerepo, search_file, info, update some other
- epm: fill epm_cmd only one time
- epm: fix pkg_files, pkg_names fills
- epm-search: fix search on Mandriva
- search: rewrite with PMTYPE using
- add fix behaviour to check command
* Sun Jul 22 2012 Vitaly Lipatov <lav@altlinux.ru> 0.6-alt1
- add --skip-installed for skip aready installed packages
- epm-install: fix return status
- epm: fix commands, add missed checkpkg
- install/reinstall: try use rpm for files
- use PMTYPE and SUDO
* Sat Jul 21 2012 Vitaly Lipatov <lav@altlinux.ru> 0.5-alt1
- add quiet mode (no print commands before run)
- add color support for output
......
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