Commit edc6ef46 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p8 as 1.9.3-alt0.M80P.1 (with rpmbph script)

parents 7ca79667 5806fcb7
......@@ -13,7 +13,7 @@ install:
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/serv >$(DESTDIR)$(bindir)/serv
mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "-"` $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "[-_]"` $(DESTDIR)$(pkgdatadir)/
mkdir -p $(DESTDIR)$(mandir)/man1
cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man1/
......@@ -37,7 +37,12 @@ Note: epm is placed as /usr/bin/epm
$ rpm -qf /usr/bin/epm
eepm-1.1.0-alt2
== How to add new distro support ==
1. Fix detection with distr_info
2. Add distro support in set_pm_type function
3. Realize every command in epm-* files
4. Check epm packages and epm --short packages works correctly
(epm package 'awk' have to print packages with awk substring in their names)
See detailed description in russian at
http://wiki.etersoft.ru/Epm
......
#!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012 (c) Etersoft
# 2007 Public domain
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007-2016 Public domain
# Detect the distro and version
# Welcome to send updates!
......@@ -32,6 +32,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
}
......@@ -55,6 +56,7 @@ pkgtype()
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
......@@ -147,6 +149,11 @@ elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
DISTRIB_ID="TinyCoreLinux"
DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which xbps-query 2>/dev/null >/dev/null ; then
. $ROOTDIR/etc/os-release
DISTRIB_ID="VoidLinux"
DISTRIB_RELEASE="Live"
elif distro arch-release ; then
DISTRIB_ID="ArchLinux"
DISTRIB_RELEASE="2010"
......@@ -333,7 +340,7 @@ case $1 in
exit 0
;;
-V)
echo "20120519"
echo "20160822"
exit 0
;;
*)
......
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2016 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
......@@ -17,10 +17,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PROGDIR=$(dirname $0)
PROGDIR=$(dirname "$0")
PROGNAME=$(basename "$0")
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
PROGDIR=""
PROGNAME=""
fi
# will replaced to /usr/share/eepm during install
......@@ -89,9 +91,7 @@ pkg_names=
pkg_urls=
quoted_args=
progname="${0##*/}"
case $progname in
case $PROGNAME in
epmi)
epm_cmd=install
;;
......@@ -136,12 +136,17 @@ case $progname in
;;
epm|upm|eepm)
;;
epm.sh)
;;
*)
# epm by default
# fatal "Unknown command: $progname"
;;
esac
# was called with alias name
[ -n "$epm_cmd" ] && PROGNAME="epm"
check_command()
{
# do not override command
......@@ -397,7 +402,7 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
if [ -z "$epm_cmd" ] ; then
print_version
echo
fatal "Run $ $progname --help for get help"
fatal "Run $ $PROGNAME --help for get help"
fi
# Use eatmydata for write specific operations
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -19,26 +19,27 @@
epm_addrepo()
{
local repo="$(eval echo $quoted_args)"
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo add "$pkg_filenames"
sudocmd apt-repo add "$repo"
;;
apt-dpkg|aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list"
;;
yum-rpm)
assure_exists yum-utils
sudocmd yum-config-manager --add-repo "$pkg_filenames"
sudocmd yum-config-manager --add-repo "$repo"
;;
urpm-rpm)
sudocmd urpmi.addmedia "$pkg_filenames"
sudocmd urpmi.addmedia "$repo"
;;
zypper-rpm)
sudocmd zypper ar "$pkg_filenames"
sudocmd zypper ar "$repo"
;;
emerge)
sudocmd layman -a $"pkg_filenames"
sudocmd layman -a "$repo"
;;
pacman)
info "You need manually add repo to /etc/pacman.conf"
......@@ -46,7 +47,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames
;;
npackd)
sudocmd npackdcl add-repo --url="$pkg_filenames"
sudocmd npackdcl add-repo --url="$repo"
;;
slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors"
......
......@@ -90,6 +90,9 @@ case $PMTYPE in
local PKGLIST=$(zypper packages --orphaned | tail -n +5 | cut -d \| -f 3 | sort -u)
sudocmd zypper remove --clean-deps $PKGLIST
;;
xbps)
CMD="xbps-remove -o"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -127,6 +127,9 @@ case $PMTYPE in
local PKGLIST=$(zypper packages --unneeded | tail -n +5 | cut -d \| -f 3 | sort -u)
sudocmd zypper remove --clean-deps $PKGLIST
;;
xbps)
CMD="xbps-remove -O"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -77,6 +77,9 @@ case $PMTYPE in
pkgng)
sudocmd pkg clean -a
;;
xbps)
sudocmd xbps-remove -O
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2016 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
......@@ -123,6 +123,9 @@ __epm_filelist_name()
pkgng)
CMD="pkg info -l"
;;
xbps)
CMD="xbps-query -f"
;;
aptcyg)
docmd apt-cyg listfiles $@ | sed -e "s|^|/|g"
return
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 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
......@@ -103,6 +103,9 @@ case $PMTYPE in
pkgng)
docmd pkg info $pkg_names
;;
xbps)
docmd xbps-query --show $pkg_names
;;
homebrew)
docmd brew info $pkg_names
;;
......
......@@ -170,6 +170,9 @@ epm_install_names()
aptcyg)
sudocmd apt-cyg install $@
return ;;
xbps)
sudocmd xbps-install $@
return ;;
*)
fatal "Have no suitable install command for $PMTYPE"
;;
......@@ -235,6 +238,9 @@ epm_ni_install_names()
tce)
sudocmd tce-load -wi $@
return ;;
xbps)
sudocmd xbps-install -y $@
return ;;
#android)
# sudocmd pm install $@
# return ;;
......@@ -271,8 +277,11 @@ __epm_check_if_try_install_deb()
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $debpkgs ; do
showcmd alien -r -k --scripts "$pkg"
# TODO: need check for return status
# TODO: fakeroot for non ALT?
showcmd_store_output alien -r -k --scripts "$pkg" || fatal
local RPMCONVERTED=$(grep "rpm generated" $RC_STDOUT | sed -e "s| generated||g")
clean_store_output
epm install $RPMCONVERTED
done
rm -f $TDIR/*
rmdir $TDIR/
......@@ -293,12 +302,16 @@ __epm_check_if_try_install_rpm()
[ -n "$rpmpkgs" ] || return 1
assure_exists alien
assure_exists fakeroot
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $rpmpkgs ; do
showcmd alien -d -k --scripts "$pkg"
# TODO: need check for return status
showcmd_store_output fakeroot alien -d -k --scripts "$pkg"
clean_store_output
local DEBCONVERTED=$(grep "deb generated" $RC_STDOUT | sed -e "s| generated||g")
clean_store_output
epm install $DEBCONVERTED
done
rm -f $TDIR/*
rmdir $TDIR/
......@@ -323,7 +336,7 @@ epm_install_files()
if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
# TODO: check rpm result code and convert it to compatible format if possible
__epm_check_if_rpm_already_installed $@ && return
# if run with --nodeps, do not fallback on hi level
......@@ -475,6 +488,10 @@ epm_print_install_command()
tce)
echo "tce-load -wi $@"
;;
xbps)
echo "xbps-install -y $@"
;;
*)
fatal "Have no suitable appropriate install command for $PMTYPE"
;;
......@@ -497,14 +514,8 @@ download_pkg_urls()
done
}
__handle_pkg_urls()
__use_url_install()
{
[ -n "$pkg_urls" ] || return
# TODO: do it correcly
to_remove_pkg_files=
case $PMTYPE in
apt-rpm)
# ALT Linux really?
......@@ -526,10 +537,23 @@ __handle_pkg_urls()
# pkg_names="$pkg_names $pkg_urls"
# ;;
*)
# use workaround with eget: download and put in pkg_files
download_pkg_urls
return 1
;;
esac
return 0
}
__handle_pkg_urls()
{
[ -n "$pkg_urls" ] || return
# TODO: do it correctly
to_remove_pkg_files=
if [ "$(get_package_type "$pkg")" != $PKGFORMAT ] || ! __use_url_install ; then
# use workaround with eget: download and put in pkg_files
download_pkg_urls
fi
pkg_urls=
}
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -41,6 +41,11 @@ __aptcyg_print_full()
echo "$1-$VERSION"
}
__fo_pfn()
{
grep -v "^$" | grep -- "$pkg_filenames"
}
# TODO: we have a problem with error status here
epm_packages()
{
......@@ -49,23 +54,28 @@ epm_packages()
case $PMTYPE in
apt-rpm)
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
;;
docmd $CMD
return ;;
*-dpkg)
# FIXME: strong equal
#CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
docmd $CMD | grep "^i" | sed -e "s|.* ||g"
return
;;
showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
return ;;
snappy)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
;;
docmd $CMD
return ;;
emerge)
CMD="qlist -I -C"
# print with colors for console output
......@@ -73,26 +83,27 @@ case $PMTYPE in
;;
pkgsrc)
CMD="pkg_info"
docmd $CMD | sed -e "s| .*||g"
return
;;
showcmd $CMD
$CMD | sed -e "s| .*||g" | __fo_pfn
return ;;
pkgng)
if [ -n "$pkg_filenames" ] ; then
CMD="pkg info -E $pkg_filenames"
else
CMD="pkg info"
fi
showcmd $CMD
if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g"
$CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g" | __fo_pfn
else
docmd $CMD | sed -e "s| .*||g"
$CMD | sed -e "s| .*||g" | __fo_pfn
fi
return
;;
return ;;
pacman)
CMD="pacman -Qs $pkg_filenames"
showcmd $CMD
if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" -e "s|.*/||g" | grep -v "^$"
$CMD | sed -e "s| .*||g" -e "s|.*/||g" | __fo_pfn
return
fi
;;
......@@ -112,7 +123,7 @@ case $PMTYPE in
# FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g"
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g" | __fo_pfn
return
fi
;;
......@@ -131,9 +142,20 @@ case $PMTYPE in
guix)
CMD="guix package -I"
;;
xbps)
CMD="xbps-query -l"
showcmd $CMD
if [ -n "$short" ] ; then
$CMD | sed -e "s|^ii ||g" -e "s| .*||g" -e "s|\(.*\)-.*|\1|g" | __fo_pfn
else
$CMD | sed -e "s|^ii ||g" -e "s| .*||g" | __fo_pfn
fi
return 0
;;
android)
CMD="pm list packages"
docmd $CMD | sed -e "s|^package:||g"
showcmd $CMD
$CMD | sed -e "s|^package:||g" | __fo_pfn
return
;;
aptcyg)
......@@ -152,8 +174,7 @@ case $PMTYPE in
;;
esac
docmd $CMD
# FIXME: do not print empty lines, but we will lost error status definitely
# | grep -v "^$"
docmd $CMD | __fopfn
# FIXME: we print empty lines, but will lost error status
}
......@@ -33,16 +33,18 @@ _get_grep_exp()
# TODO: combine with -qa (the difference only in return status now)
_shortquery_via_packages_list()
{
local res=0
local res=1
local grepexp
local firstpkg=$1
shift
grepexp=$(_get_grep_exp $firstpkg)
# TODO: we miss status due grep
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" || res=1
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" && res=0 || res=1
local pkg
for pkg in "$@" ; do
......@@ -57,16 +59,19 @@ _shortquery_via_packages_list()
# TODO: non optimal double epm packages call
_query_via_packages_list()
{
local res=0
local res=1
local grepexp
local firstpkg=$1
shift
grepexp=$(_get_grep_exp $firstpkg)
# TODO: we miss status due grep
# TODO: grep correctly
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages || res=1
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages && res=0 || res=1
local pkg
for pkg in "$@" ; do
......
#!/bin/sh
#
# Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2009, 2012, 2016 Etersoft
# Copyright (C) 2009, 2012, 2016 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
......@@ -98,6 +98,10 @@ __do_query()
ipkg)
CMD="ipkg files"
;;
xbps)
# FIXME: maybe it is search file?
CMD="xbps-query -o"
;;
aptcyg)
#CMD="apt-cyg packageof"
# do not realized locally
......
......@@ -65,7 +65,7 @@ __replace_alt_version_in_repo()
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
# ask and replace only we will have changes
if apt-repo list | egrep -q -- "$1" ; then
if a= apt-repo list | egrep -q -- "$1" ; then
confirm "Are these correct changes? [y/N]" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
fi
......
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2014, 2016 Etersoft
# Copyright (C) 2012-2014, 2016 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
......@@ -128,6 +128,9 @@ epm_remove_names()
aptcyg)
sudocmd apt-cyg remove $@
return ;;
xbps)
sudocmd xbps remove -R $@
return ;;
ipkg)
sudocmd ipkg $(subst_option force -force-depends) remove $@
return ;;
......@@ -171,6 +174,9 @@ epm_remove_nonint()
ipkg)
sudocmd ipkg -force-defaults remove $@
return ;;
xbps)
sudocmd xbps remove -y $@
return ;;
esac
return 5
}
......@@ -205,6 +211,9 @@ epm_print_remove_command()
aptcyg)
echo "apt-cyg remove $@"
;;
xbps)
echo "xbps remove -y $@"
;;
*)
fatal "Have no suitable appropriate remove command for $PMTYPE"
;;
......
......@@ -52,6 +52,9 @@ epm_remove_old_kernels()
Gentoo)
sudocmd emerge -P gentoo-sources
return ;;
VoidLinux)
sudocmd vkpurge rm all
return ;;
esac
case $PMTYPE in
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -19,32 +19,33 @@
epm_removerepo()
{
local repo="$(eval echo $quoted_args)"
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo rm "$quoted_args"
sudocmd apt-repo rm "$repo"
;;
apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
;;
yum-rpm)
assure_exists yum-utils
sudocmd yum-config-manager --disable "$pkg_filenames"
sudocmd yum-config-manager --disable "$repo"
;;
urpm-rpm)
sudocmd urpmi.removemedia "$pkg_filenames"
sudocmd urpmi.removemedia "$repo"
;;
zypper-rpm)
sudocmd zypper removerepo "$pkg_filenames"
sudocmd zypper removerepo "$repo"
;;
emerge)
sudocmd layman "-d$pkg_filenames"
sudocmd layman "-d$repo"
;;
pacman)
info "You need remove repo from /etc/pacman.conf"
;;
npackd)
sudocmd npackdcl remove-repo --url="$pkg_filenames"
sudocmd npackdcl remove-repo --url="$repo"
;;
slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors"
......
......@@ -84,14 +84,18 @@ case $PMTYPE in
__fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list
docmd apt-repo list
# FIXME: what the best place?
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm)
sudocmd rm -fv /var/lib/rpm/__db*
sudocmd rpm --rebuilddb
# FIXME: what the best place?
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
xbps)
sudocmd xbps-pkgdb -a
;;
*)
fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -58,6 +58,9 @@ case $PMTYPE in
docmd eselect profile list
docmd layman -L
;;
xbps)
docmd xbps-query -L
;;
pacman)
docmd grep -v -- "^#\|^$" /etc/pacman.conf
;;
......
......@@ -105,6 +105,9 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d"
;;
xbps)
CMD="xbps-query -x"
;;
aptcyg)
#CMD="apt-cyg depends"
# print show version
......
#!/bin/sh
#
# Copyright (C) 2012,2013 Etersoft
# Copyright (C) 2012,2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012, 2013, 2016 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
......@@ -97,6 +97,9 @@ case $PMTYPE in
aptcyg)
CMD="apt-cyg searchall"
;;
xbps)
CMD="xbps-query -s"
;;
*)
fatal "Have no suitable search command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -73,6 +73,9 @@ case $PMTYPE in
ipkg)
CMD="ipkg search"
;;
xbps)
CMD="xbps-query -Ro"
;;
aptcyg)
docmd apt-cyg searchall $(echo " $pkg_filenames" | sed -e "s| /| |g")
return
......
......@@ -200,6 +200,12 @@ store_output()
#return $PIPESTATUS
}
showcmd_store_output()
{
showcmd "$@"
store_output "$@"
}
clean_store_output()
{
rm -f $RC_STDOUT $RC_STDOUT.pipestatus
......@@ -208,7 +214,8 @@ clean_store_output()
# run epm, possible from side repo
epm()
{
$PROGDIR/epm $@
[ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script"
$PROGDIR/$PROGNAME $@
}
# Print error message and stop the program
......@@ -424,6 +431,8 @@ if [ -n "$FORCEPM" ] ; then
return
fi
# TODO: move it in distr_vendor?
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRNAME in
ALTLinux)
CMD="apt-rpm"
......@@ -487,6 +496,9 @@ case $DISTRNAME in
TinyCoreLinux)
CMD="tce"
;;
VoidLinux)
CMD="xbps"
;;
*)
fatal "Have no suitable DISTRNAME $DISTRNAME"
;;
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 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
......@@ -90,6 +90,9 @@ case $PMTYPE in
aptcyg)
sudocmd apt-cyg update
;;
xbps)
sudocmd xbps-install -S
;;
*)
fatal "Have no suitable update command for $PMTYPE"
;;
......
......@@ -97,6 +97,9 @@ epm_upgrade()
docmd_foreach "epm install" $(short=1 epm packages)
return
;;
xbps)
CMD="xbps-install -Su"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -56,6 +56,9 @@ case $PMTYPE in
aptcyg)
CMD="apt-cyg rdepends"
;;
xbps)
CMD="xbps-query -X"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -76,6 +76,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig"
;;
VoidLinux)
CMD="runit"
;;
Slackware)
CMD="service-initd"
;;
......@@ -106,6 +109,7 @@ ANYSERVICE=$(which anyservice 2>/dev/null)
is_anyservice()
{
[ -n "$ANYSERVICE" ] || return
[ -n "$1" ] || return
# check if anyservice is exists and checkd returns true
$ANYSERVICE "$1" checkd 2>/dev/null
}
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -40,6 +40,9 @@ serv_common()
sudocmd systemctl "$@" $SERVICE
fi
;;
runit)
sudocmd sv $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -26,7 +26,7 @@ serv_disable()
local SERVICE="$1"
is_service_running $1 && { serv_stop $1 || return ; }
is_service_autostart $1 || { echo "Service $1 already disabled for startup" && return ; }
is_service_autostart $1 || { info "Service $1 already disabled for startup" && return ; }
case $SERVICETYPE in
service-chkconfig|service-upstart)
......@@ -42,6 +42,9 @@ serv_disable()
systemd)
sudocmd systemctl disable $1
;;
runit)
sudocmd rm -fv /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -25,7 +25,7 @@ __serv_enable()
{
local SERVICE="$1"
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
is_service_autostart $1 && info "Service $1 is already enabled for startup" && return
case $SERVICETYPE in
service-chkconfig)
......@@ -46,6 +46,11 @@ __serv_enable()
systemd)
sudocmd systemctl enable $1
;;
runit)
epm assure $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
sudocmd ln -s /etc/sv/$SERVICE /var/service/
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -57,5 +62,6 @@ serv_enable()
{
__serv_enable "$1" || return
# start if need
is_service_running $1 || serv_start $1 || return
is_service_running $1 && info "Service $1 is already running" && return
serv_start $1
}
......@@ -40,7 +40,9 @@ serv_reload()
sudocmd systemctl reload $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
info "Fallback to restart..."
load_helper serv-restart
serv_restart "$SERVICE" "$@"
;;
esac
}
......@@ -39,6 +39,9 @@ serv_restart()
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
runit)
sudocmd sv restart "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -37,6 +37,9 @@ serv_start()
systemd)
sudocmd systemctl start "$SERVICE" "$@"
;;
runit)
sudocmd sv up "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -36,6 +36,9 @@ is_service_running()
systemd)
$SUDO systemctl status $1 >/dev/null
;;
runit)
$SUDO sv status "$SERVICE" >/dev/null
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -63,6 +66,9 @@ is_service_autostart()
systemd)
$SUDO systemctl is-enabled $1
;;
runit)
test -L /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -90,6 +96,9 @@ serv_status()
systemd)
sudocmd systemctl status $SERVICE "$@"
;;
runit)
sudocmd sv status "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -37,6 +37,9 @@ serv_stop()
systemd)
sudocmd systemctl stop $SERVICE "$@"
;;
runit)
sudocmd sv down "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 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
......@@ -26,19 +26,14 @@ serv_try_restart()
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $SERVICE || return 0
docmd serv $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $SERVICE || return 0
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
info "Fallback to restart..."
is_service_running $SERVICE || { info "Service $SERVICE is not running, restart skipping…" ; return 0 ; }
load_helper serv-restart
serv_restart "$SERVICE" "$@"
;;
esac
}
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.9.1
Version: 1.9.3
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,24 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Thu Aug 18 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.1-alt0.M80P.1
* Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3-alt1
- implement cross install for rpm and deb packages
- serv: add runit support (Void Linux)
- serv-reload: add fallback via restart
- serv-try_restart: add fallback via restart
- small fixes
* Tue Aug 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.2-alt1
- add Void Linux initial support
- addrepo/removerepo: fix used repo id string
- release-upgrade: fix direct apt-repo
- epm install: disable optimize when install foreign packages
- serv: more verbose
- rewrite query and packages
* Thu Aug 18 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.1-alt1
- upgrade: add --auto support for apt and yum/dnf
- serv: add reload command support
......
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