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:
mkdir -p $(DESTDIR)$(bindir)
install -m 755 bin/* $(DESTDIR)$(bindir)
mkdir -p $(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
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
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0"
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 p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
......@@ -118,11 +117,7 @@ elif distro mopslinux-version ; then
fi
elif distro slackware-version ; then
DISTRIB_ID="Slackware"
if has 10.2 ; then DISTRIB_RELEASE="10.2"
elif has 11 ; then DISTRIB_RELEASE="11"
elif has 11.1 ; then DISTRIB_RELEASE="11.1"
elif has 12 ; then DISTRIB_RELEASE="12"
fi
DISTRIB_RELEASE="$(grep -Eo [0-9]+\.[0-9]+ $DISTROFILE)"
elif distro arch-release ; then
DISTRIB_ID="ArchLinux"
......
......@@ -3,31 +3,37 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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()
{
[ -r "$PROGDIR/$1" ] || fatal "Have no $PROGDIR/$1 helper file"
. $PROGDIR/$1
local CMD="$SHAREDIR/$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
#PATH=$PATH:/sbin:/usr/sbin
set_sudo
check_tty
......@@ -62,6 +68,7 @@ set_pm_type
verbose=
quiet=
nodeps=
force=
non_interactive=
skip_installed=
show_command_only=
......@@ -80,6 +87,9 @@ case $progname in
epms)
epm_cmd=search
;;
epmq)
epm_cmd=query
;;
epmqf)
epm_cmd=query_file
;;
......@@ -92,7 +102,8 @@ case $progname in
epm|upm|eepm)
;;
*)
fatal "Unknown command: $progname"
# epm by default
# fatal "Unknown command: $progname"
;;
esac
......@@ -105,43 +116,26 @@ check_command()
-i|install|add) # HELPCMD: install package(s) from remote repositories or from local file
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
epm_cmd=remove
;;
-qi|info|show) # HELPCMD: print package detail info
epm_cmd=info
;;
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
-s|search) # HELPCMD: search in remote package repositories
epm_cmd=search
;;
-qp|query_package) # HELPCMD: search in the list of installed packages
epm_cmd=query_package
;;
update) # HELPCMD: update remote package repository databases
epm_cmd=update
;;
dist-upgrade|upgrade) # HELPCMD: performs upgrades of package software distributions
epm_cmd=upgrade
-qf|which|belongs) # HELPCMD: query package(s) owning file
epm_cmd=query_file
;;
-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)
epm_cmd=query
;;
-qf|which|belongs) # HELPCMD: query package(s) owning file
epm_cmd=query_file
;;
-sf|filesearch|search_file) # HELPCMD: search in which package a file is included
-sf|sf|filesearch) # HELPCMD: search in which package a file is included
epm_cmd=search_file
;;
-ql|filelist) # HELPCMD: print package file list
......@@ -150,35 +144,65 @@ check_command()
check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=check
;;
checkpkg|integrity) # HELPCMD: check package integrity
epm_cmd=checkpkg
changelog|cl) # HELPCMD: show changelog for package
epm_cmd=changelog
;;
simulate) # HELPCMD: simulate install (check requires)
epm_cmd=simulate
-qi|info|show) # HELPCMD: print package detail info
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
epm_cmd=addrepo
;;
repolist|sl|listrepo) # HELPCMD: print repo list
repolist|sl|rl|listrepo) # HELPCMD: print repo list
epm_cmd=repolist
;;
removerepo|rr) # HELPCMD: remove package repo
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
;;
esac
return 0
}
for opt in "$@" ; do
check_command $opt && continue
case $opt in
check_option()
{
case $1 in
-h|--help|help) # HELPOPT: this help
phelp; exit 0
phelp
exit 0
;;
-v|--version) # HELPOPT: print version
print_version; exit 0
print_version
exit 0
;;
--verbose) # HELPOPT: verbose mode
verbose=1
......@@ -186,7 +210,7 @@ for opt in "$@" ; do
--skip-installed) # HELPOPT: skip already install during install
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
;;
--quiet) # HELPOPT: quiet mode (do not print commands before exec)
......@@ -195,17 +219,28 @@ for opt in "$@" ; do
--nodeps) # HELPOPT: skip dependency check (during install/simulate and so on)
nodeps="--nodeps"
;;
--force) # HELPOPT: force install/remove package (f.i., override)
force="--force"
;;
--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
if [ -f "$opt" ] ; then
pkg_files="$pkg_files $opt"
else
pkg_names="$pkg_names $opt"
fi
;;
esac
done
pkg_files=$(strip_spaces "$pkg_files")
......@@ -213,16 +248,18 @@ pkg_names=$(strip_spaces "$pkg_names")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
echover "command: $epm_cmd"
echover "pkg_files=$pkg_files"
echover "pkg_names=$pkg_names"
# Run helper for command
# Just printout help if run without args
if [ -z "$epm_cmd" ] ; then
print_version
echo
fatal "Run $ epm --help for get help"
fi
# Run helper for command
load_helper epm-$epm_cmd
epm_$epm_cmd
# return last error code
# return last error code (from subroutine)
......@@ -3,26 +3,25 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_addrepo()
{
case $PMTYPE in
apt-rpm)
docmd $SUDO apt-repo add $pkg_filenames
sudocmd apt-repo add $pkg_filenames
;;
apt-dpkg)
echo "You need manually add repo to /etc/apt/sources.list"
......@@ -31,17 +30,20 @@ case $PMTYPE in
echo "You need manually add repo to /etc/yum.repos.d/"
;;
urpm-rpm)
docmd $SUDO urpmi.addmedia $pkg_filenames
sudocmd urpmi.addmedia $pkg_filenames
;;
zypper-rpm)
docmd $SUDO zypper ar $pkg_filenames
sudocmd zypper ar $pkg_filenames
;;
emerge)
docmd $SUDO layman -a $pkg_filenames
sudocmd layman -a $pkg_filenames
;;
pacman)
echo "You need manually add repo to /etc/pacman.conf"
;;
npackd)
docmd npackdcl add-repo --url=$pkg_filenames
;;
slackpkg)
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 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_check()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
#docmd $SUDO apt-get check || exit
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
#sudocmd apt-get check || exit
sudocmd apt-get update || exit
sudocmd apt-get -f install || exit
;;
apt-dpkg)
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
docmd $SUDO apt-get autoremove
sudocmd apt-get update || exit
sudocmd apt-get -f install || exit
sudocmd apt-get autoremove
;;
yum-rpm)
docmd package-cleanup --leaves
package-cleanup --leaves | xargs yum remove
a= package-cleanup --leaves | xargs yum remove
;;
urpm-rpm)
docmd $SUDO urpme --auto-orphans
sudocmd urpme --auto-orphans
;;
zypper-rpm)
docmd $SUDO zypper verify || exit
sudocmd zypper verify || exit
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -3,34 +3,34 @@
# Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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()
{
a= rpm --checksig $@ >/dev/null
docmd rpm --checksig $@
}
check_deb_integrity()
{
a= dpkg --contents $@ >/dev/null
# FIXME: debsums -ca package ?
docmd dpkg --contents $@
}
check_bz2_integrity()
{
a= bunzip -t $1 >/dev/null
docmd bunzip -t $1
}
check_tbz_integrity()
......@@ -40,7 +40,7 @@ check_tbz_integrity()
check_gz_integrity()
{
a= gunzip -t $1 >/dev/null
docmd gunzip -t $1
}
check_tgz_integrity()
......@@ -50,12 +50,22 @@ check_tgz_integrity()
check_zip_integrity()
{
a= unzip -t $1 >/dev/null
docmd unzip -t $@
}
check_rar_integrity()
{
docmd unrar t $@
}
check_xz_integrity()
{
a= xz -t $1 >/dev/null
docmd xz -t $1
}
check_7z_integrity()
{
docmd 7z t $1
}
check_exe_integrity()
......@@ -82,8 +92,8 @@ check_pkg_integrity()
epm_checkpkg()
{
[ -n "$pkg_files" ] || fatal "Run without names"
for i in $pkg_files ; do
check_pkg_integrity $i || fatal "Broken package $i"
local pkg
for pkg in $pkg_files ; do
check_pkg_integrity $pkg || fatal "Broken package $pkg"
done
}
......@@ -3,36 +3,35 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_clean()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get clean
sudocmd apt-get clean
;;
yum-rpm)
docmd $SUDO yum clean all
docmd $SUDO yum makecache
sudocmd yum clean all
sudocmd yum makecache
;;
urpm-rpm)
docmd $SUDO urpmi --clean
sudocmd urpmi --clean
;;
zypper-rpm)
docmd $SUDO zypper clean
sudocmd zypper clean
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -3,28 +3,50 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_filelist()
__epm_filelist_file()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
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 $@
}
case $PMTYPE in
__epm_filelist_name()
{
local CMD
[ -z "$@" ] && return
case $PMTYPE in
apt-rpm)
CMD="rpm -ql"
;;
......@@ -43,13 +65,27 @@ case $PMTYPE in
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
esac
docmd $CMD $pkg_names && return
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized"
}
epm_filelist()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
docmd $CMD $pkg_filenames && return
epm_query >/dev/null || fatal "Query filelist for non installed packages does not realized"
__epm_filelist_file $pkg_files || return
__epm_filelist_name $pkg_names || return
}
......@@ -3,50 +3,63 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_info()
__epm_info_rpm_low()
{
case $PMTYPE in
apt-rpm)
if [ -n "$pkg_files" ] ; then
docmd rpm -qip $pkg_files
fi
[ -z "$pkg_names" ] && return
pkg_filenames=$pkg_names epm_query >/dev/null && docmd rpm -qi $pkg_names && return
is_installed $pkg_names && docmd rpm -qi $pkg_names && return
}
epm_info()
{
case $PMTYPE in
apt-rpm)
__epm_info_rpm_low && return
docmd apt-cache show $pkg_names
;;
apt-dpkg)
if [ -n "$pkg_files" ] ; then
docmd dpkg -I $pkg_files
fi
[ -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
;;
yum-rpm)
__epm_info_rpm_low && return
docmd yum info $pkg_names
;;
zypper-rpm)
__epm_info_rpm_low && return
docmd zypper info $pkg_names
;;
pacman)
docmd pacman -Si $pkg_names
;;
npackd)
# FIXME: --version=
docmd npackdcl info --package=$pkg_names
;;
slackpkg)
docmd slackpkg info $pkg_names
docmd /usr/sbin/slackpkg info $pkg_names
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# TODO: use when run install with epm --skip-installed install
......@@ -23,6 +22,7 @@ filter_out_installed_packages()
{
[ -z "$skip_installed" ] && cat && return
# TODO: rewrite with use is_installed
# TODO: use this more effectively way
#for i in $(cat) ; do
# rpm -q $i >/dev/null && continue
......@@ -40,7 +40,7 @@ filter_out_installed_packages()
*)
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()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get install $@
sudocmd apt-get install $@
return ;;
deepsolver-rpm)
sudocmd ds-install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi $@
sudocmd urpmi $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
sudocmd pkg_add -r $@
return ;;
emerge)
docmd $SUDO emerge -uD $@
sudocmd emerge -uD $@
return ;;
pacman)
docmd $SUDO pacman -S $@
sudocmd pacman -S $@
return ;;
yum-rpm)
docmd $SUDO yum install $@
sudocmd yum install $@
return ;;
zypper-rpm)
docmd $SUDO zypper install $@
sudocmd zypper install $@
return ;;
mpkg)
docmd $SUDO mpkg install $@
sudocmd mpkg install $@
return ;;
slackpkg)
# TODO: use upgrade if package is already installed
docmd $SUDO slackpkg install $@
sudocmd /usr/sbin/slackpkg install $@
return ;;
*)
fatal "Do not known install command for $PMTYPE"
......@@ -94,26 +97,33 @@ epm_ni_install_names()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes install $@
sudocmd apt-get -y --force-yes install $@
return ;;
yum-rpm)
docmd $SUDO yum -y install $@
sudocmd yum -y install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi --auto --no-verify-rpm $@
sudocmd urpmi --auto --no-verify-rpm $@
return ;;
zypper-rpm)
yes | docmd $SUDO zypper --non-interactive install $@
yes | sudocmd zypper --non-interactive install $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
sudocmd pkg_add -r $@
return ;;
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 ;;
slackpkg)
# 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 ;;
*)
fatal "Do not known appropriate install command for $PMTYPE"
......@@ -127,25 +137,25 @@ epm_install_files()
case $PMTYPE in
apt-rpm|urpm-rpm)
docmd $SUDO rpm -Uvh --force $nodeps $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
# use install_names
;;
apt-dpkg)
docmd $SUDO dpkg -i $@
docmd $SUDO apt-get -f install
sudocmd dpkg -i $@
sudocmd apt-get -f install
return ;;
yum-rpm)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO yum --nogpgcheck install $@
sudocmd rpm -Uvh $force $@ && return
sudocmd yum --nogpgcheck install $@
return ;;
pkg_add)
docmd $SUDO pkg_add $@
sudocmd pkg_add $@
return ;;
pacman)
docmd $SUDO pacman -U --noconfirm $@
sudocmd pacman -U --noconfirm $@
return ;;
slackpkg)
docmd $SUDO installpkg $@
sudocmd /sbin/installpkg $@
return ;;
esac
......@@ -169,7 +179,10 @@ epm_print_install_command()
echo "pacman -U --noconfirm $@"
;;
slackpkg)
echo "installpkg $@"
echo "/sbin/installpkg $@"
;;
npackd)
echo "npackdcl add --package=$@"
;;
*)
fatal "Do not known appropriate install command for $PMTYPE"
......@@ -181,7 +194,7 @@ epm_print_install_command()
epm_install()
{
if [ -n "$show_command_only" ] ; then
epm_print_install_command $names
epm_print_install_command $pkg_filenames
return
fi
......
......@@ -3,23 +3,23 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_packages()
{
local CMD
case $PMTYPE in
apt-rpm)
......@@ -40,6 +40,12 @@ case $PMTYPE in
pacman)
CMD="pacman -Qs"
;;
npackd)
CMD="npackdcl list"
;;
# chocolatey)
# CMD="chocolatey list"
# ;;
slackpkg)
CMD="ls -1 /var/log/packages/"
;;
......
......@@ -3,30 +3,68 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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-packages
# TODO: combine with -qa (the difference only in return status now)
epm_query()
_query_via_packages_list()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
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
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
CMD="rpm -q"
;;
......@@ -37,11 +75,29 @@ case $PMTYPE in
#dpkg -l $pkg_filenames | grep "^ii"
#return
;;
npackd)
CMD="npackdcl path --package=$@"
;;
*)
epm_packages | grep "$pkg_filenames"
_query_via_packages_list $@
return
;;
esac
esac
docmd $CMD $@
}
# check if pkg is installed
is_installed()
{
pkg_filenames="$@" epm_query >/dev/null
}
epm_query()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
docmd $CMD $pkg_filenames
__epm_query_file $pkg_files || return
__epm_query_name $pkg_names || return
}
......@@ -3,19 +3,18 @@
# Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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-search_file
......@@ -23,7 +22,7 @@ load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
real_file()
__do_query_real_file()
{
local LINKTO1 LINKTO
local TOFILE
......@@ -40,16 +39,17 @@ real_file()
# get value of symbolic link
if [ -L "$TOFILE" ] ; then
__do_query $TOFILE
LINKTO=`readlink "$TOFILE"`
echo "Note: $TOFILE is link to $LINKTO"
real_file "$LINKTO"
__do_query_real_file "$LINKTO"
fi
FULLFILEPATH=`readlink -f $TOFILE`
FULLFILEPATH=`realpath $TOFILE`
}
dpkg_print_name_version()
{
local ver
local ver i
for i in $* ; do
ver=$(dpkg -s $i 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g")
if [ -z "$ver" ] ; then
......@@ -83,6 +83,11 @@ __do_query()
pacman)
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"
;;
......@@ -96,10 +101,9 @@ epm_query_file()
# file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names"
for i in $pkg_filenames ; do
real_file "$i"
__do_query $FULLFILEPATH || pkg_filenames=$i epm_search_file
done
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$pkg epm_search_file
done
}
......@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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-packages
......
......@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
......@@ -24,25 +23,25 @@ epm_reinstall_names()
[ -n "$1" ] || return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get --reinstall install $@
sudocmd apt-get --reinstall install $@
return ;;
yum-rpm)
docmd $SUDO yum install $@
sudocmd yum install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi $@
sudocmd urpmi $@
return ;;
zypper-rpm)
docmd $SUDO zypper install $@
sudocmd zypper install $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
sudocmd pkg_add -r $@
return ;;
pacman)
docmd $SUDO pacman -U $@
sudocmd pacman -U $@
return ;;
slackpkg)
docmd $SUDO slackpkg reinstall $@
sudocmd /usr/sbin/slackpkg reinstall $@
return ;;
*)
fatal "Do not known install command for $PMTYPE"
......@@ -56,14 +55,14 @@ epm_reinstall_files()
case $PMTYPE in
apt-rpm)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO apt-get --reinstall install $@
sudocmd rpm -Uvh --force $@ && return
sudocmd apt-get --reinstall install $@
return ;;
apt-pkg)
docmd $SUDO dpkg -i $@
sudocmd dpkg -i $@
return ;;
slackpkg)
docmd $SUDO installpkg $@
sudocmd /sbin/installpkg $@
return ;;
esac
......
......@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# Try remove with low level removing
......@@ -24,19 +23,19 @@ epm_remove_low()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
docmd $SUDO rpm -ev $nodeps $@
sudocmd rpm -ev $nodeps $@
return ;;
apt-dpkg)
docmd $SUDO dpkg -P $@
sudocmd dpkg -P $@
return ;;
pkg_add)
docmd $SUDO pkg_delete -r $@
sudocmd pkg_delete -r $@
return ;;
emerge)
docmd $SUDO emerge -unmerge $@
sudocmd emerge --unmerge $@
return ;;
slackpkg)
docmd $SUDO removepkg $@
sudocmd /sbin/removepkg $@
return ;;
esac
return 1
......@@ -48,32 +47,41 @@ epm_remove_names()
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get remove --purge $@
sudocmd apt-get remove --purge $@
return ;;
deepsolver-rpm)
sudocmd ds-remove $@
return ;;
urpm-rpm)
docmd $SUDO urpme $@
sudocmd urpme $@
return ;;
pkg_add) # without dependencies
docmd $SUDO pkg_delete $@
sudocmd pkg_delete $@
return ;;
emerge)
#docmd $SUDO emerge --unmerge $@
docmd $SUDO emerge -aC $@
#sudocmd emerge --unmerge $@
sudocmd emerge -aC $@
return ;;
pacman)
docmd $SUDO pacman -R $@
sudocmd pacman -R $@
return ;;
yum-rpm)
docmd $SUDO yum remove $@
sudocmd yum remove $@
return ;;
zypper-rpm)
docmd $SUDO zypper remove $@
sudocmd zypper remove $@
return ;;
mpkg)
docmd $SUDO mpkg remove $@
sudocmd mpkg remove $@
return ;;
npackd)
docmd npackdcl remove --package=$@
return ;;
chocolatey)
docmd chocolatey uninstall $@
return ;;
slackpkg)
docmd $SUDO slackpkg remove $@
sudocmd /usr/sbin/slackpkg remove $@
return ;;
*)
fatal "Do not known command for $PMTYPE"
......@@ -86,30 +94,61 @@ epm_remove_nonint()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes remove --purge $@
sudocmd apt-get -y --force-yes remove --purge $@
return ;;
urpm-rpm)
docmd $SUDO urpme --auto $@
sudocmd urpme --auto $@
return ;;
pacman)
docmd $SUDO pacman -R --noconfirm $@
sudocmd pacman -R --noconfirm $@
return ;;
yum-rpm)
docmd $SUDO yum -y remove $@
sudocmd yum -y remove $@
return ;;
zypper-rpm)
docmd $SUDO zypper --non-interactive remove $@
sudocmd zypper --non-interactive remove $@
return ;;
slackpkg)
docmd $SUDO slackpkg -batch=on -default_answer=yes remove $@
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@
return ;;
esac
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()
{
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"
epm_remove_low $pkg_filenames && return
......
......@@ -3,26 +3,25 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_removerepo()
{
case $PMTYPE in
apt-rpm)
docmd $SUDO apt-repo rm $pkg_filenames
sudocmd apt-repo rm $pkg_filenames
;;
apt-dpkg)
echo "You need remove repo from /etc/apt/sources.list"
......@@ -31,17 +30,20 @@ case $PMTYPE in
echo "You need remove repo from /etc/yum.repos.d/"
;;
urpm-rpm)
docmd $SUDO urpmi.removemedia $pkg_filenames
sudocmd urpmi.removemedia $pkg_filenames
;;
zypper-rpm)
docmd $SUDO zypper removerepo $pkg_filenames
sudocmd zypper removerepo $pkg_filenames
;;
emerge)
docmd $SUDO layman -d$pkg_filenames
sudocmd layman -d$pkg_filenames
;;
pacman)
echo "You need remove repo from /etc/pacman.conf"
;;
npackd)
docmd npackdcl remove-repo --url=$pkg_filenames
;;
slackpkg)
echo "You need remove repo from /etc/slackpkg/mirrors"
;;
......
......@@ -3,23 +3,23 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_apt_sources_list()
{
local i
for i in $@ ; do
test -r "$i" || continue
#echo
......@@ -34,6 +34,9 @@ case $PMTYPE in
apt-rpm)
docmd apt-repo list
;;
deepsolver-rpm)
docmd ds-conf
;;
apt-dpkg)
showcmd cat /etc/apt/sources.list*
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
......@@ -51,10 +54,10 @@ case $PMTYPE in
docmd layman -L
;;
pacman)
docmd cat /etc/pacman.conf
docmd grep -v "^#\|^$" /etc/pacman.conf
;;
slackpkg)
docmd cat /etc/slackpkg/mirrors
docmd grep -v "^#\|^$" /etc/slackpkg/mirrors
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -3,27 +3,23 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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-packages
# TODO: combine with -qa (the difference only in return status now)
epm_requires()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Run query without names"
# by file package
......@@ -33,7 +29,7 @@ case $PMTYPE in
;;
apt-dpkg)
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
;;
*)
......
......@@ -3,25 +3,25 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# copied from korinf/tools/run-script/scripts/search
epm_search()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $PMTYPE in
......@@ -49,8 +49,17 @@ case $PMTYPE in
mpkg)
CMD="mpkg search"
;;
npackd)
fatal "FIXME: Have not idea for search with npackdcl list"
;;
chocolatey)
CMD="chocolatey list"
;;
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"
......
......@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# TODO: port or rewrite apt-file
......@@ -29,8 +28,9 @@ local_content_search()
local REPODIR=/var/ftp/pub/ALTLinux/Sisyphus
local CI=$REPODIR/$SYSARCH/base/contents_index
local CINOA=$REPODIR/noarch/base/contents_index
local OUTCMD="less"
[ -n "$USETTY" ] || OUTCMD="cat"
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
test -r $CI && test -r $CINOA || fatal "Can't locate $CI or $CINOA"
......@@ -42,6 +42,7 @@ local_content_search()
epm_search_file()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $PMTYPE in
......@@ -49,7 +50,7 @@ case $PMTYPE in
local_content_search $pkg_filenames
return ;;
apt-dpkg)
docmd $SUDO apt-file update >/dev/null
sudocmd apt-file update
docmd apt-file search $pkg_filenames
return ;;
yum-rpm)
......@@ -65,7 +66,7 @@ case $PMTYPE in
CMD="pacman -Qo"
;;
slackpkg)
CMD="slackpkg file-search"
CMD="/usr/sbin/slackpkg file-search"
;;
*)
fatal "Do not known search file command for $PMTYPE"
......
......@@ -3,19 +3,18 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# copied from /etc/init.d/outformat (ALT Linux)
......@@ -30,6 +29,10 @@ isatty()
check_tty()
{
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
}
......@@ -37,7 +40,7 @@ check_tty()
set_boldcolor()
{
[ -n "$USETTY" ] || return
[ "$USETTY" = "1" ] || return
{
echo bold
echo setaf $1
......@@ -46,7 +49,7 @@ set_boldcolor()
restore_color()
{
[ -n "$USETTY" ] || return
[ "$USETTY" = "1" ] || return
{
echo op; # set Original color Pair.
echo sgr0; # turn off all special graphics mode (bold in our case).
......@@ -56,7 +59,7 @@ restore_color()
echover()
{
[ -n "$verbose" ] || return
echo "$*"
echo "$*" >&2
}
# Used DISTRNAME
......@@ -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
docmds()
sudocmd()
{
showcmd "$@"
"$SUDO $@"
showcmd "$SUDO $@"
$SUDO "$@"
}
filter_strip_spaces()
......@@ -127,18 +142,26 @@ fatal()
set_sudo()
{
SUDO=""
# skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return
# set SUDO not for root user
SUDO="sudo"
[ -n "$UID" ] || UID=`id -u`
if [ $UID = "0" ]; then
SUDO=""
fi
# do not need sudo
[ $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
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")
desc=$(echo $n | sed -e "s|.*) # $1:||g")
printf " %-20s %s\n" $opt "$desc"
......@@ -157,9 +180,19 @@ set_pm_type()
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env
# override package manager detection result
if [ -n "$FORCEPM" ] ; then
PMTYPE=$FORCEPM
return
fi
case $DISTRNAME in
ALTLinux|PCLinux)
CMD="apt-rpm"
#which deepsolver 2>/dev/null >/dev/null && CMD=deepsolver-rpm
;;
PCLinux)
CMD="apt-rpm"
;;
Ubuntu|Debian|Mint)
CMD="apt-dpkg"
......@@ -185,6 +218,9 @@ case $DISTRNAME in
SUSE|SLED|SLES)
CMD="zypper-rpm"
;;
Windows)
CMD="chocolatey"
;;
*)
fatal "Do not known DISTRNAME $DISTRNAME"
;;
......
......@@ -3,39 +3,37 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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-install
load_helper epm-search
epm_simulate()
_epm_do_simulate()
{
local CMD
[ -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 2
local filenames=$@
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-get --simulate install"
;;
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)
CMD="urpmi --test --auto"
;;
......@@ -50,13 +48,39 @@ epm_simulate()
echo no | $SUDO pacman -v -S $filenames
return ;;
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"
;;
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 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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/>.
#
# copied from korinf/tools/run-script/scripts/update
......@@ -24,31 +23,34 @@ epm_update()
{
case $PMTYPE in
apt-rpm)
docmd $SUDO apt-get update || exit
#docmd $SUDO apt-get -f install || exit
sudocmd apt-get update || exit
#sudocmd apt-get -f install || exit
;;
apt-dpkg)
docmd $SUDO apt-get update || exit
#docmd $SUDO apt-get -f install || exit
#docmd $SUDO apt-get autoremove
sudocmd apt-get update || exit
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
yum-rpm)
docmd $SUDO yum check-update
sudocmd yum check-update
;;
urpm-rpm)
docmd $SUDO urpmi.update -a
sudocmd urpmi.update -a
;;
pacman)
docmd $SUDO pacman -S -y
sudocmd pacman -S -y
;;
zypper-rpm)
docmd $SUDO zypper refresh
sudocmd zypper refresh
;;
emerge)
docmd $SUDO emerge --sync
sudocmd emerge --sync
;;
slackpkg)
docmd $SUDO slackpkg update
sudocmd /usr/sbin/slackpkg update
;;
deepsolver-rpm)
sudocmd ds-update
;;
*)
fatal "Do not known update command for $PMTYPE"
......
......@@ -3,24 +3,25 @@
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 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 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# 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_upgrade()
{
local CMD
echo "Run command for upgrade packages"
case $PMTYPE in
apt-rpm|apt-dpkg)
# FIXME: apt-get update before
......@@ -45,13 +46,16 @@ epm_upgrade()
pkg_add)
CMD="freebsd-update fetch install"
;;
chocolatey)
CMD="chocolatey update all"
;;
slackpkg)
CMD="slackpkg upgrade-all"
CMD="/usr/sbin/slackpkg upgrade-all"
;;
*)
fatal "Do not known command for $PMTYPE"
;;
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.
#
Name: eepm
Version: 1.0.0
Version: 1.1.4
Release: alt0.M50P.1
Summary: Etersoft EPM package manager
License: GPLv2
License: AFGPLv3
Group: System/Configuration/Packaging
Url: http://wiki.etersoft.ru/EPM
......@@ -33,29 +33,116 @@ universal interface to any package manager.
Can be useful for system administrators working
with various distros.
See detailed description here: http://wiki.etersoft.ru/EPM
%prep
%setup
%build
%undefine __libtoolize
%__subst "s|@VERSION@|%version-%release|g" bin/epm
%__subst "s|@VERSION@|%version-%release|g" bin/epm bin/serv
%install
# install to datadir and so on
%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
%doc README TODO
%doc README TODO LICENSE
%_bindir/epm*
%_bindir/eepm
%_bindir/upm
%_bindir/serv
%_bindir/distr_info
%_datadir/%name/
%_sysconfdir/bash_completion.d/serv
%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)
* 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
- release 1.0
- 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