Commit aae3cde9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

use PMTYPE and SUDO

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