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. Разобраться с поиском по локальным пакетам 1. Разобраться с поиском по локальным пакетам
2. Дописать таблицу на вики и по ней справку 2. Дописать таблицу на вики и по ней справку
3. Переделать по возможности все команды на PMTYPE
4. Проверить, что в общем всё работает 4. Проверить, что в общем всё работает
5. Там, где нужно, добавить $SUDO 6. rpmqf, если не найдёт в локальной базе, могла бы искать в глобальной (search_file)
6. rpmqf, если не найдёт в локальной базе, могла бы искать в глобальной
7. Дописать начатый reinstall (повторную установку), с --force при установке пакета 7. Дописать начатый reinstall (повторную установку), с --force при установке пакета
Отказаться от distr_vendor в rpm-build-altlinux-compat и использовать distr_info отсюда. Отказаться от distr_vendor в rpm-build-altlinux-compat и использовать distr_info отсюда.
Replace rpmU with epmi Replace rpmU with epmi
Возможность вывода/возврата команды, планируемой к выполнению
(префикс $OUTPUT перед всеми командами?)
test requies делать перед сборкой! :)
...@@ -48,16 +48,21 @@ $(get_help HELPOPT) ...@@ -48,16 +48,21 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version @VERSION@" echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012" 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]..." Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager" Descr="epm - EPM package manager"
set_pm_type
verbose= verbose=
quiet= quiet=
nodeps=
non_interactive= non_interactive=
skip_installed=
epm_cmd= epm_cmd=
pkg_files= pkg_files=
pkg_names= pkg_names=
...@@ -76,30 +81,19 @@ case $progname in ...@@ -76,30 +81,19 @@ case $progname in
epmqf) epmqf)
epm_cmd=query_file epm_cmd=query_file
;; ;;
epm) epm|upm)
;; ;;
*) *)
fatal "Unknown command: $progname" fatal "Unknown command: $progname"
;; ;;
esac esac
for opt in "$@" ; do check_command()
case $opt in {
-h|--help|help) # HELPOPT: this help # do not override command
phelp; exit 0 [ -z "$epm_cmd" ] || return
;;
-v|--version) # HELPOPT: print version case $1 in
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
;;
-i|install|add) # HELPCMD: install package(s) from remote repositories or from local file -i|install|add) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install epm_cmd=install
;; ;;
...@@ -133,17 +127,66 @@ for opt in "$@" ; do ...@@ -133,17 +127,66 @@ for opt in "$@" ; do
-qf|which) # HELPCMD: query package(s) owning file -qf|which) # HELPCMD: query package(s) owning file
epm_cmd=query_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 -ql|filelist) # HELPCMD: print package file list
epm_cmd=filelist epm_cmd=filelist
;; ;;
check|simulate) # HELPCMD: simulate install (check requires) check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=$opt 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 if [ -f "$opt" ] ; then
pkg_files="$pkgfiles $opt" pkg_files="$pkg_files $opt"
else else
pkg_names="$pkgnames $opt" pkg_names="$pkg_names $opt"
fi fi
;; ;;
esac esac
...@@ -157,13 +200,6 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") ...@@ -157,13 +200,6 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
echover "pkg_files=$pkg_files" echover "pkg_files=$pkg_files"
echover "pkg_names=$pkg_names" 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 # Run helper for command
if [ -z "$epm_cmd" ] ; then if [ -z "$epm_cmd" ] ; then
print_version 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() ...@@ -24,13 +24,25 @@ epm_check()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) 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) apt-dpkg)
docmd $SUDO apt-get update || exit 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 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" fatal "Do not known command for $PMTYPE"
;; ;;
......
...@@ -81,6 +81,8 @@ check_pkg_integrity() ...@@ -81,6 +81,8 @@ check_pkg_integrity()
epm_checkpkg() epm_checkpkg()
{ {
[ -n "$pkg_files" ] || fatal "Run without names"
for i in $pkg_files ; do for i in $pkg_files ; do
check_pkg_integrity $i || fatal "Broken package $i" check_pkg_integrity $i || fatal "Broken package $i"
done done
......
...@@ -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,22 +24,25 @@ epm_filelist() ...@@ -24,22 +24,25 @@ 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"
;; ;;
pacman)
CMD="pacman -Ql"
;;
*) *)
fatal "Do not known query command for $PMTYPE" 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 @@ ...@@ -18,25 +18,63 @@
# 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: 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 # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
[ -n "$1" ] || return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get install $@ docmd $SUDO apt-get install $@
return ;; return ;;
yum-rpm)
docmd $SUDO yum install $@
return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi $@ docmd $SUDO urpmi $@
return ;; 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) zypper-rpm)
docmd $SUDO zypper install $@ docmd $SUDO zypper install $@
return ;; return ;;
pkg_add) mpkg)
docmd $SUDO pkg_add -r $@ docmd $SUDO mpkg install $@
return ;;
pkgtool)
docmd $SUDO installpkg $@
return ;; return ;;
*) *)
fatal "Do not known install command for $PMTYPE" fatal "Do not known install command for $PMTYPE"
...@@ -63,31 +101,47 @@ epm_ni_install_names() ...@@ -63,31 +101,47 @@ epm_ni_install_names()
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ docmd $SUDO pkg_add -r $@
return ;; return ;;
pacman)
docmd $SUDO pacman -S --noconfirm $@
return ;;
pkgtool)
docmd $SUDO installpkg $@
return ;;
*) *)
fatal "Do not known appropriate install command for $PMTYPE" fatal "Do not known appropriate install command for $PMTYPE"
;; ;;
esac esac
} }
# for low level install
#is_alt && FANCYPERCENT=--fancypercent
#docmd $SUDO rpm -Uvh $FANCYPERCENT "$@"
epm_install_files() epm_install_files()
{ {
[ -z "$1" ] && return [ -z "$1" ] && return
case $DISTRNAME in case $DISTRNAME in
ALTLinux|PCLinux) ALTLinux)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO apt-get install $@ docmd $SUDO apt-get install $@
return ;; return ;;
PCLinux)
docmd $SUDO rpm -Uvh --force $@
return ;;
FreeBSD) FreeBSD)
docmd $SUDO pkg_add $@ docmd $SUDO pkg_add $@
return ;; return ;;
Ubuntu|Debian|Mint) esac
case $PMTYPE in
apt-dpkg)
docmd $SUDO dpkg -i $@ docmd $SUDO dpkg -i $@
docmd $SUDO apt-get -f install docmd $SUDO apt-get -f install
return ;; return ;;
yum-rpm)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO yum --nogpgcheck local install $@
return ;;
pacman)
docmd $SUDO pacman -U $@
return ;;
esac esac
# other systems can install file package via ordinary command # other systems can install file package via ordinary command
...@@ -99,13 +153,16 @@ epm_install() ...@@ -99,13 +153,16 @@ epm_install()
{ {
[ -n "$pkg_files$pkg_names" ] || fatal "Run install without packages" [ -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 if [ -n "$non_interactive" ] ; then
epm_ni_install_names $pkg_names epm_ni_install_names $names || return
else else
epm_install_names $pkg_names epm_install_names $names || return
fi fi
epm_install_files $pkg_files epm_install_files $files
} }
...@@ -23,25 +23,27 @@ ...@@ -23,25 +23,27 @@
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"
;; ;;
pacman)
CMD="pacman -Qs"
;;
*) *)
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"
;; ;;
......
...@@ -61,6 +61,9 @@ __do_query() ...@@ -61,6 +61,9 @@ __do_query()
zypper-rpm) zypper-rpm)
CMD="rpm -qf" CMD="rpm -qf"
;; ;;
pacman)
CMD="pacman -Qo"
;;
*) *)
fatal "Do not known query command for $PMTYPE" fatal "Do not known query command for $PMTYPE"
;; ;;
......
...@@ -38,6 +38,9 @@ epm_reinstall_names() ...@@ -38,6 +38,9 @@ epm_reinstall_names()
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ docmd $SUDO pkg_add -r $@
return ;; return ;;
pacman)
docmd $SUDO pacman -U $@
return ;;
*) *)
fatal "Do not known install command for $PMTYPE" fatal "Do not known install command for $PMTYPE"
;; ;;
...@@ -54,7 +57,8 @@ epm_reinstall_files() ...@@ -54,7 +57,8 @@ epm_reinstall_files()
case $DISTRNAME in case $DISTRNAME in
ALTLinux|PCLinux) ALTLinux|PCLinux)
docmd $SUDO rpm -Uvh --force $@ docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO apt-get --reinstall install $@
return ;; return ;;
Ubuntu|Debian|Mint) Ubuntu|Debian|Mint)
docmd $SUDO dpkg -i $@ docmd $SUDO dpkg -i $@
......
...@@ -23,30 +23,84 @@ ...@@ -23,30 +23,84 @@
# TODO # TODO
epm_remove_low() epm_remove_low()
{ {
case $DISTRNAME in [ -z "$1" ] && return
"Ubuntu"|"Debian") case $PMTYPE in
CMD="dpkg -P" apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
;; docmd $SUDO rpm -e $@
"ALTLinux"|"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific"|"PCLinux"|"Mandriva"|"SUSE") return ;;
CMD="rpm -e" apt-dpkg)
;; docmd $SUDO dpkg -P $@
"ArchLinux") return ;;
CMD="pacman -R" pkg_add)
;; docmd $SUDO pkg_delete -r $@
"MOPSLinux") return ;;
CMD="mpkg remove" emerge)
;; docmd $SUDO emerge -unmerge $@
"Gentoo") return ;;
CMD="emerge --unmerge" pacman)
;; docmd $SUDO pacman -R $@
return ;;
mpkg)
docmd $SUDO mpkg remove $@
return ;;
pkgtool)
docmd $SUDO removepkg $@
return ;;
*) *)
RET=1 RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\"" fatal "Do not known command for $PMTYPE"
;; ;;
esac 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 # TODO
epm_remove_nonint() epm_remove_nonint()
{ {
...@@ -71,28 +125,3 @@ esac ...@@ -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 ...@@ -25,7 +25,10 @@ case $PMTYPE in
# docmd $SUDO apt-get check || exit # docmd $SUDO apt-get check || exit
# ;; # ;;
yum-rpm) 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" fatal "Do not known command for $PMTYPE"
......
...@@ -24,23 +24,24 @@ epm_search() ...@@ -24,23 +24,24 @@ epm_search()
{ {
[ -n "$pkg_filenames" ] || fatal "Run search without names" [ -n "$pkg_filenames" ] || fatal "Run search without names"
#CMD=$(get_install_package_command $DISTRNAME interactive) case $PMTYPE in
case $DISTRNAME in apt-rpm|apt-dpkg)
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-cache search" CMD="apt-cache search"
;; ;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific") yum-rpm)
CMD="yum search" CMD="yum search"
;; ;;
"Mandriva") urpm-rpm)
CMD="urpmf" CMD="urpmq -y"
;; ;;
"SUSE") zypper-rpm)
CMD="zypper search" CMD="zypper search"
;; ;;
pacman)
CMD="pacman -Ss"
;;
*) *)
RET=1 fatal "Do not known search command for $PMTYPE"
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;; ;;
esac 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() ...@@ -69,7 +69,7 @@ realpath()
} }
# Print command line and run command line # Print command line and run command line
docmd() showcmd()
{ {
if [ -z "$quiet" ] ; then if [ -z "$quiet" ] ; then
set_boldcolor $GREEN set_boldcolor $GREEN
...@@ -78,9 +78,22 @@ docmd() ...@@ -78,9 +78,22 @@ docmd()
echo " $PROMTSIG $@" echo " $PROMTSIG $@"
restore_color restore_color
fi 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() filter_strip_spaces()
{ {
# possible use just # possible use just
...@@ -131,23 +144,39 @@ get_help() ...@@ -131,23 +144,39 @@ get_help()
set_pm_type() set_pm_type()
{ {
local CMD 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 case $DISTRNAME in
ALTLinux|PCLinux) ALTLinux|PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
;; ;;
Ubuntu|Debian|Mint)
CMD="apt-dpkg"
;;
Mandriva|ROSA)
CMD="urpm-rpm"
;;
FreeBSD) FreeBSD)
CMD="pkg_add" CMD="pkg_add"
;; ;;
Ubuntu|Debian) Gentoo)
CMD="apt-dpkg" CMD="emerge"
;;
ArchLinux)
CMD="pacman"
;; ;;
LinuxXP|Fedora|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm" CMD="yum-rpm"
;; ;;
Mandriva|ROSA) Slackware)
CMD="urpm-rpm" CMD="pkgtool"
;; ;;
SUSE) SUSE|SLED|SLES)
CMD="zypper-rpm" CMD="zypper-rpm"
;; ;;
*) *)
......
...@@ -18,38 +18,44 @@ ...@@ -18,38 +18,44 @@
# 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 load_helper epm-install
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
}
epm_simulate() 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 $filenames
docmd $SUDO $CMD $pkg_names
} }
...@@ -25,28 +25,22 @@ epm_update() ...@@ -25,28 +25,22 @@ epm_update()
case $PMTYPE in case $PMTYPE in
"apt-rpm") "apt-rpm")
docmd $SUDO apt-get update || exit docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit #docmd $SUDO apt-get -f install || exit
;; ;;
"apt-dpkg") "apt-dpkg")
docmd $SUDO apt-get update || exit 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 #docmd $SUDO apt-get autoremove
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.update -a docmd $SUDO urpmi.update -a
;; ;;
# skip, will do it automagically pacman)
# "LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific") docmd $SUDO pacman -S -y
# CMD="yum update" ;;
# ;; zypper-rpm)
# "Mandriva") docmd $SUDO zypper refresh
# CMD="urpmf" ;;
# ;;
# skip, will do it automagically
# "SUSE")
# CMD="zypper update"
# ;;
*) *)
RET=1 RET=1
echo \"Do not known install command for DISTRNAME $DISTRNAME\" echo \"Do not known install command for DISTRNAME $DISTRNAME\"
......
...@@ -32,16 +32,19 @@ epm_upgrade() ...@@ -32,16 +32,19 @@ epm_upgrade()
CMD="yum update" CMD="yum update"
;; ;;
urpm-rpm) urpm-rpm)
# or --auto-update # or --auto-select
CMD="urpmi --auto-select" CMD="urpmi --auto-update --replace-files"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper update" CMD="zypper dist-upgrade"
;;
pacman)
CMD="zypper -S -u"
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
;; ;;
esac 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. # This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
# #
Name: epm Name: eepm
Version: 0.5 Version: 0.9.1
Release: alt0.M60P.1 Release: alt0.M60P.1
Summary: EPM package manager Summary: Etersoft EPM package manager
License: GPLv2 License: GPLv2
Group: System/Configuration/Packaging Group: System/Configuration/Packaging
...@@ -18,7 +18,7 @@ Source: ftp://updates.etersoft.ru/pub/Etersoft/Sisyphus/sources/tarball/%name-%v ...@@ -18,7 +18,7 @@ Source: ftp://updates.etersoft.ru/pub/Etersoft/Sisyphus/sources/tarball/%name-%v
BuildArchitectures: noarch BuildArchitectures: noarch
%description %description
EPM is the package manager for any platform Etersoft EPM is the package manager for any platform
and any platform version. It provides and any platform version. It provides
universal interface to any package manager. universal interface to any package manager.
Can be useful for system administrators working Can be useful for system administrators working
...@@ -37,12 +37,44 @@ with various distros. ...@@ -37,12 +37,44 @@ with various distros.
%files %files
%doc README TODO %doc README TODO
%_bindir/epm* %_bindir/epm*
%_bindir/upm
%_bindir/distr_info %_bindir/distr_info
%changelog %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) - 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 * Sat Jul 21 2012 Vitaly Lipatov <lav@altlinux.ru> 0.5-alt1
- add quiet mode (no print commands before run) - add quiet mode (no print commands before run)
- add color support for output - 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