Commit 91c15cc5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M50P as 1.1.4-alt0.M50P.1 (with rpmbph script)

parents b2109790 db0f10bf
This diff is collapsed. Click to expand it.
pkgdatadir=$(datadir)/eterbuild pkgdatadir=$(datadir)/eepm
# due using %makeinstallstd in spec
instpkgdatadir=/usr/share/eepm
install: install:
mkdir -p $(DESTDIR)$(bindir) mkdir -p $(DESTDIR)$(bindir)/
install -m 755 bin/* $(DESTDIR)$(bindir) # breaks link
#install -m 755 `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
chmod 0755 $(DESTDIR)$(bindir)/*
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" <bin/epm >$(DESTDIR)$(bindir)/epm
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" <bin/serv >$(DESTDIR)$(bindir)/serv
mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "-"` $(DESTDIR)$(pkgdatadir)/
Etersoft EPM package manager README
Really, EPM is a wrapper for any package manager used in your operating system.
Run $ epm --help for check all support commands.
The main goal of the project — provide the same package management interface
on any platform.
You can use
# epmi NAME
or
# epm -i NAME
or
# epm install NAME
for install package. It is just aliases for one command: install of the package.
EEPM will run urpmi on Mandriva, apt-get install on Ubuntu, yum install on Fedora.
And it have a little intelligence, so EEPM will try install file with package via
low level commands (rpm or dpkg) before use hi level commands (yum, apt).
Just try your comfort style for package management and save your experience the same
on any platform. EEPM will print out any real command it uses so you can learn from it.
Also EEPM has initial support for control repositories: list, add, remove, update
Pay attention to follow useful commands:
epmqf - query package(s) owning file
epmqp - search in the list of installed packages
epmqf helps get package name for any file or command in the system:
$ epmqf epmqf
Note: epmqf is placed as /usr/bin/epmqf
$ rpm -qf /usr/bin/epmqf
eepm-1.1.0-alt2
Note: /usr/bin/epmqf is link to epm
Note: epm is placed as /usr/bin/epm
$ rpm -qf /usr/bin/epm
eepm-1.1.0-alt2
See detailed description in russian at See detailed description in russian at
http://wiki.etersoft.ru/Epm http://wiki.etersoft.ru/Epm
Please e-mail me:
lav@etersoft.ru
# serv(8) completion
# This completes on a list of all available services for the
# 'serv' command, followed by that script's available commands
#
_service_list()
{
COMPREPLY=( $( serv list-all 2>/dev/null ; echo "list list-all list-startup" ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
_service_usage_list()
{
local USLIST=$(serv ${prev##*/} usage 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(u\|U\|msg_u\)sage.*{\(.*\)}.*$/\2/p")
COMPREPLY=( $( compgen -W '$USLIST' -- "$cur" ) )
}
_serv()
{
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
# don't complete for things like killall, ssh and mysql if it's
# the standalone command, rather than the init script
[[ ${COMP_WORDS[0]} != "serv" ]] && return 0
# don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0
if [[ $COMP_CWORD -eq 1 && $prev == "serv" ]]; then
_service_list
else
_service_usage_list
fi
return 0
} &&
complete -F _serv serv
...@@ -94,7 +94,6 @@ if distro altlinux-release ; then ...@@ -94,7 +94,6 @@ if distro altlinux-release ; then
elif has Walnut ; then DISTRIB_RELEASE="4.0" elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0" elif has 5.0 ; then DISTRIB_RELEASE="5.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1" elif has 5.1 ; then DISTRIB_RELEASE="5.1"
elif has Ziziphora ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5" elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6" elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7" elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
...@@ -118,11 +117,7 @@ elif distro mopslinux-version ; then ...@@ -118,11 +117,7 @@ elif distro mopslinux-version ; then
fi fi
elif distro slackware-version ; then elif distro slackware-version ; then
DISTRIB_ID="Slackware" DISTRIB_ID="Slackware"
if has 10.2 ; then DISTRIB_RELEASE="10.2" DISTRIB_RELEASE="$(grep -Eo [0-9]+\.[0-9]+ $DISTROFILE)"
elif has 11 ; then DISTRIB_RELEASE="11"
elif has 11.1 ; then DISTRIB_RELEASE="11.1"
elif has 12 ; then DISTRIB_RELEASE="12"
fi
elif distro arch-release ; then elif distro arch-release ; then
DISTRIB_ID="ArchLinux" DISTRIB_ID="ArchLinux"
......
...@@ -3,31 +3,37 @@ ...@@ -3,31 +3,37 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
PROGDIR=$(dirname $0) PROGDIR=$(dirname $0)
# will replaced to /usr/share/eepm during install
SHAREDIR=$(dirname $0)
load_helper() load_helper()
{ {
[ -r "$PROGDIR/$1" ] || fatal "Have no $PROGDIR/$1 helper file" local CMD="$SHAREDIR/$1"
. $PROGDIR/$1 # do not use fatal() here, it can be initial state
[ -r "$CMD" ] || { echo "FATAL: Have no $CMD helper file" ; exit 1; }
. $CMD
} }
load_helper epm-sh-functions load_helper epm-sh-functions
#PATH=$PATH:/sbin:/usr/sbin
set_sudo set_sudo
check_tty check_tty
...@@ -62,6 +68,7 @@ set_pm_type ...@@ -62,6 +68,7 @@ set_pm_type
verbose= verbose=
quiet= quiet=
nodeps= nodeps=
force=
non_interactive= non_interactive=
skip_installed= skip_installed=
show_command_only= show_command_only=
...@@ -80,6 +87,9 @@ case $progname in ...@@ -80,6 +87,9 @@ case $progname in
epms) epms)
epm_cmd=search epm_cmd=search
;; ;;
epmq)
epm_cmd=query
;;
epmqf) epmqf)
epm_cmd=query_file epm_cmd=query_file
;; ;;
...@@ -92,7 +102,8 @@ case $progname in ...@@ -92,7 +102,8 @@ case $progname in
epm|upm|eepm) epm|upm|eepm)
;; ;;
*) *)
fatal "Unknown command: $progname" # epm by default
# fatal "Unknown command: $progname"
;; ;;
esac esac
...@@ -105,43 +116,26 @@ check_command() ...@@ -105,43 +116,26 @@ check_command()
-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
;; ;;
reinstall) # HELPCMD: reinstall package(s) from remote repositories or from local file
epm_cmd=reinstall
;;
-e|-P|remove|delete) # HELPCMD: remove (delete) package(s) from the database and the system -e|-P|remove|delete) # HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd=remove epm_cmd=remove
;; ;;
-qi|info|show) # HELPCMD: print package detail info -s|search) # HELPCMD: search in remote package repositories
epm_cmd=info epm_cmd=search
;;
requires|deplist) # HELPCMD: print package requires
epm_cmd=requires
;;
clean) # HELPCMD: clean local package cache
epm_cmd=clean
;;
-qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages
;; ;;
-qp|query_package) # HELPCMD: search in the list of installed packages -qp|query_package) # HELPCMD: search in the list of installed packages
epm_cmd=query_package epm_cmd=query_package
;; ;;
update) # HELPCMD: update remote package repository databases -qf|which|belongs) # HELPCMD: query package(s) owning file
epm_cmd=update epm_cmd=query_file
;;
dist-upgrade|upgrade) # HELPCMD: performs upgrades of package software distributions
epm_cmd=upgrade
;; ;;
-s|search) # HELPCMD: search in remote package repositories
epm_cmd=search reinstall) # HELPCMD: reinstall package(s) from remote repositories or from local file
epm_cmd=reinstall
;; ;;
-q|installed) # HELPCMD: check presence of package(s) -q|installed) # HELPCMD: check presence of package(s)
epm_cmd=query epm_cmd=query
;; ;;
-qf|which|belongs) # HELPCMD: query package(s) owning file -sf|sf|filesearch) # HELPCMD: search in which package a file is included
epm_cmd=query_file
;;
-sf|filesearch|search_file) # HELPCMD: search in which package a file is included
epm_cmd=search_file epm_cmd=search_file
;; ;;
-ql|filelist) # HELPCMD: print package file list -ql|filelist) # HELPCMD: print package file list
...@@ -150,35 +144,65 @@ check_command() ...@@ -150,35 +144,65 @@ check_command()
check|fix|verify) # HELPCMD: check local package base integrity and fix it check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=check epm_cmd=check
;; ;;
checkpkg|integrity) # HELPCMD: check package integrity changelog|cl) # HELPCMD: show changelog for package
epm_cmd=checkpkg epm_cmd=changelog
;; ;;
simulate) # HELPCMD: simulate install (check requires) -qi|info|show) # HELPCMD: print package detail info
epm_cmd=simulate epm_cmd=info
;;
requires|deplist) # HELPCMD: print package requires
epm_cmd=requires
;;
-qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages
;;
update) # HELPCMD: update remote package repository databases
epm_cmd=update
;; ;;
addrepo|ar) # HELPCMD: add package repo addrepo|ar) # HELPCMD: add package repo
epm_cmd=addrepo epm_cmd=addrepo
;; ;;
repolist|sl|listrepo) # HELPCMD: print repo list repolist|sl|rl|listrepo) # HELPCMD: print repo list
epm_cmd=repolist epm_cmd=repolist
;; ;;
removerepo|rr) # HELPCMD: remove package repo removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo epm_cmd=removerepo
;; ;;
clean) # HELPCMD: clean local package cache
epm_cmd=clean
;;
autoremove) # HELPCMD: auto remove unneeded package(s)
epm_cmd=autoremove
;;
upgrade|dist-upgrade) # HELPCMD: performs upgrades of package software distributions
epm_cmd=upgrade
;;
simulate) # HELPCMD: simulate install (it does check requires, minimally)
epm_cmd=simulate
;;
checkpkg|integrity) # HELPCMD: check package integrity
epm_cmd=checkpkg
;;
*) *)
return 1 return 1
;;
esac esac
return 0 return 0
} }
for opt in "$@" ; do check_option()
check_command $opt && continue {
case $opt in case $1 in
-h|--help|help) # HELPOPT: this help -h|--help|help) # HELPOPT: this help
phelp; exit 0 phelp
exit 0
;; ;;
-v|--version) # HELPOPT: print version -v|--version) # HELPOPT: print version
print_version; exit 0 print_version
exit 0
;; ;;
--verbose) # HELPOPT: verbose mode --verbose) # HELPOPT: verbose mode
verbose=1 verbose=1
...@@ -186,7 +210,7 @@ for opt in "$@" ; do ...@@ -186,7 +210,7 @@ for opt in "$@" ; do
--skip-installed) # HELPOPT: skip already install during install --skip-installed) # HELPOPT: skip already install during install
skip_installed=1 skip_installed=1
;; ;;
--show-command-only) # HELPOPT: show command only, do not any action --show-command-only) # HELPOPT: show command only, do not any action (supports install and remove ONLY)
show_command_only=1 show_command_only=1
;; ;;
--quiet) # HELPOPT: quiet mode (do not print commands before exec) --quiet) # HELPOPT: quiet mode (do not print commands before exec)
...@@ -195,17 +219,28 @@ for opt in "$@" ; do ...@@ -195,17 +219,28 @@ for opt in "$@" ; do
--nodeps) # HELPOPT: skip dependency check (during install/simulate and so on) --nodeps) # HELPOPT: skip dependency check (during install/simulate and so on)
nodeps="--nodeps" nodeps="--nodeps"
;; ;;
--force) # HELPOPT: force install/remove package (f.i., override)
force="--force"
;;
--auto) # HELPOPT: non interactive mode --auto) # HELPOPT: non interactive mode
non_interactive=1 non_interactive=1
;; ;;
*) *)
if [ -f "$opt" ] ; then return 1
pkg_files="$pkg_files $opt"
else
pkg_names="$pkg_names $opt"
fi
;; ;;
esac esac
return 0
}
for opt in "$@" ; do
check_command $opt && continue
check_option $opt && continue
if [ -f "$opt" ] ; then
pkg_files="$pkg_files $opt"
else
pkg_names="$pkg_names $opt"
fi
done done
pkg_files=$(strip_spaces "$pkg_files") pkg_files=$(strip_spaces "$pkg_files")
...@@ -213,16 +248,18 @@ pkg_names=$(strip_spaces "$pkg_names") ...@@ -213,16 +248,18 @@ pkg_names=$(strip_spaces "$pkg_names")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
echover "command: $epm_cmd"
echover "pkg_files=$pkg_files" echover "pkg_files=$pkg_files"
echover "pkg_names=$pkg_names" echover "pkg_names=$pkg_names"
# Run helper for command # Just printout help if run without args
if [ -z "$epm_cmd" ] ; then if [ -z "$epm_cmd" ] ; then
print_version print_version
echo echo
fatal "Run $ epm --help for get help" fatal "Run $ epm --help for get help"
fi fi
# Run helper for command
load_helper epm-$epm_cmd load_helper epm-$epm_cmd
epm_$epm_cmd epm_$epm_cmd
# return last error code # return last error code (from subroutine)
...@@ -3,26 +3,25 @@ ...@@ -3,26 +3,25 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
epm_addrepo() epm_addrepo()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd $SUDO apt-repo add $pkg_filenames sudocmd apt-repo add $pkg_filenames
;; ;;
apt-dpkg) apt-dpkg)
echo "You need manually add repo to /etc/apt/sources.list" echo "You need manually add repo to /etc/apt/sources.list"
...@@ -31,17 +30,20 @@ case $PMTYPE in ...@@ -31,17 +30,20 @@ case $PMTYPE in
echo "You need manually add repo to /etc/yum.repos.d/" echo "You need manually add repo to /etc/yum.repos.d/"
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.addmedia $pkg_filenames sudocmd urpmi.addmedia $pkg_filenames
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper ar $pkg_filenames sudocmd zypper ar $pkg_filenames
;; ;;
emerge) emerge)
docmd $SUDO layman -a $pkg_filenames sudocmd layman -a $pkg_filenames
;; ;;
pacman) pacman)
echo "You need manually add repo to /etc/pacman.conf" echo "You need manually add repo to /etc/pacman.conf"
;; ;;
npackd)
docmd npackdcl add-repo --url=$pkg_filenames
;;
slackpkg) slackpkg)
echo "You need manually add repo to /etc/slackpkg/mirrors" echo "You need manually add repo to /etc/slackpkg/mirrors"
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
epm_autoremove()
{
case $PMTYPE in
#apt-rpm)
# sudocmd apt-get autoclean
# ;;
apt-dpkg)
sudocmd apt-get autoclean
;;
#yum-rpm)
# sudocmd yum clean all
# ;;
#urpm-rpm)
# sudocmd urpmi --clean
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
__epm_changelog_files()
{
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
docmd_foreach "rpm -p --changelog" $@ | less
;;
# apt-dpkg)
#
# ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
__epm_changelog_local_names()
{
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
docmd_foreach "rpm --changelog" $@ | less
;;
apt-dpkg)
# FIXME: only first pkg
docmd zcat /usr/share/doc/$1/changelog.Debian.gz | less
;;
emerge)
docmd view /usr/portage/category/$1/ChangeLog | less
;;
pacman)
docmd pacman -Qc package | less
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
__epm_changelog_unlocal_names()
{
[ -z "$@" ] && return
case $PMTYPE in
#apt-rpm)
# docmd_foreach "rpm --changelog" $@ | less
# ;;
#apt-dpkg)
# # FIXME: only first pkg
# docmd zcat /usr/share/doc/$1/changelog.Debian.gz | less
# ;;
#yum-rpm)
# sudocmd yum clean all
# ;;
#urpm-rpm)
# sudocmd urpmi --clean
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
}
epm_changelog()
{
[ -n "$pkg_filenames" ] || fatal "Run changelog without params"
__epm_changelog_files $pkg_files
local pkg
for pkg in $pkg_names ; do
if is_installed $pkg ; then
__epm_changelog_local_names $pkg
else
__epm_changelog_unlocal_names $pkg
fi
done
}
...@@ -3,43 +3,42 @@ ...@@ -3,43 +3,42 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
epm_check() epm_check()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
#docmd $SUDO apt-get check || exit #sudocmd apt-get check || exit
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
docmd $SUDO apt-get -f install || exit sudocmd apt-get -f install || exit
;; ;;
apt-dpkg) apt-dpkg)
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
docmd $SUDO apt-get -f install || exit sudocmd apt-get -f install || exit
docmd $SUDO apt-get autoremove sudocmd apt-get autoremove
;; ;;
yum-rpm) yum-rpm)
docmd package-cleanup --leaves docmd package-cleanup --leaves
package-cleanup --leaves | xargs yum remove a= package-cleanup --leaves | xargs yum remove
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpme --auto-orphans sudocmd urpme --auto-orphans
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper verify || exit sudocmd zypper verify || exit
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
......
...@@ -3,34 +3,34 @@ ...@@ -3,34 +3,34 @@
# Copyright (C) 2009, 2012 Etersoft # Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# 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.
check_rpm_integrity() check_rpm_integrity()
{ {
a= rpm --checksig $@ >/dev/null docmd rpm --checksig $@
} }
check_deb_integrity() check_deb_integrity()
{ {
a= dpkg --contents $@ >/dev/null # FIXME: debsums -ca package ?
docmd dpkg --contents $@
} }
check_bz2_integrity() check_bz2_integrity()
{ {
a= bunzip -t $1 >/dev/null docmd bunzip -t $1
} }
check_tbz_integrity() check_tbz_integrity()
...@@ -40,7 +40,7 @@ check_tbz_integrity() ...@@ -40,7 +40,7 @@ check_tbz_integrity()
check_gz_integrity() check_gz_integrity()
{ {
a= gunzip -t $1 >/dev/null docmd gunzip -t $1
} }
check_tgz_integrity() check_tgz_integrity()
...@@ -50,12 +50,22 @@ check_tgz_integrity() ...@@ -50,12 +50,22 @@ check_tgz_integrity()
check_zip_integrity() check_zip_integrity()
{ {
a= unzip -t $1 >/dev/null docmd unzip -t $@
}
check_rar_integrity()
{
docmd unrar t $@
} }
check_xz_integrity() check_xz_integrity()
{ {
a= xz -t $1 >/dev/null docmd xz -t $1
}
check_7z_integrity()
{
docmd 7z t $1
} }
check_exe_integrity() check_exe_integrity()
...@@ -82,8 +92,8 @@ check_pkg_integrity() ...@@ -82,8 +92,8 @@ check_pkg_integrity()
epm_checkpkg() epm_checkpkg()
{ {
[ -n "$pkg_files" ] || fatal "Run without names" [ -n "$pkg_files" ] || fatal "Run without names"
local pkg
for i in $pkg_files ; do for pkg in $pkg_files ; do
check_pkg_integrity $i || fatal "Broken package $i" check_pkg_integrity $pkg || fatal "Broken package $pkg"
done done
} }
...@@ -3,36 +3,35 @@ ...@@ -3,36 +3,35 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
epm_clean() epm_clean()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get clean sudocmd apt-get clean
;; ;;
yum-rpm) yum-rpm)
docmd $SUDO yum clean all sudocmd yum clean all
docmd $SUDO yum makecache sudocmd yum makecache
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi --clean sudocmd urpmi --clean
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper clean sudocmd zypper clean
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
......
...@@ -3,53 +3,89 @@ ...@@ -3,53 +3,89 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-query load_helper epm-query
__epm_filelist_file()
{
local CMD
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
CMD="rpm -qlp"
;;
apt-dpkg)
CMD="dpkg --contents"
;;
*)
fatal "Do not known query command for $PMTYPE"
;;
esac
docmd $CMD $@
}
__epm_filelist_name()
{
local CMD
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm)
CMD="rpm -ql"
;;
apt-dpkg)
CMD="dpkg -L"
;;
yum-rpm)
CMD="rpm -ql"
;;
urpm-rpm)
CMD="rpm -ql"
;;
zypper-rpm)
CMD="rpm -ql"
;;
pacman)
CMD="pacman -Ql"
;;
slackpkg)
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized"
docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}*
return
;;
*)
fatal "Do not known query command for $PMTYPE"
;;
esac
docmd $CMD $pkg_names && return
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized"
}
epm_filelist() epm_filelist()
{ {
[ -n "$pkg_filenames" ] || fatal "Run query without names" [ -n "$pkg_filenames" ] || fatal "Run query without names"
case $PMTYPE in
apt-rpm) __epm_filelist_file $pkg_files || return
CMD="rpm -ql" __epm_filelist_name $pkg_names || return
;;
apt-dpkg)
CMD="dpkg -L"
;;
yum-rpm)
CMD="rpm -ql"
;;
urpm-rpm)
CMD="rpm -ql"
;;
zypper-rpm)
CMD="rpm -ql"
;;
pacman)
CMD="pacman -Ql"
;;
*)
fatal "Do not known query command for $PMTYPE"
;;
esac
docmd $CMD $pkg_filenames && return
epm_query >/dev/null || fatal "Query filelist for non installed packages does not realized"
} }
...@@ -3,50 +3,63 @@ ...@@ -3,50 +3,63 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-query load_helper epm-query
__epm_info_rpm_low()
{
if [ -n "$pkg_files" ] ; then
docmd rpm -qip $pkg_files
fi
[ -z "$pkg_names" ] && return
is_installed $pkg_names && docmd rpm -qi $pkg_names && return
}
epm_info() epm_info()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
if [ -n "$pkg_files" ] ; then __epm_info_rpm_low && return
docmd rpm -qip $pkg_files
fi
[ -z "$pkg_names" ] && return
pkg_filenames=$pkg_names epm_query >/dev/null && docmd rpm -qi $pkg_names && return
docmd apt-cache show $pkg_names docmd apt-cache show $pkg_names
;; ;;
apt-dpkg) apt-dpkg)
if [ -n "$pkg_files" ] ; then
docmd dpkg -I $pkg_files
fi
[ -z "$pkg_names" ] && return [ -z "$pkg_names" ] && return
pkg_filenames=$pkg_names epm_query >/dev/null && docmd dpkg -I $pkg_names && return is_installed $pkg_names && docmd dpkg -p $pkg_names && return
docmd apt-cache show $pkg_names docmd apt-cache show $pkg_names
;; ;;
yum-rpm) yum-rpm)
__epm_info_rpm_low && return
docmd yum info $pkg_names docmd yum info $pkg_names
;; ;;
zypper-rpm) zypper-rpm)
__epm_info_rpm_low && return
docmd zypper info $pkg_names docmd zypper info $pkg_names
;; ;;
pacman) pacman)
docmd pacman -Si $pkg_names docmd pacman -Si $pkg_names
;; ;;
npackd)
# FIXME: --version=
docmd npackdcl info --package=$pkg_names
;;
slackpkg) slackpkg)
docmd slackpkg info $pkg_names docmd /usr/sbin/slackpkg info $pkg_names
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
......
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# TODO: use when run install with epm --skip-installed install # TODO: use when run install with epm --skip-installed install
...@@ -23,6 +22,7 @@ filter_out_installed_packages() ...@@ -23,6 +22,7 @@ filter_out_installed_packages()
{ {
[ -z "$skip_installed" ] && cat && return [ -z "$skip_installed" ] && cat && return
# TODO: rewrite with use is_installed
# TODO: use this more effectively way # TODO: use this more effectively way
#for i in $(cat) ; do #for i in $(cat) ; do
# rpm -q $i >/dev/null && continue # rpm -q $i >/dev/null && continue
...@@ -40,7 +40,7 @@ filter_out_installed_packages() ...@@ -40,7 +40,7 @@ filter_out_installed_packages()
*) *)
cat cat
;; ;;
esac | sed -e "s|rpm-build-altlinux-compat||g" | filter_strip_spaces esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
} }
...@@ -55,32 +55,35 @@ epm_install_names() ...@@ -55,32 +55,35 @@ epm_install_names()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get install $@ sudocmd apt-get install $@
return ;;
deepsolver-rpm)
sudocmd ds-install $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi $@ sudocmd urpmi $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
emerge) emerge)
docmd $SUDO emerge -uD $@ sudocmd emerge -uD $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -S $@ sudocmd pacman -S $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum install $@ sudocmd yum install $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper install $@ sudocmd zypper install $@
return ;; return ;;
mpkg) mpkg)
docmd $SUDO mpkg install $@ sudocmd mpkg install $@
return ;; return ;;
slackpkg) slackpkg)
# TODO: use upgrade if package is already installed # TODO: use upgrade if package is already installed
docmd $SUDO slackpkg install $@ sudocmd /usr/sbin/slackpkg install $@
return ;; return ;;
*) *)
fatal "Do not known install command for $PMTYPE" fatal "Do not known install command for $PMTYPE"
...@@ -94,26 +97,33 @@ epm_ni_install_names() ...@@ -94,26 +97,33 @@ epm_ni_install_names()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes install $@ sudocmd apt-get -y --force-yes install $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum -y install $@ sudocmd yum -y install $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi --auto --no-verify-rpm $@ sudocmd urpmi --auto --no-verify-rpm $@
return ;; return ;;
zypper-rpm) zypper-rpm)
yes | docmd $SUDO zypper --non-interactive install $@ yes | sudocmd zypper --non-interactive install $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -S --noconfirm $@ sudocmd pacman -S --noconfirm $@
return ;;
npackd)
# npackdcl update --package=<package> (remove old and install new)
docmd npackdcl add --package=$@
return ;;
chocolatey)
docmd chocolatey install $@
return ;; return ;;
slackpkg) slackpkg)
# TODO: use upgrade if package is already installed # TODO: use upgrade if package is already installed
docmd $SUDO slackpkg -batch=on -default_answer=yes install $@ sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes install $@
return ;; return ;;
*) *)
fatal "Do not known appropriate install command for $PMTYPE" fatal "Do not known appropriate install command for $PMTYPE"
...@@ -127,25 +137,25 @@ epm_install_files() ...@@ -127,25 +137,25 @@ epm_install_files()
case $PMTYPE in case $PMTYPE in
apt-rpm|urpm-rpm) apt-rpm|urpm-rpm)
docmd $SUDO rpm -Uvh --force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
# use install_names # use install_names
;; ;;
apt-dpkg) apt-dpkg)
docmd $SUDO dpkg -i $@ sudocmd dpkg -i $@
docmd $SUDO apt-get -f install sudocmd apt-get -f install
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO rpm -Uvh --force $@ && return sudocmd rpm -Uvh $force $@ && return
docmd $SUDO yum --nogpgcheck install $@ sudocmd yum --nogpgcheck install $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add $@ sudocmd pkg_add $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -U --noconfirm $@ sudocmd pacman -U --noconfirm $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO installpkg $@ sudocmd /sbin/installpkg $@
return ;; return ;;
esac esac
...@@ -169,7 +179,10 @@ epm_print_install_command() ...@@ -169,7 +179,10 @@ epm_print_install_command()
echo "pacman -U --noconfirm $@" echo "pacman -U --noconfirm $@"
;; ;;
slackpkg) slackpkg)
echo "installpkg $@" echo "/sbin/installpkg $@"
;;
npackd)
echo "npackdcl add --package=$@"
;; ;;
*) *)
fatal "Do not known appropriate install command for $PMTYPE" fatal "Do not known appropriate install command for $PMTYPE"
...@@ -181,7 +194,7 @@ epm_print_install_command() ...@@ -181,7 +194,7 @@ epm_print_install_command()
epm_install() epm_install()
{ {
if [ -n "$show_command_only" ] ; then if [ -n "$show_command_only" ] ; then
epm_print_install_command $names epm_print_install_command $pkg_filenames
return return
fi fi
......
...@@ -3,23 +3,23 @@ ...@@ -3,23 +3,23 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
epm_packages() epm_packages()
{ {
local CMD
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
...@@ -40,6 +40,12 @@ case $PMTYPE in ...@@ -40,6 +40,12 @@ case $PMTYPE in
pacman) pacman)
CMD="pacman -Qs" CMD="pacman -Qs"
;; ;;
npackd)
CMD="npackdcl list"
;;
# chocolatey)
# CMD="chocolatey list"
# ;;
slackpkg) slackpkg)
CMD="ls -1 /var/log/packages/" CMD="ls -1 /var/log/packages/"
;; ;;
......
...@@ -3,45 +3,101 @@ ...@@ -3,45 +3,101 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-packages load_helper epm-packages
# TODO: combine with -qa (the difference only in return status now) # TODO: combine with -qa (the difference only in return status now)
_query_via_packages_list()
{
local res=0
local firstpkg=$1
shift
epm_packages | grep "$firstpkg-" || res=1
for pkg in "$@" ; do
epm_packages 2>/dev/null | grep "$pkg-" || res=1
done
return $res
}
__epm_query_file()
{
local CMD
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
CMD="rpm -qp"
;;
apt-dpkg)
CMD="dpkg-deb --show"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
#return
;;
*)
fatal "Do not know command for query file package"
;;
esac
docmd $CMD $@
}
__epm_query_name()
{
local CMD
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
CMD="rpm -q"
;;
apt-dpkg)
CMD="dpkg -l"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
#return
;;
npackd)
CMD="npackdcl path --package=$@"
;;
*)
_query_via_packages_list $@
return
;;
esac
docmd $CMD $@
}
# check if pkg is installed
is_installed()
{
pkg_filenames="$@" epm_query >/dev/null
}
epm_query() epm_query()
{ {
[ -n "$pkg_filenames" ] || fatal "Run query without names" [ -n "$pkg_filenames" ] || fatal "Run query without names"
case $PMTYPE in __epm_query_file $pkg_files || return
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
CMD="rpm -q"
;;
apt-dpkg)
CMD="dpkg -l"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
#return
;;
*)
epm_packages | grep "$pkg_filenames"
;;
esac
docmd $CMD $pkg_filenames
__epm_query_name $pkg_names || return
} }
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2009, 2012 Etersoft # Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-search_file load_helper epm-search_file
...@@ -23,7 +22,7 @@ load_helper epm-search_file ...@@ -23,7 +22,7 @@ load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf # copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively # use and modify TOFILE recursively
real_file() __do_query_real_file()
{ {
local LINKTO1 LINKTO local LINKTO1 LINKTO
local TOFILE local TOFILE
...@@ -40,16 +39,17 @@ real_file() ...@@ -40,16 +39,17 @@ real_file()
# get value of symbolic link # get value of symbolic link
if [ -L "$TOFILE" ] ; then if [ -L "$TOFILE" ] ; then
__do_query $TOFILE
LINKTO=`readlink "$TOFILE"` LINKTO=`readlink "$TOFILE"`
echo "Note: $TOFILE is link to $LINKTO" echo "Note: $TOFILE is link to $LINKTO"
real_file "$LINKTO" __do_query_real_file "$LINKTO"
fi fi
FULLFILEPATH=`readlink -f $TOFILE` FULLFILEPATH=`realpath $TOFILE`
} }
dpkg_print_name_version() dpkg_print_name_version()
{ {
local ver local ver i
for i in $* ; do for i in $* ; do
ver=$(dpkg -s $i 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g") ver=$(dpkg -s $i 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g")
if [ -z "$ver" ] ; then if [ -z "$ver" ] ; then
...@@ -83,6 +83,11 @@ __do_query() ...@@ -83,6 +83,11 @@ __do_query()
pacman) pacman)
CMD="pacman -Qo" CMD="pacman -Qo"
;; ;;
slackpkg)
# note: need remove leading slash for grep
docmd grep -R "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g"
return
;;
*) *)
fatal "Do not known query command for $PMTYPE" fatal "Do not known query command for $PMTYPE"
;; ;;
...@@ -96,10 +101,9 @@ epm_query_file() ...@@ -96,10 +101,9 @@ epm_query_file()
# file can exists or not # file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names" [ -n "$pkg_filenames" ] || fatal "Run query without file names"
for pkg in $pkg_filenames ; do
for i in $pkg_filenames ; do __do_query_real_file "$pkg"
real_file "$i" __do_query $FULLFILEPATH || pkg_filenames=$pkg epm_search_file
__do_query $FULLFILEPATH || pkg_filenames=$i epm_search_file done
done
} }
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-packages load_helper epm-packages
......
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
...@@ -24,25 +23,25 @@ epm_reinstall_names() ...@@ -24,25 +23,25 @@ epm_reinstall_names()
[ -n "$1" ] || return [ -n "$1" ] || return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get --reinstall install $@ sudocmd apt-get --reinstall install $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum install $@ sudocmd yum install $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi $@ sudocmd urpmi $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper install $@ sudocmd zypper install $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -U $@ sudocmd pacman -U $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg reinstall $@ sudocmd /usr/sbin/slackpkg reinstall $@
return ;; return ;;
*) *)
fatal "Do not known install command for $PMTYPE" fatal "Do not known install command for $PMTYPE"
...@@ -56,14 +55,14 @@ epm_reinstall_files() ...@@ -56,14 +55,14 @@ epm_reinstall_files()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd $SUDO rpm -Uvh --force $@ && return sudocmd rpm -Uvh --force $@ && return
docmd $SUDO apt-get --reinstall install $@ sudocmd apt-get --reinstall install $@
return ;; return ;;
apt-pkg) apt-pkg)
docmd $SUDO dpkg -i $@ sudocmd dpkg -i $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO installpkg $@ sudocmd /sbin/installpkg $@
return ;; return ;;
esac esac
......
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# Try remove with low level removing # Try remove with low level removing
...@@ -24,19 +23,19 @@ epm_remove_low() ...@@ -24,19 +23,19 @@ epm_remove_low()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm) apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
docmd $SUDO rpm -ev $nodeps $@ sudocmd rpm -ev $nodeps $@
return ;; return ;;
apt-dpkg) apt-dpkg)
docmd $SUDO dpkg -P $@ sudocmd dpkg -P $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_delete -r $@ sudocmd pkg_delete -r $@
return ;; return ;;
emerge) emerge)
docmd $SUDO emerge -unmerge $@ sudocmd emerge --unmerge $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO removepkg $@ sudocmd /sbin/removepkg $@
return ;; return ;;
esac esac
return 1 return 1
...@@ -48,32 +47,41 @@ epm_remove_names() ...@@ -48,32 +47,41 @@ epm_remove_names()
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get remove --purge $@ sudocmd apt-get remove --purge $@
return ;;
deepsolver-rpm)
sudocmd ds-remove $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpme $@ sudocmd urpme $@
return ;; return ;;
pkg_add) # without dependencies pkg_add) # without dependencies
docmd $SUDO pkg_delete $@ sudocmd pkg_delete $@
return ;; return ;;
emerge) emerge)
#docmd $SUDO emerge --unmerge $@ #sudocmd emerge --unmerge $@
docmd $SUDO emerge -aC $@ sudocmd emerge -aC $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -R $@ sudocmd pacman -R $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum remove $@ sudocmd yum remove $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper remove $@ sudocmd zypper remove $@
return ;; return ;;
mpkg) mpkg)
docmd $SUDO mpkg remove $@ sudocmd mpkg remove $@
return ;;
npackd)
docmd npackdcl remove --package=$@
return ;;
chocolatey)
docmd chocolatey uninstall $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg remove $@ sudocmd /usr/sbin/slackpkg remove $@
return ;; return ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
...@@ -86,30 +94,61 @@ epm_remove_nonint() ...@@ -86,30 +94,61 @@ epm_remove_nonint()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes remove --purge $@ sudocmd apt-get -y --force-yes remove --purge $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpme --auto $@ sudocmd urpme --auto $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -R --noconfirm $@ sudocmd pacman -R --noconfirm $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum -y remove $@ sudocmd yum -y remove $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper --non-interactive remove $@ sudocmd zypper --non-interactive remove $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg -batch=on -default_answer=yes remove $@ sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@
return ;; return ;;
esac esac
return 5 return 5
} }
epm_print_remove_command()
{
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
echo "rpm -ev $nodeps $@"
;;
apt-dpkg)
echo "dpkg -P $@"
;;
pkg_add)
echo "pkg_delete -r $@"
;;
emerge)
echo "emerge --unmerge $@"
;;
slackpkg)
echo "/sbin/removepkg $@"
;;
*)
fatal "Do not known appropriate remove command for $PMTYPE"
;;
esac
}
epm_remove() epm_remove()
{ {
if [ -n "$show_command_only" ] ; then
epm_print_remove_command $pkg_filenames
return
fi
[ -n "$pkg_files" ] && fatal "FIXME: remove by package file is not supported yet"
[ -n "$pkg_filenames" ] || fatal "Run remove without args" [ -n "$pkg_filenames" ] || fatal "Run remove without args"
epm_remove_low $pkg_filenames && return epm_remove_low $pkg_filenames && return
......
...@@ -3,26 +3,25 @@ ...@@ -3,26 +3,25 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
epm_removerepo() epm_removerepo()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd $SUDO apt-repo rm $pkg_filenames sudocmd apt-repo rm $pkg_filenames
;; ;;
apt-dpkg) apt-dpkg)
echo "You need remove repo from /etc/apt/sources.list" echo "You need remove repo from /etc/apt/sources.list"
...@@ -31,17 +30,20 @@ case $PMTYPE in ...@@ -31,17 +30,20 @@ case $PMTYPE in
echo "You need remove repo from /etc/yum.repos.d/" echo "You need remove repo from /etc/yum.repos.d/"
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.removemedia $pkg_filenames sudocmd urpmi.removemedia $pkg_filenames
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper removerepo $pkg_filenames sudocmd zypper removerepo $pkg_filenames
;; ;;
emerge) emerge)
docmd $SUDO layman -d$pkg_filenames sudocmd layman -d$pkg_filenames
;; ;;
pacman) pacman)
echo "You need remove repo from /etc/pacman.conf" echo "You need remove repo from /etc/pacman.conf"
;; ;;
npackd)
docmd npackdcl remove-repo --url=$pkg_filenames
;;
slackpkg) slackpkg)
echo "You need remove repo from /etc/slackpkg/mirrors" echo "You need remove repo from /etc/slackpkg/mirrors"
;; ;;
......
...@@ -3,23 +3,23 @@ ...@@ -3,23 +3,23 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
print_apt_sources_list() print_apt_sources_list()
{ {
local i
for i in $@ ; do for i in $@ ; do
test -r "$i" || continue test -r "$i" || continue
#echo #echo
...@@ -34,6 +34,9 @@ case $PMTYPE in ...@@ -34,6 +34,9 @@ case $PMTYPE in
apt-rpm) apt-rpm)
docmd apt-repo list docmd apt-repo list
;; ;;
deepsolver-rpm)
docmd ds-conf
;;
apt-dpkg) apt-dpkg)
showcmd cat /etc/apt/sources.list* showcmd cat /etc/apt/sources.list*
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
...@@ -51,10 +54,10 @@ case $PMTYPE in ...@@ -51,10 +54,10 @@ case $PMTYPE in
docmd layman -L docmd layman -L
;; ;;
pacman) pacman)
docmd cat /etc/pacman.conf docmd grep -v "^#\|^$" /etc/pacman.conf
;; ;;
slackpkg) slackpkg)
docmd cat /etc/slackpkg/mirrors docmd grep -v "^#\|^$" /etc/slackpkg/mirrors
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
......
...@@ -3,28 +3,24 @@ ...@@ -3,28 +3,24 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-packages
# TODO: combine with -qa (the difference only in return status now)
epm_requires() epm_requires()
{ {
[ -n "$pkg_filenames" ] || fatal "Run query without names" local CMD
[ -n "$pkg_filenames" ] || fatal "Run query without names"
# by file package # by file package
case $PMTYPE in case $PMTYPE in
...@@ -33,7 +29,7 @@ case $PMTYPE in ...@@ -33,7 +29,7 @@ case $PMTYPE in
;; ;;
apt-dpkg) apt-dpkg)
showcmd dpkg -s $pkg_files showcmd dpkg -s $pkg_files
dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g" a= dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g"
return return
;; ;;
*) *)
......
...@@ -3,26 +3,26 @@ ...@@ -3,26 +3,26 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# copied from korinf/tools/run-script/scripts/search # copied from korinf/tools/run-script/scripts/search
epm_search() epm_search()
{ {
[ -n "$pkg_filenames" ] || fatal "Run search without names" local CMD
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
...@@ -49,8 +49,17 @@ case $PMTYPE in ...@@ -49,8 +49,17 @@ case $PMTYPE in
mpkg) mpkg)
CMD="mpkg search" CMD="mpkg search"
;; ;;
npackd)
fatal "FIXME: Have not idea for search with npackdcl list"
;;
chocolatey)
CMD="chocolatey list"
;;
slackpkg) slackpkg)
CMD="slackpkg search" # FIXME
echo "FIXME: need case insensitive search"
docmd_foreach "/usr/sbin/slackpkg search" $pkg_filenames
return
;; ;;
*) *)
fatal "Do not known search command for $PMTYPE" fatal "Do not known search command for $PMTYPE"
......
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# TODO: port or rewrite apt-file # TODO: port or rewrite apt-file
...@@ -29,8 +28,9 @@ local_content_search() ...@@ -29,8 +28,9 @@ local_content_search()
local REPODIR=/var/ftp/pub/ALTLinux/Sisyphus local REPODIR=/var/ftp/pub/ALTLinux/Sisyphus
local CI=$REPODIR/$SYSARCH/base/contents_index local CI=$REPODIR/$SYSARCH/base/contents_index
local CINOA=$REPODIR/noarch/base/contents_index local CINOA=$REPODIR/noarch/base/contents_index
local OUTCMD="less" #local OUTCMD="less"
[ -n "$USETTY" ] || OUTCMD="cat" #[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
test -r $CI && test -r $CINOA || fatal "Can't locate $CI or $CINOA" test -r $CI && test -r $CINOA || fatal "Can't locate $CI or $CINOA"
...@@ -42,14 +42,15 @@ local_content_search() ...@@ -42,14 +42,15 @@ local_content_search()
epm_search_file() epm_search_file()
{ {
[ -n "$pkg_filenames" ] || fatal "Run search without names" local CMD
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
local_content_search $pkg_filenames local_content_search $pkg_filenames
return ;; return ;;
apt-dpkg) apt-dpkg)
docmd $SUDO apt-file update >/dev/null sudocmd apt-file update
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
yum-rpm) yum-rpm)
...@@ -65,7 +66,7 @@ case $PMTYPE in ...@@ -65,7 +66,7 @@ case $PMTYPE in
CMD="pacman -Qo" CMD="pacman -Qo"
;; ;;
slackpkg) slackpkg)
CMD="slackpkg file-search" CMD="/usr/sbin/slackpkg file-search"
;; ;;
*) *)
fatal "Do not known search file command for $PMTYPE" fatal "Do not known search file command for $PMTYPE"
......
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# copied from /etc/init.d/outformat (ALT Linux) # copied from /etc/init.d/outformat (ALT Linux)
...@@ -30,6 +29,10 @@ isatty() ...@@ -30,6 +29,10 @@ isatty()
check_tty() check_tty()
{ {
isatty || return isatty || return
which tput >/dev/null 2>/dev/null || return
# FreeBSD does not support tput -S
echo | tput -S >/dev/null 2>/dev/null || return
[ -z "$USETTY" ] || return
export USETTY=1 export USETTY=1
} }
...@@ -37,7 +40,7 @@ check_tty() ...@@ -37,7 +40,7 @@ check_tty()
set_boldcolor() set_boldcolor()
{ {
[ -n "$USETTY" ] || return [ "$USETTY" = "1" ] || return
{ {
echo bold echo bold
echo setaf $1 echo setaf $1
...@@ -46,7 +49,7 @@ set_boldcolor() ...@@ -46,7 +49,7 @@ set_boldcolor()
restore_color() restore_color()
{ {
[ -n "$USETTY" ] || return [ "$USETTY" = "1" ] || return
{ {
echo op; # set Original color Pair. echo op; # set Original color Pair.
echo sgr0; # turn off all special graphics mode (bold in our case). echo sgr0; # turn off all special graphics mode (bold in our case).
...@@ -56,7 +59,7 @@ restore_color() ...@@ -56,7 +59,7 @@ restore_color()
echover() echover()
{ {
[ -n "$verbose" ] || return [ -n "$verbose" ] || return
echo "$*" echo "$*" >&2
} }
# Used DISTRNAME # Used DISTRNAME
...@@ -93,11 +96,23 @@ docmd() ...@@ -93,11 +96,23 @@ docmd()
"$@" "$@"
} }
# Print command line and run command line
docmd_foreach()
{
local cmd
cmd="$1"
#showcmd "$@"
shift
for pkg in "$@" ; do
docmd $cmd $pkg
done
}
# Print command line and run command line with SUDO # Print command line and run command line with SUDO
docmds() sudocmd()
{ {
showcmd "$@" showcmd "$SUDO $@"
"$SUDO $@" $SUDO "$@"
} }
filter_strip_spaces() filter_strip_spaces()
...@@ -127,18 +142,26 @@ fatal() ...@@ -127,18 +142,26 @@ fatal()
set_sudo() set_sudo()
{ {
SUDO=""
# skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return
# set SUDO not for root user # set SUDO not for root user
SUDO="sudo"
[ -n "$UID" ] || UID=`id -u` [ -n "$UID" ] || UID=`id -u`
if [ $UID = "0" ]; then
SUDO="" # do not need sudo
fi [ $UID = "0" ] && return
# use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
# print options description from HELPCMD/HELPOPT lines in the code # print options description from HELPCMD/HELPOPT lines in the code
get_help() get_help()
{ {
grep "# $1" $PROGDIR/epm | while read n ; do grep "# $1" $0 | while read n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g") opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g") desc=$(echo $n | sed -e "s|.*) # $1:||g")
printf " %-20s %s\n" $opt "$desc" printf " %-20s %s\n" $opt "$desc"
...@@ -157,9 +180,19 @@ set_pm_type() ...@@ -157,9 +180,19 @@ set_pm_type()
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env set_target_pkg_env
# override package manager detection result
if [ -n "$FORCEPM" ] ; then
PMTYPE=$FORCEPM
return
fi
case $DISTRNAME in case $DISTRNAME in
ALTLinux|PCLinux) ALTLinux|PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
#which deepsolver 2>/dev/null >/dev/null && CMD=deepsolver-rpm
;;
PCLinux)
CMD="apt-rpm"
;; ;;
Ubuntu|Debian|Mint) Ubuntu|Debian|Mint)
CMD="apt-dpkg" CMD="apt-dpkg"
...@@ -185,6 +218,9 @@ case $DISTRNAME in ...@@ -185,6 +218,9 @@ case $DISTRNAME in
SUSE|SLED|SLES) SUSE|SLED|SLES)
CMD="zypper-rpm" CMD="zypper-rpm"
;; ;;
Windows)
CMD="chocolatey"
;;
*) *)
fatal "Do not known DISTRNAME $DISTRNAME" fatal "Do not known DISTRNAME $DISTRNAME"
;; ;;
......
...@@ -3,39 +3,37 @@ ...@@ -3,39 +3,37 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-install load_helper epm-install
load_helper epm-search
epm_simulate() _epm_do_simulate()
{ {
local CMD local CMD
[ -z "$pkg_filenames" ] && echo "Skip empty list" && return 2 local filenames=$@
local filenames="$(echo $pkg_filenames | filter_out_installed_packages)"
[ -z "$filenames" ] && echo "All packages are already installed" && return 2
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
CMD="apt-get --simulate install" CMD="apt-get --simulate install"
;; ;;
yum-rpm) yum-rpm)
CMD="yum provides" LC_ALL=C sudocmd yum --assumeno install $filenames
;; # FIXME: check only error output
LC_ALL=C sudocmd yum --assumeno install $filenames 2>&1 | grep "^No package" && return 1
return 0 ;;
urpm-rpm) urpm-rpm)
CMD="urpmi --test --auto" CMD="urpmi --test --auto"
;; ;;
...@@ -50,13 +48,39 @@ epm_simulate() ...@@ -50,13 +48,39 @@ epm_simulate()
echo no | $SUDO pacman -v -S $filenames echo no | $SUDO pacman -v -S $filenames
return ;; return ;;
slackpkg) slackpkg)
docmd slackpkg -batch=on -default_answer=yes download #docmd /usr/sbin/slackpkg -batch=on -default_answer=yes download
;; # just try search every package
# FIXME: epm_search have to return false status code if the package does not found
local pkg res
res=0
for pkg in $filenames ; do
pkg_filenames="$pkg-[0-9]" epm_search | grep -E "(installed|upgrade)" && continue
pkg_filenames="$pkg" epm_search | grep -E "(installed|upgrade)" && continue
res=1
echo "Does not found in repository."
done
return $res ;;
*) *)
fatal "Do not known simulate command for $PMTYPE" fatal "Do not known simulate command for $PMTYPE"
;; ;;
esac esac
docmd $SUDO $CMD $filenames sudocmd $CMD $filenames
}
epm_simulate()
{
[ -z "$pkg_filenames" ] && echo "Skip empty list" && return 2
local filenames="$(echo $pkg_filenames | filter_out_installed_packages)"
[ -z "$filenames" ] && echo "All packages are already installed" && return 0
_epm_do_simulate $filenames
local RES=$?
if [ -z "$quiet" ] ; then
[ "$RES" = 0 ] && echo "Result: $filenames package(s) CAN BE installed" || echo "Result: There are PROBLEMS with install some package(s)"
fi
return $RES
} }
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# copied from korinf/tools/run-script/scripts/update # copied from korinf/tools/run-script/scripts/update
...@@ -24,31 +23,34 @@ epm_update() ...@@ -24,31 +23,34 @@ epm_update()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
#docmd $SUDO apt-get -f install || exit #sudocmd apt-get -f install || exit
;; ;;
apt-dpkg) apt-dpkg)
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
#docmd $SUDO apt-get -f install || exit #sudocmd apt-get -f install || exit
#docmd $SUDO apt-get autoremove #sudocmd apt-get autoremove
;; ;;
yum-rpm) yum-rpm)
docmd $SUDO yum check-update sudocmd yum check-update
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.update -a sudocmd urpmi.update -a
;; ;;
pacman) pacman)
docmd $SUDO pacman -S -y sudocmd pacman -S -y
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper refresh sudocmd zypper refresh
;; ;;
emerge) emerge)
docmd $SUDO emerge --sync sudocmd emerge --sync
;; ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg update sudocmd /usr/sbin/slackpkg update
;;
deepsolver-rpm)
sudocmd ds-update
;; ;;
*) *)
fatal "Do not known update command for $PMTYPE" fatal "Do not known update command for $PMTYPE"
......
...@@ -3,25 +3,26 @@ ...@@ -3,25 +3,26 @@
# Copyright (C) 2012 Etersoft # Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# #
# This file is free software; you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
epm_upgrade() epm_upgrade()
{ {
echo "Run command for upgrade packages" local CMD
case $PMTYPE in echo "Run command for upgrade packages"
case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
# FIXME: apt-get update before # FIXME: apt-get update before
CMD="apt-get dist-upgrade" CMD="apt-get dist-upgrade"
...@@ -45,13 +46,16 @@ epm_upgrade() ...@@ -45,13 +46,16 @@ epm_upgrade()
pkg_add) pkg_add)
CMD="freebsd-update fetch install" CMD="freebsd-update fetch install"
;; ;;
chocolatey)
CMD="chocolatey update all"
;;
slackpkg) slackpkg)
CMD="slackpkg upgrade-all" CMD="/usr/sbin/slackpkg upgrade-all"
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
;; ;;
esac esac
docmd $SUDO $CMD $pkg_filenames sudocmd $CMD $pkg_filenames
} }
epm
\ No newline at end of file
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PROGDIR=$(dirname $0)
# will replaced to /usr/share/eepm during install
SHAREDIR=$(dirname $0)
load_helper()
{
local CMD="$SHAREDIR/$1"
[ -r "$CMD" ] || fatal "Have no $CMD helper file"
. $CMD
}
load_helper epm-sh-functions
PATH=$PATH:/sbin:/usr/sbin
set_sudo
check_tty
#############################
# FIXME: detect by real init system
# FIXME: add upstart support (Ubuntu?)
set_service_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)
CMD="service-chkconfig"
;;
Ubuntu|Debian|Mint)
CMD="service-update"
;;
Mandriva|ROSA)
CMD="service-chkconfig"
;;
# FreeBSD)
# CMD="pkg_add"
# ;;
# Gentoo)
# CMD="emerge"
# ;;
# ArchLinux)
# CMD="pacman"
# ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig"
;;
Slackware)
CMD="service-initd"
;;
SUSE|SLED|SLES)
CMD="service-chkconfig"
;;
# Windows)
# CMD="chocolatey"
# ;;
*)
fatal "Do not known DISTRNAME $DISTRNAME yet"
;;
esac
SERVICETYPE=$CMD
}
phelp()
{
echo "$Descr
$Usage
Commands:
$(get_help HELPCMD)
Options:
$(get_help HELPOPT)
"
}
print_version()
{
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "This program may be freely redistributed under the terms of the GNU GPL."
}
Usage="Usage: serv [options] [<service>] [<command>] [params]..."
Descr="serv - Service manager"
set_service_type
verbose=
quiet=
non_interactive=
show_command_only=
serv_cmd=
service_name=
params=
check_command()
{
# do not override command
[ -z "$serv_cmd" ] || return
case $1 in
status) # HELPCMD: show service status
serv_cmd=status
;;
usage) # HELPCMD: print out usage of the service
serv_cmd=usage
;;
#restart) # HELPCMD: restart service
#reload) # HELPCMD: reload service
start) # HELPCMD: start service
serv_cmd=start
;;
try-restart|condrestart) # HELPCMD: Restart service if running
serv_cmd=try_restart
;;
stop) # HELPCMD: stop service
serv_cmd=stop
;;
list) # HELPCMD: list running services
serv_cmd=list
;;
list-all) # HELPCMD: list all available services
serv_cmd=list_all
;;
list-startup) # HELPCMD: list all services to run on startup
serv_cmd=list_startup
;;
on|enable) # HELPCMD: add service to run on startup and start it now
serv_cmd=enable
;;
off|disable) # HELPCMD: remove service to run on startup and stop it now
serv_cmd=disable
;;
*)
return 1
;;
esac
return 0
}
check_option()
{
case $1 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
;;
--show-command-only) # HELPOPT: show command only, do not any action
show_command_only=1
;;
--quiet) # HELPOPT: quiet mode (do not print commands before exec)
quiet=1
;;
--auto) # HELPOPT: non interactive mode
non_interactive=1
;;
*)
return 1
;;
esac
return 0
}
for opt in "$@" ; do
check_command $opt && continue
check_option $opt && continue
[ -z "$service_name" ] && service_name=$opt && continue
params="$params $opt"
done
echover "service: $service_name"
echover "command: $serv_cmd"
# Just printout help if run without args
if [ "$serv_cmd" != "list" ] && [ "$serv_cmd" != "list_all" ] && [ -z "$service_name" ] ; then
print_version
echo
fatal "Run $ serv --help for get help"
fi
if [ -z "$serv_cmd" ] ; then
serv_cmd=common
fi
# Run helper for command
load_helper serv-$serv_cmd
serv_$serv_cmd $service_name $params
# return last error code (from subroutine)
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Common call service
serv_common()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$SERVICE "$@"
;;
systemd)
sudocmd systemctl "$@" $SERVICE
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper serv-stop
load_helper serv-status
# Enable service by default
serv_disable()
{
is_service_running $1 && { serv_stop $1 || return ; }
is_service_autostart $1 || { echo "Service $1 already disabled for startup" && return ; }
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd chkconfig $1 off
;;
service-initd|service-update)
sudocmd update-rc.d $1 remove
;;
systemd)
sudocmd systemctl disable $1
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper serv-start
load_helper serv-status
# Enable service by default
serv_enable()
{
is_service_running $1 || serv_start $1 || return
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd chkconfig $1 on
;;
service-initd|service-update)
sudocmd update-rc.d $1 defaults
;;
systemd)
sudocmd systemctl enable $1
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# List running services
serv_list()
{
case $SERVICETYPE in
# service-chkconfig)
# ;;
service-upstart)
sudocmd initctl list
;;
service-update)
sudocmd service --status-all
;;
systemd)
sudocmd systemctl list-units
;;
*)
load_helper serv-list_all
load_helper serv-status
for i in $(serv_list_all) ; do
is_service_running $i && echo $i
done
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# List all available services
serv_list_all()
{
case $SERVICETYPE in
service-chkconfig|service-upstart)
# service --status-all for Ubuntu/Fedora
sudocmd chkconfig --list | cut -f1
;;
service-initd|service-update)
sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README
;;
systemd)
sudocmd systemctl list-unit-files
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
serv_list_startup()
{
case $SERVICETYPE in
# service-chkconfig|service-upstart)
# # service --status-all for Ubuntu/Fedora
# #sudocmd chkconfig --list | cut -f1
# ;;
# service-initd|service-update)
# sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README
# ;;
# systemd)
# sudocmd systemctl list-unit-files
# ;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Start service
serv_start()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE start "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$SERVICE start "$@"
;;
systemd)
sudocmd systemctl start "$SERVICE" "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
is_service_running()
{
case $SERVICETYPE in
service-chkconfig|service-upstart)
$SUDO service $1 status >/dev/null
;;
service-initd|service-update)
$SUDO /etc/init.d/$1 status >/dev/null
;;
systemd)
#sudocmd systemctl is-enabled $1
fatal "FIXME: don't know how detect current startup state"
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
is_service_autostart()
{
case $SERVICETYPE in
service-chkconfig|service-upstart)
LANG=C $SUDO chkconfig $1 --list | grep -q "5:on"
;;
service-initd|service-update)
fatal "FIXME: don't know how detect current startup state"
;;
systemd)
sudocmd systemctl is-enabled $1
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
serv_status()
{
is_service_autostart $1 && echo "Service $1 is sheduled to run on startup" || echo "Service $1 will NOT run on startup"
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE status "$@"
;;
service-update)
sudocmd /etc/init.d/$SERVICE status "$@"
;;
systemd)
sudocmd systemctl status $service "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Stop service
serv_stop()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE stop "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$SERVICE stop "$@"
;;
systemd)
sudocmd systemctl stop $SERVICE "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper serv-status
# Try restart service (if it is running)
serv_try_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $SERVICE || return 0
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $SERVICE || return 0
sudocmd /etc/init.d/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $SERVICE "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
_print_additional_usage()
{
echo "serv addition usage: {on|off|try-restart|usage}"
}
# Print usage of the service
serv_usage()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
# CHECKME: many services print out usage in stderr, it conflicts with printout command
#sudocmd service $SERVICE 2>&1
$SUDO service $SERVICE 2>&1
;;
service-initd|service-update)
#sudocmd /etc/init.d/$SERVICE 2>&1
$SUDO service $SERVICE 2>&1
;;
systemd)
sudocmd systemctl $SERVICE 2>&1
;;
*)
fatal "Do not known command for $SERVICETYPE"
;;
esac
_print_additional_usage
}
# This spec is backported to ALTLinux p5 automatically by rpmbph script. Do not edit it. # This spec is backported to ALTLinux p5 automatically by rpmbph script. Do not edit it.
# #
Name: eepm Name: eepm
Version: 1.0.0 Version: 1.1.4
Release: alt0.M50P.1 Release: alt0.M50P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
License: GPLv2 License: AFGPLv3
Group: System/Configuration/Packaging Group: System/Configuration/Packaging
Url: http://wiki.etersoft.ru/EPM Url: http://wiki.etersoft.ru/EPM
...@@ -33,29 +33,116 @@ universal interface to any package manager. ...@@ -33,29 +33,116 @@ universal interface to any package manager.
Can be useful for system administrators working Can be useful for system administrators working
with various distros. with various distros.
See detailed description here: http://wiki.etersoft.ru/EPM
%prep %prep
%setup %setup
%build %build
%undefine __libtoolize %undefine __libtoolize
%__subst "s|@VERSION@|%version-%release|g" bin/epm %__subst "s|@VERSION@|%version-%release|g" bin/epm bin/serv
%install %install
# install to datadir and so on # install to datadir and so on
%makeinstall %makeinstall
./pack_in_onefile.sh
install -m 0755 *packed.sh %buildroot/%_datadir/%name/
mkdir -p %buildroot%_sysconfdir/bash_completion.d/
install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv
%files %files
%doc README TODO %doc README TODO LICENSE
%_bindir/epm* %_bindir/epm*
%_bindir/eepm %_bindir/eepm
%_bindir/upm %_bindir/upm
%_bindir/serv
%_bindir/distr_info %_bindir/distr_info
%_datadir/%name/
%_sysconfdir/bash_completion.d/serv
%changelog %changelog
* Sat Sep 01 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.0-alt0.M50P.1 * Tue Jan 01 2013 Vitaly Lipatov <lav@altlinux.ru> 1.1.4-alt0.M50P.1
- backport to ALTLinux p5 (by rpmbph script) - backport to ALTLinux p5 (by rpmbph script)
* Tue Jan 01 2013 Vitaly Lipatov <lav@altlinux.ru> 1.1.4-alt1
- fix broken autoremove: rename epm-autoclean to epm-autoremove
* Thu Dec 27 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.3-alt1
- add initial deepsolver support
- checkpkg: print checking details, add 7z and rar support
* Thu Dec 13 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.2-alt1
- serv: allow additional params for start, stop and try_restart
- spec: replace @VERSION@ in serv too
- add print our commands to bash completion, to print usage
* Mon Dec 10 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.1-alt1
- serv: add usage command
- add README
- add initial bash_completion
* Mon Dec 10 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.0-alt3
- change license to AFGPLv3
* Sun Dec 09 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.0-alt2
- fix install links
* Sat Dec 08 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.0-alt1
- move included script to /usr/share/eepm
- introduce serv command for system services management
- add pack_in_onefile.sh: pack scripts on one file
* Sat Dec 08 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.7-alt1
- add epmq command as alias to epm -q (epm query)
- epm: rearrange command help
- epm-remove: warning about no support remove by package file
* Sat Nov 24 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.6-alt1
- epm: add changelog (cl) command
- add support for work without tput, with uncompat tput, allow USETTY=0 for disable tput use
- epm: write verbose output to stderr
- epm-filelist: add support for filelist of file package
- epm-query: add support for query file package
- epm-info: rewrite for support low level and hi level package info
- epm-simulate: return 0 if all needed packages are already installed
* Mon Oct 29 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.5-alt1
- epm-simulate: fix for non numeric version on Slackware (libjpeg-v8a)
- epm: intoduce autoremove command
- epm-search_file: do not use less
- epm-query_file: query package for every full path, not only last
* Fri Oct 26 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.4-alt1
- epm-simulate: fix simulate for yum
- epm-simulate: realize simulate for slackware
- epm-search: fix search for multiple packages in slackware
- epm-query: fix query for multiple names
- epm-query_file: more clean output on Slackware
- epm-simulate: print out result of the check
* Mon Oct 22 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.3-alt1
- rewrite set_sudo, skip SUDO if env. var EPMNOSUDO is not empty
- add initial support for window package manager Chocolatey
- add initial support for windows package manager Npackd
- epm-filelist: print package file list for slackware
- epm-query_file: add slackware support (thanks, bormant)
- distr_info: grep version from /etc/slackware-version (thanks, bormant)
- set_sudo: print fatal error if needed absent sudo
- use full path to slackpkg/installpkg/removepkg on Slackware (thanks, bormant)
- epm-remove: add support for --show-command-only (thanks, bormant)
- epm-repolist: fix grep source list (thanks, bormant)
* Tue Sep 18 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.2-alt1
- replace all docmd $SUDO with sudocmd call
- fix install package rpm-build-altlinux-compat via package fullname
* Tue Sep 18 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.1-alt1
- epm: add --force support for install
- drop extra dependencies
- introduce epm requires|deplist
- install: yum local install is obsoleted, use just yum install
* Fri Aug 17 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.0-alt1 * Fri Aug 17 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.0-alt1
- release 1.0 - release 1.0
- upgrade: add support for additional options - upgrade: add support for additional options
......
#!/bin/sh
#
# Run for create one-file-scripts
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
incorporate_distr_info()
{
cat <<EOF >>$OUTPUT
internal_distr_info()
{
EOF
cat bin/distr_info >>$OUTPUT
cat <<EOF >>$OUTPUT
}
EOF
}
filter_out()
{
grep -v "^load_helper " | sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g'
}
incorporate_all()
{
OUTPUT=$PACKCOMMAND-packed.sh
echo -n >$OUTPUT
awk 'BEGIN{desk=0}{if(/^load_helper epm-sh-functions/){desk++};if(desk==0) {print}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT
for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functions | sort) ; do
echo
echo "# File $i:"
cat $i | grep -v "^#"
done | filter_out >>$OUTPUT
incorporate_distr_info
awk 'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT
}
###############
PACKCOMMAND=epm
incorporate_all
###############
PACKCOMMAND=serv
incorporate_all
#!/bin/sh
cepm()
{
echo
../bin/epm --verbose $@ >/dev/null
}
cepm changelog mc
cepm filelist mc
cepm info mc
cepm -q mc
cepm -qf mc
cepm requires mc
# query packages
#cepm -qp mc
#cepm install mc
#cepm packages mc
#cepm search mc
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