Commit aae3cde9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

use PMTYPE and SUDO

parent 49a21e78
1. Разобраться с поиском по локальным пакетам
2. Дописать таблицу на вики и по ней справку
3. Переделать по возможности все команды на PMTYPE
4. Проверить, что в общем всё работает
5. Там, где нужно, добавить $SUDO
6. rpmqf, если не найдёт в локальной базе, могла бы искать в глобальной
7. Дописать начатый reinstall (повторную установку), с --force при установке пакета
......
......@@ -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,20 +24,20 @@ 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"
;;
*)
......
......@@ -23,25 +23,24 @@
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"
;;
*)
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"
;;
......
......@@ -75,17 +75,17 @@ epm_remove()
{
[ -n "$pkg_filenames" ] || fatal "Run remove without names"
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-get remove --purge"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
yum-rpm)
CMD="yum remove"
;;
"Mandriva")
urpm-rpm)
CMD="urpme"
;;
"SUSE")
zypper-rpm)
CMD="zypper remove"
;;
*)
......@@ -93,6 +93,6 @@ case $DISTRNAME in
;;
esac
docmd $CMD $pkg_names $pkg_files
docmd $SUDO $CMD $pkg_names $pkg_files
}
......@@ -18,38 +18,30 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# TODO
epm_install_sim()
epm_simulate()
{
case $DISTRNAME in
"ALTLinux"|"PCLinux")
CMD="apt-get --simulate install"
;;
"Ubuntu"|"Debian")
local CMD
[ -n "$pkg_names" ] || fatal "Run $epm_cmd without packages"
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-get --simulate install"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
yum-rpm)
CMD="yum provides"
;;
"Mandriva")
urpm-rpm)
CMD="urpmi --test --auto"
;;
"SUSE")
zypper-rpm)
CMD="zypper --non-interactive install --dry-run"
;;
*)
fatal "Do not known install command for DISTRNAME $DISTRNAME"
fatal "Do not known install command for $PMTYPE"
;;
esac
echo $CMD
}
epm_simulate()
{
[ -n "$pkg_names" ] || fatal "Run $epm_cmd without packages"
esac
CMD=$(epm_install_sim $DISTRNAME)
docmd $SUDO $CMD $pkg_names
}
......@@ -43,5 +43,5 @@ epm_upgrade()
;;
esac
docmd $CMD
docmd $SUDO $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