Commit cd35c5e9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p7 as 1.9.8-alt0.M70P.1 (with rpmbph script)

parents e8e5c0b7 d8814981
...@@ -6,14 +6,15 @@ instpkgdatadir=$(pkgdatadir) ...@@ -6,14 +6,15 @@ instpkgdatadir=$(pkgdatadir)
install: install:
mkdir -p $(DESTDIR)$(bindir)/ mkdir -p $(DESTDIR)$(bindir)/
# breaks link # breaks link
#install -m 755 `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/ cp -a `ls -1 bin/* | grep -v "[-_]"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/ cp -a bin/distr_info $(DESTDIR)$(bindir)/
chmod 0755 $(DESTDIR)$(bindir)/* chmod 0755 $(DESTDIR)$(bindir)/*
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/epm >$(DESTDIR)$(bindir)/epm sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/epm >$(DESTDIR)$(bindir)/epm
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/serv >$(DESTDIR)$(bindir)/serv sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/serv >$(DESTDIR)$(bindir)/serv
mkdir -p $(DESTDIR)$(pkgdatadir)/ mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "-"` $(DESTDIR)$(pkgdatadir)/ install -m 644 `ls -1 bin/* | grep "[-_]"` $(DESTDIR)$(pkgdatadir)/
rm -f $(DESTDIR)$(pkgdatadir)/distr_info
mkdir -p $(DESTDIR)$(mandir)/man1 mkdir -p $(DESTDIR)$(mandir)/man1
cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man1/ cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man1/
...@@ -37,7 +37,12 @@ Note: epm is placed as /usr/bin/epm ...@@ -37,7 +37,12 @@ Note: epm is placed as /usr/bin/epm
$ rpm -qf /usr/bin/epm $ rpm -qf /usr/bin/epm
eepm-1.1.0-alt2 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 See detailed description in russian at
http://wiki.etersoft.ru/Epm http://wiki.etersoft.ru/Epm
......
/etc/eepm.conf конфиг
FIXME: epm-install need realpath, missed on some systems FIXME: epm-install need realpath, missed on some systems
[18:21:12] <danil> Вот так можно: [18:21:12] <danil> Вот так можно:
......
#!/bin/sh #!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012 (c) Etersoft # 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007 Public domain # 2007-2016 Public domain
# Detect the distro and version # Detect the distro and version
# Welcome to send updates! # Welcome to send updates!
...@@ -32,6 +32,7 @@ rpmvendor() ...@@ -32,6 +32,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return [ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return [ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return [ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]" echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
} }
...@@ -55,6 +56,7 @@ pkgtype() ...@@ -55,6 +56,7 @@ pkgtype()
android) echo "apk" ;; android) echo "apk" ;;
alpine) echo "apk" ;; alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;; tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
cygwin) echo "tar.xz" ;; cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;; debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles) alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
...@@ -114,10 +116,6 @@ if distro altlinux-release ; then ...@@ -114,10 +116,6 @@ if distro altlinux-release ; then
elif has Citron ; then DISTRIB_RELEASE="2.4" elif has Citron ; then DISTRIB_RELEASE="2.4"
fi fi
elif [ `uname -o` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
elif distro gentoo-release ; then elif distro gentoo-release ; then
DISTRIB_ID="Gentoo" DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile) MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
...@@ -147,6 +145,11 @@ elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then ...@@ -147,6 +145,11 @@ elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
DISTRIB_ID="TinyCoreLinux" DISTRIB_ID="TinyCoreLinux"
DISTRIB_RELEASE="$VERSION_ID" 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 elif distro arch-release ; then
DISTRIB_ID="ArchLinux" DISTRIB_ID="ArchLinux"
DISTRIB_RELEASE="2010" DISTRIB_RELEASE="2010"
...@@ -274,7 +277,7 @@ elif [ `uname` = "SunOS" ] ; then ...@@ -274,7 +277,7 @@ elif [ `uname` = "SunOS" ] ; then
DISTRIB_RELEASE=$(uname -r) DISTRIB_RELEASE=$(uname -r)
# fixme: can we detect by some file? # fixme: can we detect by some file?
elif [ `uname` = "Darwin" ] ; then elif [ `uname -s 2>/dev/null` = "Darwin" ] ; then
DISTRIB_ID="MacOS" DISTRIB_ID="MacOS"
DISTRIB_RELEASE=$(uname -r) DISTRIB_RELEASE=$(uname -r)
...@@ -288,6 +291,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then ...@@ -288,6 +291,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
DISTRIB_ID="Android" DISTRIB_ID="Android"
DISTRIB_RELEASE=$(getprop | awk -F": " '/build.version.release/ { print $2 }' | tr -d '[]') DISTRIB_RELEASE=$(getprop | awk -F": " '/build.version.release/ { print $2 }' | tr -d '[]')
elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
# try use standart LSB info by default # try use standart LSB info by default
elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB # use LSB
...@@ -333,7 +340,7 @@ case $1 in ...@@ -333,7 +340,7 @@ case $1 in
exit 0 exit 0
;; ;;
-V) -V)
echo "20120519" echo "20160822"
exit 0 exit 0
;; ;;
*) *)
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2014 Etersoft # Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -17,10 +17,12 @@ ...@@ -17,10 +17,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
PROGDIR=$(dirname $0) PROGDIR=$(dirname "$0")
PROGNAME=$(basename "$0")
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd) [ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
PROGDIR="" PROGDIR=""
PROGNAME=""
fi fi
# will replaced to /usr/share/eepm during install # will replaced to /usr/share/eepm during install
...@@ -89,9 +91,7 @@ pkg_names= ...@@ -89,9 +91,7 @@ pkg_names=
pkg_urls= pkg_urls=
quoted_args= quoted_args=
progname="${0##*/}" case $PROGNAME in
case $progname in
epmi) epmi)
epm_cmd=install epm_cmd=install
;; ;;
...@@ -136,12 +136,17 @@ case $progname in ...@@ -136,12 +136,17 @@ case $progname in
;; ;;
epm|upm|eepm) epm|upm|eepm)
;; ;;
epm.sh)
;;
*) *)
# epm by default # epm by default
# fatal "Unknown command: $progname" # fatal "Unknown command: $progname"
;; ;;
esac esac
# was called with alias name
[ -n "$epm_cmd" ] && PROGNAME="epm"
check_command() check_command()
{ {
# do not override command # do not override command
...@@ -240,6 +245,9 @@ check_command() ...@@ -240,6 +245,9 @@ check_command()
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
epm_cmd=kernel_update epm_cmd=kernel_update
;; ;;
remove-old-kernels|remove-old-kernel) # HELPCMD: remove old system kernels (exclude current or last two kernels)
epm_cmd=remove_old_kernels
;;
# Other commands # Other commands
clean) # HELPCMD: clean local package cache clean) # HELPCMD: clean local package cache
...@@ -275,7 +283,7 @@ check_command() ...@@ -275,7 +283,7 @@ check_command()
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site) site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd=site epm_cmd=site
;; ;;
ei|epminstall|selfinstall) # HELPCMD: install or update eepm from all in one script ei|epminstall|epm-install|selfinstall) # HELPCMD: install or update eepm from all in one script
epm_cmd=epm_install epm_cmd=epm_install
;; ;;
print) # HELPCMD: print various info, run epm print help for details print) # HELPCMD: print various info, run epm print help for details
...@@ -394,7 +402,7 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") ...@@ -394,7 +402,7 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
if [ -z "$epm_cmd" ] ; then if [ -z "$epm_cmd" ] ; then
print_version print_version
echo echo
fatal "Run $ $progname --help for get help" fatal "Unknown command $@. Run $ $PROGNAME --help for get help"
fi fi
# Use eatmydata for write specific operations # Use eatmydata for write specific operations
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -19,26 +19,27 @@ ...@@ -19,26 +19,27 @@
epm_addrepo() epm_addrepo()
{ {
local repo="$(eval echo $quoted_args)"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo add "$pkg_filenames" sudocmd apt-repo add "$repo"
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list" info "You need manually add repo to /etc/apt/sources.list"
;; ;;
yum-rpm) yum-rpm)
assure_exists yum-utils assure_exists yum-utils
sudocmd yum-config-manager --add-repo "$pkg_filenames" sudocmd yum-config-manager --add-repo "$repo"
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.addmedia "$pkg_filenames" sudocmd urpmi.addmedia "$repo"
;; ;;
zypper-rpm) zypper-rpm)
sudocmd zypper ar "$pkg_filenames" sudocmd zypper ar "$repo"
;; ;;
emerge) emerge)
sudocmd layman -a $"pkg_filenames" sudocmd layman -a "$repo"
;; ;;
pacman) pacman)
info "You need manually add repo to /etc/pacman.conf" info "You need manually add repo to /etc/pacman.conf"
...@@ -46,7 +47,7 @@ case $PMTYPE in ...@@ -46,7 +47,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames #sudocmd repo-add $pkg_filenames
;; ;;
npackd) npackd)
sudocmd npackdcl add-repo --url="$pkg_filenames" sudocmd npackdcl add-repo --url="$repo"
;; ;;
slackpkg) slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors" info "You need manually add repo to /etc/slackpkg/mirrors"
......
...@@ -43,24 +43,25 @@ case $PMTYPE in ...@@ -43,24 +43,25 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
assure_exists deborphan assure_exists deborphan
showcmd deborphan showcmd deborphan
a= deborphan | sudocmd epm remove a= deborphan | docmd epm remove
;; ;;
#aura) #aura)
# sudocmd aura -Oj # sudocmd aura -Oj
# ;; # ;;
yum-rpm) yum-rpm)
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans | grep -v "^eepm$") local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST docmd epm remove $PKGLIST
;; ;;
dnf-rpm) dnf-rpm)
# TODO: dnf list extras # TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead.
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans | grep -v "^eepm$") local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST docmd epm remove $PKGLIST
;; ;;
urpm-rpm) urpm-rpm)
showcmd urpmq --auto-orphans showcmd urpme --report-orphans
sudocmd urpme --auto-orphans sudocmd urpme --auto-orphans
;; ;;
#emerge) #emerge)
...@@ -81,9 +82,18 @@ case $PMTYPE in ...@@ -81,9 +82,18 @@ case $PMTYPE in
#pkgng) #pkgng)
# sudocmd pkg autoremove # sudocmd pkg autoremove
# ;; # ;;
#zypper-rpm) zypper-rpm)
# sudocmd zypper clean # https://www.linux.org.ru/forum/desktop/11931830
# ;; assure_exists zypper zypper 1.9.2
# For zypper < 1.9.2: zypper se -si | grep 'System Packages'
sudocmd zypper packages --orphaned
# FIXME: x86_64/i586 are duplicated
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" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -24,7 +24,8 @@ __epm_autoremove_altrpm() ...@@ -24,7 +24,8 @@ __epm_autoremove_altrpm()
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
info info
info "Removing all non -devel/-debuginfo libs packages not need by anything..." info "Removing all non -devel/-debuginfo libs packages not need by anything..."
[ -n "$force" ] || info "You can run with --force for more deep removing" #[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force
local flag= local flag=
local libexclude='^lib' local libexclude='^lib'
...@@ -34,9 +35,9 @@ __epm_autoremove_altrpm() ...@@ -34,9 +35,9 @@ __epm_autoremove_altrpm()
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\"" showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \ pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \
| grep -E -v -- "-(devel|debuginfo)$" \ | grep -E -v -- "-(devel|debuginfo)$" \
| grep -E -v -- "-(util|tool|plugin|daemon)" \ | grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| sed -e "s/\.32bit$//g" \ | sed -e "s/\.32bit$//g" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|eepm)" ) | grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|eepm)" )
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1 [ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
info "Removing unused python/perl modules..." info "Removing unused python/perl modules..."
...@@ -64,13 +65,12 @@ epm_autoremove() ...@@ -64,13 +65,12 @@ epm_autoremove()
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__epm_autoremove_altrpm __epm_autoremove_altrpm
docmd epm remove-old-kernels
assure_exists remove-old-kernels update-kernel 0.9.9
sudocmd remove-old-kernels
if which nvidia-clean-driver 2>/dev/null ; then if which nvidia-clean-driver 2>/dev/null ; then
sudocmd nvidia-clean-driver sudocmd nvidia-clean-driver
fi fi
return return
;; ;;
*) *)
...@@ -89,7 +89,7 @@ case $PMTYPE in ...@@ -89,7 +89,7 @@ case $PMTYPE in
while true ; do while true ; do
docmd package-cleanup --leaves $(subst_option non_interactive --assumeyes) docmd package-cleanup --leaves $(subst_option non_interactive --assumeyes)
# FIXME: package-cleanup have to use stderr for errors # FIXME: package-cleanup have to use stderr for errors
local PKGLIST=$(package-cleanup --leaves | grep -v "Loaded plugins" | grep -v "Unable to" | grep -v "^eepm$") local PKGLIST=$(package-cleanup -q --leaves | grep -v "^eepm-")
[ -n "$PKGLIST" ] || break [ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST sudocmd yum remove $PKGLIST
done done
...@@ -120,9 +120,17 @@ case $PMTYPE in ...@@ -120,9 +120,17 @@ case $PMTYPE in
pkgng) pkgng)
sudocmd pkg autoremove sudocmd pkg autoremove
;; ;;
#zypper-rpm) zypper-rpm)
# sudocmd zypper clean # https://www.linux.org.ru/forum/desktop/11931830
# ;; assure_exists zypper zypper 1.9.3
sudocmd zypper packages --unneeded
# FIXME: x86_64/i586 are duplicated
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" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -85,9 +85,9 @@ __epm_changelog_unlocal_names() ...@@ -85,9 +85,9 @@ __epm_changelog_unlocal_names()
#yum-rpm) #yum-rpm)
# sudocmd yum clean all # sudocmd yum clean all
# ;; # ;;
#urpm-rpm) urpm-rpm)
# sudocmd urpmi --clean docmd urpmq --changelog $@ | less
# ;; ;;
#zypper-rpm) #zypper-rpm)
# sudocmd zypper clean # sudocmd zypper clean
# ;; # ;;
......
...@@ -28,11 +28,11 @@ case $PMTYPE in ...@@ -28,11 +28,11 @@ case $PMTYPE in
apt-dpkg) apt-dpkg)
#sudocmd apt-get update || exit #sudocmd apt-get update || exit
#sudocmd apt-get check || exit #sudocmd apt-get check || exit
sudocmd apt-get -f install || exit sudocmd apt-get -f install || return
sudocmd apt-get autoremove sudocmd apt-get autoremove
;; ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude -f install || exit sudocmd aptitude -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
yum-rpm) yum-rpm)
...@@ -60,7 +60,7 @@ case $PMTYPE in ...@@ -60,7 +60,7 @@ case $PMTYPE in
sudocmd pkg check -d -a sudocmd pkg check -d -a
;; ;;
homebrew) homebrew)
sudocmd brew doctor docmd brew doctor
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2009, 2012, 2013, 2014 Etersoft # Copyright (C) 2009, 2012, 2013, 2014, 2016 Etersoft
# Copyright (C) 2009, 2012, 2013, 2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2009, 2012, 2013, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -75,14 +75,30 @@ esac ...@@ -75,14 +75,30 @@ esac
epm_checkpkg() epm_checkpkg()
{ {
if [ -n "$pkg_names" ] ; then if [ -n "$pkg_names" ] ; then
# TODO: если есть / или расширение, это отсутствующий файл
info "Suggest $pkg_names are name(s) of installed packages" info "Suggest $pkg_names are name(s) of installed packages"
__epm_check_installed_pkg $pkg_names __epm_check_installed_pkg $pkg_names
return return
fi fi
# if possible, it will put pkg_urls into pkg_files or pkg_names
if [ -n "$pkg_urls" ] ; then
load_helper epm-download
__handle_pkg_urls_to_checking
fi
[ -n "$pkg_files" ] || fatal "Checkpkg: missing file or package name(s)" [ -n "$pkg_files" ] || fatal "Checkpkg: missing file or package name(s)"
local RETVAL=0
local pkg local pkg
for pkg in $pkg_files ; do for pkg in $pkg_files ; do
check_pkg_integrity $pkg || fatal "Broken package $pkg" check_pkg_integrity $pkg || RETVAL=1
done done
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
#fatal "Broken package $pkg"
return $RETVAL
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014 Etersoft # Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -43,15 +43,15 @@ epm_clean() ...@@ -43,15 +43,15 @@ epm_clean()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
sudocmd apt-get clean sudocmd apt-get clean
__remove_alt_apt_cache_file [ -n "$force" ] && __remove_alt_apt_cache_file
;; ;;
apt-dpkg) apt-dpkg)
sudocmd apt-get clean sudocmd apt-get clean
__remove_deb_apt_cache_file [ -n "$force" ] && __remove_deb_apt_cache_file
;; ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude clean sudocmd aptitude clean
__remove_deb_apt_cache_file [ -n "$force" ] && __remove_deb_apt_cache_file
;; ;;
yum-rpm) yum-rpm)
sudocmd yum clean all sudocmd yum clean all
...@@ -77,6 +77,9 @@ case $PMTYPE in ...@@ -77,6 +77,9 @@ case $PMTYPE in
pkgng) pkgng)
sudocmd pkg clean -a sudocmd pkg clean -a
;; ;;
xbps)
sudocmd xbps-remove -O
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -90,10 +90,18 @@ epm_downgrade() ...@@ -90,10 +90,18 @@ epm_downgrade()
;; ;;
yum-rpm) yum-rpm)
# can do update repobase automagically # can do update repobase automagically
sudocmd yum downgrade $pkg_filenames if [ -n "$pkg_filenames" ] ; then
sudocmd yum downgrade $pkg_filenames
else
sudocmd yum distro-sync
fi
;; ;;
dnf-rpm) dnf-rpm)
sudocmd dnf downgrade $pkg_filenames if [ -n "$pkg_filenames" ] ; then
sudocmd dnf downgrade $pkg_filenames
else
sudocmd dnf distro-sync
fi
;; ;;
urpm-rpm) urpm-rpm)
assure_exists urpm-reposync urpm-tools assure_exists urpm-reposync urpm-tools
......
...@@ -17,6 +17,88 @@ ...@@ -17,6 +17,88 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
__use_url_install()
{
case $PMTYPE in
apt-rpm)
# ALT Linux really?
pkg_names="$pkg_names $pkg_urls"
;;
#deepsolver-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
#urpm-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
pacman)
pkg_names="$pkg_names $pkg_urls"
;;
yum-rpm|dnf-rpm)
pkg_names="$pkg_names $pkg_urls"
;;
#zypper-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
*)
return 1
;;
esac
return 0
}
# for download before install / checking
__download_pkg_urls()
{
local url
[ -z "$pkg_urls" ] && return
for url in $pkg_urls ; do
# TODO: use some individual tmp dir
local new_file=/tmp/$(basename "$url")
if eget -O $new_file $url && [ -s "$new_file" ] ; then
pkg_files="$pkg_files $new_file"
to_remove_pkg_files="$to_remove_pkg_files $new_file"
else
warning "Failed to download $url, ignoring"
fi
done
}
# NOTE: call __clean_downloaded_pkg_files after
__handle_pkg_urls_to_install()
{
#[ -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=
}
__handle_pkg_urls_to_checking()
{
#[ -n "$pkg_urls" ] || return
# TODO: do it correctly
to_remove_pkg_files=
# use workaround with eget: download and put in pkg_files
__download_pkg_urls
pkg_urls=
}
#__clean_downloaded_pkg_files()
#{
# [ -z "$to_remove_pkg_files" ] && return
# rm -fv $to_remove_pkg_files
#}
epm_download() epm_download()
{ {
local CMD local CMD
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Copyright (C) 2016 Etersoft # Copyright (C) 2016 Etersoft
# Copyright (C) 2016 Danil Mikhailov <danil@etersoft.ru> # Copyright (C) 2016 Danil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -17,20 +18,13 @@ ...@@ -17,20 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
myinit(){ load_helper epm-install
etersoft_updates_site="http://updates.etersoft.ru/pub/Etersoft/Sisyphus/$($DISTRVENDOR -e)/"
download_dir="/tmp"
}
download_epm(){
download_link=$etersoft_updates_site$(wget -qO- $etersoft_updates_site/ | grep -m1 -Eo "eepm[^\"]+\.$($DISTRVENDOR -p)" | tail -n1) #"
eepm_package="$download_dir/$(basename $download_link)"
wget -O $eepm_package $download_link
}
epm_epm_install(){ epm_epm_install(){
myinit assure_exists wget
download_epm || fatal "Error. Check download link: $download_link" local etersoft_updates_site="http://updates.etersoft.ru/pub/Korinf/$($DISTRVENDOR -e)"
epm i $eepm_package || fatal # FIXME: some way to get latest package
rm -fv $eepm_package local download_link=$etersoft_updates_site/$(wget -qO- $etersoft_updates_site/ | grep -m1 -Eo "eepm[^\"]+\.$($DISTRVENDOR -p)" | tail -n1) #"
pkg_names= pkg_files= pkg_urls=$download_link epm_install
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2015 Etersoft # Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2015 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -28,6 +28,7 @@ __alt_local_content_filelist() ...@@ -28,6 +28,7 @@ __alt_local_content_filelist()
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)" local CI="$(get_local_alt_contents_index)"
[ -n "$CI" ] || fatal "Have no local contents index"
# TODO: safe way to use less # TODO: safe way to use less
#local OUTCMD="less" #local OUTCMD="less"
...@@ -35,7 +36,7 @@ __alt_local_content_filelist() ...@@ -35,7 +36,7 @@ __alt_local_content_filelist()
OUTCMD="cat" OUTCMD="cat"
{ {
[ -n "$USETTY" ] && echo "Search in $CI for $1..." [ -n "$USETTY" ] && info "Search in $CI for $1..."
grep -h -- ".*$1$" $CI | sed -e "s|\(.*\)\t\(.*\)|\1|g" grep -h -- ".*$1$" $CI | sed -e "s|\(.*\)\t\(.*\)|\1|g"
} | $OUTCMD } | $OUTCMD
} }
...@@ -119,9 +120,15 @@ __epm_filelist_name() ...@@ -119,9 +120,15 @@ __epm_filelist_name()
assure_exists equery assure_exists equery
CMD="equery files" CMD="equery files"
;; ;;
homebrew)
CMD="brew list"
;;
pkgng) pkgng)
CMD="pkg info -l" CMD="pkg info -l"
;; ;;
xbps)
CMD="xbps-query -f"
;;
aptcyg) aptcyg)
docmd apt-cyg listfiles $@ | sed -e "s|^|/|g" docmd apt-cyg listfiles $@ | sed -e "s|^|/|g"
return return
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014 Etersoft # Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -59,6 +59,10 @@ case $PMTYPE in ...@@ -59,6 +59,10 @@ case $PMTYPE in
__epm_info_rpm_low && return __epm_info_rpm_low && return
docmd yum info $pkg_names docmd yum info $pkg_names
;; ;;
urpmi-rpm)
__epm_info_rpm_low && return
docmd urpmq -i $pkg_names
;;
dnf-rpm) dnf-rpm)
__epm_info_rpm_low && return __epm_info_rpm_low && return
docmd dnf info $pkg_names docmd dnf info $pkg_names
...@@ -99,6 +103,9 @@ case $PMTYPE in ...@@ -99,6 +103,9 @@ case $PMTYPE in
pkgng) pkgng)
docmd pkg info $pkg_names docmd pkg info $pkg_names
;; ;;
xbps)
docmd xbps-query --show $pkg_names
;;
homebrew) homebrew)
docmd brew info $pkg_names docmd brew info $pkg_names
;; ;;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-assure
load_helper epm-check_updated_repo load_helper epm-check_updated_repo
# TODO: use when run install with epm --skip-installed install # TODO: use when run install with epm --skip-installed install
...@@ -81,15 +82,6 @@ __separate_sudocmd() ...@@ -81,15 +82,6 @@ __separate_sudocmd()
return 0 return 0
} }
download_pkg_urls()
{
local url
[ -z "$1" ] && return
for url in $* ; do
eget $url || warning "Skipped"
done
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
...@@ -154,7 +146,7 @@ epm_install_names() ...@@ -154,7 +146,7 @@ epm_install_names()
return ;; return ;;
homebrew) homebrew)
# FIXME: sudo and quote # FIXME: sudo and quote
__separate_sudocmd "brew install" "brew upgrade" $@ SUDO= __separate_sudocmd "brew install" "brew upgrade" $@
return ;; return ;;
ipkg) ipkg)
[ -n "$force" ] && force=-force-depends [ -n "$force" ] && force=-force-depends
...@@ -178,6 +170,9 @@ epm_install_names() ...@@ -178,6 +170,9 @@ epm_install_names()
aptcyg) aptcyg)
sudocmd apt-cyg install $@ sudocmd apt-cyg install $@
return ;; return ;;
xbps)
sudocmd xbps-install $@
return ;;
*) *)
fatal "Have no suitable install command for $PMTYPE" fatal "Have no suitable install command for $PMTYPE"
;; ;;
...@@ -194,7 +189,7 @@ epm_ni_install_names() ...@@ -194,7 +189,7 @@ epm_ni_install_names()
sudocmd apt-get -y $noremove --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $APTOPTIONS install $@ sudocmd apt-get -y $noremove --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $APTOPTIONS install $@
return ;; return ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitde -y install $@ sudocmd aptitude -y install $@
return ;; return ;;
yum-rpm) yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@ sudocmd yum -y $YUMOPTIONS install $@
...@@ -243,6 +238,13 @@ epm_ni_install_names() ...@@ -243,6 +238,13 @@ epm_ni_install_names()
tce) tce)
sudocmd tce-load -wi $@ sudocmd tce-load -wi $@
return ;; return ;;
xbps)
sudocmd xbps-install -y $@
return ;;
homebrew)
# FIXME: sudo and quote
SUDO= __separate_sudocmd "brew install" "brew upgrade" $@
return ;;
#android) #android)
# sudocmd pm install $@ # sudocmd pm install $@
# return ;; # return ;;
...@@ -279,8 +281,11 @@ __epm_check_if_try_install_deb() ...@@ -279,8 +281,11 @@ __epm_check_if_try_install_deb()
local TDIR=$(mktemp -d) local TDIR=$(mktemp -d)
cd $TDIR cd $TDIR
for pkg in $debpkgs ; do for pkg in $debpkgs ; do
showcmd alien -r -k --scripts "$pkg" # TODO: fakeroot for non ALT?
# TODO: need check for return status 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 done
rm -f $TDIR/* rm -f $TDIR/*
rmdir $TDIR/ rmdir $TDIR/
...@@ -301,12 +306,16 @@ __epm_check_if_try_install_rpm() ...@@ -301,12 +306,16 @@ __epm_check_if_try_install_rpm()
[ -n "$rpmpkgs" ] || return 1 [ -n "$rpmpkgs" ] || return 1
assure_exists alien assure_exists alien
assure_exists fakeroot
local TDIR=$(mktemp -d) local TDIR=$(mktemp -d)
cd $TDIR cd $TDIR
for pkg in $rpmpkgs ; do for pkg in $rpmpkgs ; do
showcmd alien -d -k --scripts "$pkg" showcmd_store_output fakeroot alien -d -k --scripts "$pkg"
# TODO: need check for return status clean_store_output
local DEBCONVERTED=$(grep "deb generated" $RC_STDOUT | sed -e "s| generated||g")
clean_store_output
epm install $DEBCONVERTED
done done
rm -f $TDIR/* rm -f $TDIR/*
rmdir $TDIR/ rmdir $TDIR/
...@@ -327,13 +336,16 @@ epm_install_files() ...@@ -327,13 +336,16 @@ epm_install_files()
apt-rpm) apt-rpm)
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return # do not use low-level for install by file path
local RES=$? if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
sudocmd rpm -Uvh $force $nodeps $@ && return
__epm_check_if_rpm_already_installed $@ && 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 # if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES [ -n "$nodeps" ] && return $RES
fi
# use install_names # use install_names
;; ;;
...@@ -480,6 +492,14 @@ epm_print_install_command() ...@@ -480,6 +492,14 @@ epm_print_install_command()
tce) tce)
echo "tce-load -wi $@" echo "tce-load -wi $@"
;; ;;
xbps)
echo "xbps-install -y $@"
;;
homebrew)
# FIXME: sudo and quote
echo "brew install $@"
;;
*) *)
fatal "Have no suitable appropriate install command for $PMTYPE" fatal "Have no suitable appropriate install command for $PMTYPE"
;; ;;
...@@ -494,19 +514,16 @@ epm_install() ...@@ -494,19 +514,16 @@ epm_install()
return return
fi fi
# Download urls via eget pkg_urls and use eget # if possible, it will put pkg_urls into pkg_files or pkg_names
# TODO: use optimization (rpm can download packages by url, yum too?) if [ -n "$pkg_urls" ] ; then
#[ -n "$pkg_urls" ] && warning "URL using does not realize yet" load_helper epm-download
#download_pkg_urls "$pkg_urls" __handle_pkg_urls_to_install
# temp. hack fi
pkg_files="$pkg_files $pkg_urls"
# TODO: add downloaded files to $pkg_files
[ -z "$pkg_files$pkg_names$pkg_urls" ] && info "Skip empty install list" && return 22 [ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22
local names="$(echo $pkg_names | filter_out_installed_packages)" local names="$(echo $pkg_names | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)" local files="$(echo $pkg_files | filter_out_installed_packages)"
local urls="$(echo $pkg_urls | filter_out_installed_packages)"
[ -z "$files$names" ] && info "Skip empty install list" && return 22 [ -z "$files$names" ] && info "Skip empty install list" && return 22
...@@ -517,4 +534,10 @@ epm_install() ...@@ -517,4 +534,10 @@ epm_install()
epm_install_names $names || return epm_install_names $names || return
epm_install_files $files epm_install_files $files
local RETVAL=$?
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
return $RETVAL
} }
...@@ -30,7 +30,7 @@ epm_kernel_update() ...@@ -30,7 +30,7 @@ epm_kernel_update()
fi fi
assure_exists update-kernel update-kernel 0.9.9 assure_exists update-kernel update-kernel 0.9.9
sudocmd update-kernel $pkg_filenames || return sudocmd update-kernel $pkg_filenames || return
sudocmd remove-old-kernels $pkg_filenames docmd epm remove-old-kernels $pkg_filenames || fatal
return ;; return ;;
esac esac
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -41,6 +41,11 @@ __aptcyg_print_full() ...@@ -41,6 +41,11 @@ __aptcyg_print_full()
echo "$1-$VERSION" echo "$1-$VERSION"
} }
__fo_pfn()
{
grep -v "^$" | grep -- "$pkg_filenames"
}
# TODO: we have a problem with error status here # TODO: we have a problem with error status here
epm_packages() epm_packages()
{ {
...@@ -49,23 +54,28 @@ epm_packages() ...@@ -49,23 +54,28 @@ epm_packages()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
;; docmd $CMD
return ;;
*-dpkg) *-dpkg)
# FIXME: strong equal
#CMD="dpkg -l $pkg_filenames" #CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $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" [ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
docmd $CMD | grep "^i" | sed -e "s|.* ||g" showcmd $CMD
return $CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
;; return ;;
snappy) snappy)
CMD="snappy info" CMD="snappy info"
;; ;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
;; docmd $CMD
return ;;
emerge) emerge)
CMD="qlist -I -C" CMD="qlist -I -C"
# print with colors for console output # print with colors for console output
...@@ -73,26 +83,27 @@ case $PMTYPE in ...@@ -73,26 +83,27 @@ case $PMTYPE in
;; ;;
pkgsrc) pkgsrc)
CMD="pkg_info" CMD="pkg_info"
docmd $CMD | sed -e "s| .*||g" showcmd $CMD
return $CMD | sed -e "s| .*||g" | __fo_pfn
;; return ;;
pkgng) pkgng)
if [ -n "$pkg_filenames" ] ; then if [ -n "$pkg_filenames" ] ; then
CMD="pkg info -E $pkg_filenames" CMD="pkg info -E $pkg_filenames"
else else
CMD="pkg info" CMD="pkg info"
fi fi
showcmd $CMD
if [ -n "$short" ] ; then 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 else
docmd $CMD | sed -e "s| .*||g" $CMD | sed -e "s| .*||g" | __fo_pfn
fi fi
return return ;;
;;
pacman) pacman)
CMD="pacman -Qs $pkg_filenames" CMD="pacman -Qs $pkg_filenames"
showcmd $CMD
if [ -n "$short" ] ; then 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 return
fi fi
;; ;;
...@@ -112,12 +123,12 @@ case $PMTYPE in ...@@ -112,12 +123,12 @@ case $PMTYPE in
# FIXME: does not work for libjpeg-v8a # FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?) # TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack # 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 return
fi fi
;; ;;
homebrew) homebrew)
CMD="brew list $pkg_filenames" docmd brew list | xargs -n1 echo
;; ;;
ipkg) ipkg)
CMD="ipkg list" CMD="ipkg list"
...@@ -131,9 +142,20 @@ case $PMTYPE in ...@@ -131,9 +142,20 @@ case $PMTYPE in
guix) guix)
CMD="guix package -I" 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) android)
CMD="pm list packages" CMD="pm list packages"
docmd $CMD | sed -e "s|^package:||g" showcmd $CMD
$CMD | sed -e "s|^package:||g" | __fo_pfn
return return
;; ;;
aptcyg) aptcyg)
...@@ -152,8 +174,7 @@ case $PMTYPE in ...@@ -152,8 +174,7 @@ case $PMTYPE in
;; ;;
esac esac
docmd $CMD docmd $CMD | __fo_pfn
# FIXME: do not print empty lines, but we will lost error status definitely # FIXME: we print empty lines, but will lost error status
# | grep -v "^$"
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013, 2015 Etersoft # Copyright (C) 2012, 2013, 2015, 2016 Etersoft
# Copyright (C) 2012, 2013, 2015 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2015, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -33,16 +33,18 @@ _get_grep_exp() ...@@ -33,16 +33,18 @@ _get_grep_exp()
# TODO: combine with -qa (the difference only in return status now) # TODO: combine with -qa (the difference only in return status now)
_shortquery_via_packages_list() _shortquery_via_packages_list()
{ {
local res=0 local res=1
local grepexp local grepexp
local firstpkg=$1 local firstpkg=$1
shift shift
grepexp=$(_get_grep_exp $firstpkg) 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$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # 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 local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
...@@ -57,16 +59,19 @@ _shortquery_via_packages_list() ...@@ -57,16 +59,19 @@ _shortquery_via_packages_list()
# TODO: non optimal double epm packages call # TODO: non optimal double epm packages call
_query_via_packages_list() _query_via_packages_list()
{ {
local res=0 local res=1
local grepexp local grepexp
local firstpkg=$1 local firstpkg=$1
shift shift
grepexp=$(_get_grep_exp $firstpkg) 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$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # 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 local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
...@@ -181,7 +186,7 @@ __epm_query_name() ...@@ -181,7 +186,7 @@ __epm_query_name()
CMD="conary query" CMD="conary query"
;; ;;
homebrew) homebrew)
warning "fix query" docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1 return 1
;; ;;
# TODO: need to print name if exists # TODO: need to print name if exists
...@@ -223,7 +228,7 @@ __epm_query_shortname() ...@@ -223,7 +228,7 @@ __epm_query_shortname()
CMD="conary query" CMD="conary query"
;; ;;
homebrew) homebrew)
warning "fix query" docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1 return 1
;; ;;
# TODO: need to print name if exists # TODO: need to print name if exists
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2009, 2012 Etersoft # Copyright (C) 2009, 2012, 2016 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2009, 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -25,7 +25,7 @@ __do_query_real_file() ...@@ -25,7 +25,7 @@ __do_query_real_file()
# get canonical path # get canonical path
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
TOFILE="$1" TOFILE=$(realpath "$1")
else else
TOFILE=$(which "$1" 2>/dev/null || echo "$1") TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then if [ "$TOFILE" != "$1" ] ; then
...@@ -98,6 +98,10 @@ __do_query() ...@@ -98,6 +98,10 @@ __do_query()
ipkg) ipkg)
CMD="ipkg files" CMD="ipkg files"
;; ;;
xbps)
# FIXME: maybe it is search file?
CMD="xbps-query -o"
;;
aptcyg) aptcyg)
#CMD="apt-cyg packageof" #CMD="apt-cyg packageof"
# do not realized locally # do not realized locally
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014 Etersoft # Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -31,6 +31,9 @@ epm_reinstall_names() ...@@ -31,6 +31,9 @@ epm_reinstall_names()
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude reinstall $@ sudocmd aptitude reinstall $@
return ;; return ;;
yum-rpm)
sudocmd yum reinstall $@
return ;;
dnf-rpm) dnf-rpm)
sudocmd dnf reinstall $@ sudocmd dnf reinstall $@
return ;; return ;;
......
...@@ -65,7 +65,7 @@ __replace_alt_version_in_repo() ...@@ -65,7 +65,7 @@ __replace_alt_version_in_repo()
#echo "Upgrading $DISTRNAME from $1 to $2 ..." #echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1" docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
# ask and replace only we will have changes # 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" confirm "Are these correct changes? [y/N]" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g" __replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
fi fi
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2014 Etersoft # Copyright (C) 2012-2014, 2016 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -93,7 +93,7 @@ epm_remove_names() ...@@ -93,7 +93,7 @@ epm_remove_names()
sudocmd snappy uninstall $@ sudocmd snappy uninstall $@
return ;; return ;;
zypper-rpm) zypper-rpm)
sudocmd zypper remove $@ sudocmd zypper remove --clean-deps $@
return ;; return ;;
mpkg) mpkg)
sudocmd mpkg remove $@ sudocmd mpkg remove $@
...@@ -123,11 +123,14 @@ epm_remove_names() ...@@ -123,11 +123,14 @@ epm_remove_names()
sudocmd /usr/sbin/slackpkg remove $@ sudocmd /usr/sbin/slackpkg remove $@
return ;; return ;;
homebrew) homebrew)
sudocmd brew remove $@ docmd brew remove $@
return ;; return ;;
aptcyg) aptcyg)
sudocmd apt-cyg remove $@ sudocmd apt-cyg remove $@
return ;; return ;;
xbps)
sudocmd xbps remove -R $@
return ;;
ipkg) ipkg)
sudocmd ipkg $(subst_option force -force-depends) remove $@ sudocmd ipkg $(subst_option force -force-depends) remove $@
return ;; return ;;
...@@ -160,7 +163,7 @@ epm_remove_nonint() ...@@ -160,7 +163,7 @@ epm_remove_nonint()
sudocmd yum -y remove $@ sudocmd yum -y remove $@
return ;; return ;;
zypper-rpm) zypper-rpm)
sudocmd zypper --non-interactive remove $@ sudocmd zypper --non-interactive remove --clean-deps $@
return ;; return ;;
slackpkg) slackpkg)
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@ sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@
...@@ -171,6 +174,9 @@ epm_remove_nonint() ...@@ -171,6 +174,9 @@ epm_remove_nonint()
ipkg) ipkg)
sudocmd ipkg -force-defaults remove $@ sudocmd ipkg -force-defaults remove $@
return ;; return ;;
xbps)
sudocmd xbps remove -y $@
return ;;
esac esac
return 5 return 5
} }
...@@ -205,6 +211,9 @@ epm_print_remove_command() ...@@ -205,6 +211,9 @@ epm_print_remove_command()
aptcyg) aptcyg)
echo "apt-cyg remove $@" echo "apt-cyg remove $@"
;; ;;
xbps)
echo "xbps remove -y $@"
;;
*) *)
fatal "Have no suitable appropriate remove command for $PMTYPE" fatal "Have no suitable appropriate remove command for $PMTYPE"
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 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
# 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_remove_old_kernels()
{
case $DISTRNAME in
ALTLinux)
load_helper epm-query_package
if ! __epm_query_package kernel-image >/dev/null ; then
info "No installed kernel packages, skipping cleaning"
return
fi
assure_exists update-kernel update-kernel 0.9.9
sudocmd remove-old-kernels $pkg_filenames
return ;;
Ubuntu)
load_helper epm-query_package
if ! __epm_query_package linux-image >/dev/null ; then
info "No installed kernel packages, skipping cleaning"
return
fi
info "Note: it is enough to use eepm autoremove for old kernel removing..."
info "Check also http://ubuntuhandbook.org/index.php/2016/05/remove-old-kernels-ubuntu-16-04/"
# http://www.opennet.ru/tips/2980_ubuntu_apt_clean_kernel_packet.shtml
case $DISTRVERSION in
10.04|12.04|14.04|15.04|15.10)
assure_exists purge-old-kernels bikeshed
;;
*)
# since Ubuntu 16.04
assure_exists purge-old-kernels byobu
;;
esac
sudocmd purge-old-kernels $pkg_filenames
return ;;
Gentoo)
sudocmd emerge -P gentoo-sources
return ;;
VoidLinux)
sudocmd vkpurge rm all
return ;;
esac
case $PMTYPE in
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -19,32 +19,33 @@ ...@@ -19,32 +19,33 @@
epm_removerepo() epm_removerepo()
{ {
local repo="$(eval echo $quoted_args)"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo rm "$quoted_args" sudocmd apt-repo rm "$repo"
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list" info "You need remove repo from /etc/apt/sources.list"
;; ;;
yum-rpm) yum-rpm)
assure_exists yum-utils assure_exists yum-utils
sudocmd yum-config-manager --disable "$pkg_filenames" sudocmd yum-config-manager --disable "$repo"
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.removemedia "$pkg_filenames" sudocmd urpmi.removemedia "$repo"
;; ;;
zypper-rpm) zypper-rpm)
sudocmd zypper removerepo "$pkg_filenames" sudocmd zypper removerepo "$repo"
;; ;;
emerge) emerge)
sudocmd layman "-d$pkg_filenames" sudocmd layman "-d$repo"
;; ;;
pacman) pacman)
info "You need remove repo from /etc/pacman.conf" info "You need remove repo from /etc/pacman.conf"
;; ;;
npackd) npackd)
sudocmd npackdcl remove-repo --url="$pkg_filenames" sudocmd npackdcl remove-repo --url="$repo"
;; ;;
slackpkg) slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors" info "You need remove repo from /etc/slackpkg/mirrors"
......
...@@ -84,14 +84,18 @@ case $PMTYPE in ...@@ -84,14 +84,18 @@ case $PMTYPE in
__fix_apt_sources_list /etc/apt/sources.list __fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list __fix_apt_sources_list /etc/apt/sources.list.d/*.list
docmd apt-repo list docmd apt-repo list
# FIXME: what the best place?
# rebuild rpm database # rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db* #sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb #sudocmd rpm --rebuilddb
;; ;;
yum-rpm|dnf-rpm) yum-rpm|dnf-rpm)
sudocmd rm -fv /var/lib/rpm/__db* # FIXME: what the best place?
sudocmd rpm --rebuilddb #sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
xbps)
sudocmd xbps-pkgdb -a
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -43,7 +43,7 @@ case $PMTYPE in ...@@ -43,7 +43,7 @@ case $PMTYPE in
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
;; ;;
yum-rpm) yum-rpm)
docmd yum repolist docmd yum repolist -v
;; ;;
dnf-rpm) dnf-rpm)
docmd dnf repolist -v docmd dnf repolist -v
...@@ -58,6 +58,9 @@ case $PMTYPE in ...@@ -58,6 +58,9 @@ case $PMTYPE in
docmd eselect profile list docmd eselect profile list
docmd layman -L docmd layman -L
;; ;;
xbps)
docmd xbps-query -L
;;
pacman) pacman)
docmd grep -v -- "^#\|^$" /etc/pacman.conf docmd grep -v -- "^#\|^$" /etc/pacman.conf
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013 Etersoft # Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -63,9 +63,12 @@ case $PMTYPE in ...@@ -63,9 +63,12 @@ case $PMTYPE in
fi fi
;; ;;
urpm-rpm|zypper-rpm) #zypper-rpm)
# FIXME: use hi level commands # # FIXME: use hi level commands
CMD="rpm -q --requires" # CMD="rpm -q --requires"
# ;;
urpm-rpm)
CMD="urpmq --requires"
;; ;;
yum-rpm) yum-rpm)
if is_installed $pkg_names ; then if is_installed $pkg_names ; then
...@@ -102,6 +105,9 @@ case $PMTYPE in ...@@ -102,6 +105,9 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'" #CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d" CMD="pkg info -d"
;; ;;
xbps)
CMD="xbps-query -x"
;;
aptcyg) aptcyg)
#CMD="apt-cyg depends" #CMD="apt-cyg depends"
# print show version # print show version
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2013 Etersoft # Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012,2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -97,6 +97,9 @@ case $PMTYPE in ...@@ -97,6 +97,9 @@ case $PMTYPE in
aptcyg) aptcyg)
CMD="apt-cyg searchall" CMD="apt-cyg searchall"
;; ;;
xbps)
CMD="xbps-query -s"
;;
*) *)
fatal "Have no suitable search command for $PMTYPE" fatal "Have no suitable search command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -22,13 +22,13 @@ __alt_local_content_search() ...@@ -22,13 +22,13 @@ __alt_local_content_search()
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)" local CI="$(get_local_alt_contents_index)"
[ -n "$CI" ] || fatal "Have no local contents index"
#local OUTCMD="less" #local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat" #[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat" OUTCMD="cat"
{ {
[ -n "$USETTY" ] && echo "Search in $CI for $1..." [ -n "$USETTY" ] && info "Search in $CI for $1..."
# note! tabulation below! # note! tabulation below!
grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD } | $OUTCMD
...@@ -73,6 +73,9 @@ case $PMTYPE in ...@@ -73,6 +73,9 @@ case $PMTYPE in
ipkg) ipkg)
CMD="ipkg search" CMD="ipkg search"
;; ;;
xbps)
CMD="xbps-query -Ro"
;;
aptcyg) aptcyg)
docmd apt-cyg searchall $(echo " $pkg_filenames" | sed -e "s| /| |g") docmd apt-cyg searchall $(echo " $pkg_filenames" | sed -e "s| /| |g")
return return
......
...@@ -200,6 +200,12 @@ store_output() ...@@ -200,6 +200,12 @@ store_output()
#return $PIPESTATUS #return $PIPESTATUS
} }
showcmd_store_output()
{
showcmd "$@"
store_output "$@"
}
clean_store_output() clean_store_output()
{ {
rm -f $RC_STDOUT $RC_STDOUT.pipestatus rm -f $RC_STDOUT $RC_STDOUT.pipestatus
...@@ -208,7 +214,8 @@ clean_store_output() ...@@ -208,7 +214,8 @@ clean_store_output()
# run epm, possible from side repo # run epm, possible from side repo
epm() epm()
{ {
$PROGDIR/epm $@ [ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script"
$PROGDIR/$PROGNAME $@
} }
# Print error message and stop the program # Print error message and stop the program
...@@ -264,7 +271,7 @@ set_sudo() ...@@ -264,7 +271,7 @@ set_sudo()
if which sudo >/dev/null 2>/dev/null ; then if which sudo >/dev/null 2>/dev/null ; then
SUDO="sudo --" SUDO="sudo --"
# check for < 1.7 version which do not support -- (and --help possible too) # check for < 1.7 version which do not support -- (and --help possible too)
sudo -h | grep -q " --" || SUDO="sudo" sudo -h 2>/dev/null | grep -q " --" || SUDO="sudo"
return return
fi fi
...@@ -349,7 +356,8 @@ assure_exists() ...@@ -349,7 +356,8 @@ assure_exists()
eget() eget()
{ {
$SHAREDIR/tools-eget "$@" assure_exists wget
$SHAREDIR/tools_eget "$@"
} }
# TODO: improve and drop! # TODO: improve and drop!
...@@ -423,6 +431,8 @@ if [ -n "$FORCEPM" ] ; then ...@@ -423,6 +431,8 @@ if [ -n "$FORCEPM" ] ; then
return return
fi 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 case $DISTRNAME in
ALTLinux) ALTLinux)
CMD="apt-rpm" CMD="apt-rpm"
...@@ -486,6 +496,9 @@ case $DISTRNAME in ...@@ -486,6 +496,9 @@ case $DISTRNAME in
TinyCoreLinux) TinyCoreLinux)
CMD="tce" CMD="tce"
;; ;;
VoidLinux)
CMD="xbps"
;;
*) *)
fatal "Have no suitable DISTRNAME $DISTRNAME" fatal "Have no suitable DISTRNAME $DISTRNAME"
;; ;;
...@@ -503,5 +516,5 @@ is_active_systemd() ...@@ -503,5 +516,5 @@ is_active_systemd()
[ -d "$SYSTEMD_CGROUP_DIR" ] || return [ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack # some hack
pidof systemd >/dev/null ps ax | grep -q '[s]ystemd' | grep -v 'systemd-udev' >/dev/null
} }
...@@ -49,7 +49,7 @@ __query_package_hl_url() ...@@ -49,7 +49,7 @@ __query_package_hl_url()
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs # http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1 epm assure curl || return 1
showcmd curl "$PAOAPI/srpms/$1" showcmd curl "$PAOAPI/srpms/$1"
curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g' a= curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
return 0 return 0
;; ;;
esac esac
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014 Etersoft # Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -26,11 +26,11 @@ epm_update() ...@@ -26,11 +26,11 @@ epm_update()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
sudocmd apt-get update || exit sudocmd apt-get update || return
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
;; ;;
apt-dpkg) apt-dpkg)
sudocmd apt-get update || exit sudocmd apt-get update || return
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
...@@ -38,7 +38,7 @@ case $PMTYPE in ...@@ -38,7 +38,7 @@ case $PMTYPE in
# sudocmd snappy # sudocmd snappy
# ;; # ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude update || exit sudocmd aptitude update || return
;; ;;
yum-rpm) yum-rpm)
info "update command is stubbed for yum" info "update command is stubbed for yum"
...@@ -75,7 +75,7 @@ case $PMTYPE in ...@@ -75,7 +75,7 @@ case $PMTYPE in
sudocmd packdcl detect # get packages from MSI database sudocmd packdcl detect # get packages from MSI database
;; ;;
homebrew) homebrew)
sudocmd brew update docmd brew update
;; ;;
ipkg) ipkg)
sudocmd ipkg update sudocmd ipkg update
...@@ -90,6 +90,9 @@ case $PMTYPE in ...@@ -90,6 +90,9 @@ case $PMTYPE in
aptcyg) aptcyg)
sudocmd apt-cyg update sudocmd apt-cyg update
;; ;;
xbps)
sudocmd xbps-install -S
;;
*) *)
fatal "Have no suitable update command for $PMTYPE" fatal "Have no suitable update command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014 Etersoft # Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -32,26 +32,28 @@ epm_upgrade() ...@@ -32,26 +32,28 @@ epm_upgrade()
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
# non_interactive local APTOPTIONS="$(subst_option non_interactive -y)"
# Функцию добавления параметра при условии # Функцию добавления параметра при условии
CMD="apt-get dist-upgrade $noremove" CMD="apt-get $APTOPTIONS dist-upgrade $noremove"
;; ;;
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude dist-upgrade" CMD="aptitude dist-upgrade"
;; ;;
yum-rpm) yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically # can do update repobase automagically
CMD="yum update" CMD="yum $OPTIONS update"
;; ;;
dnf-rpm) dnf-rpm)
CMD="dnf distro-sync" local OPTIONS="$(subst_option non_interactive -y)"
CMD="dnf $OPTIONS distro-sync"
;; ;;
snappy) snappy)
CMD="snappy update" CMD="snappy update"
;; ;;
urpm-rpm) urpm-rpm)
# or --auto-select --replace-files # or --auto-select --replace-files
CMD="urpmi --auto-update" CMD="urpmi --update --auto-select"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper dist-upgrade" CMD="zypper dist-upgrade"
...@@ -79,7 +81,7 @@ epm_upgrade() ...@@ -79,7 +81,7 @@ epm_upgrade()
;; ;;
homebrew) homebrew)
#CMD="brew upgrade" #CMD="brew upgrade"
sudocmd "brew upgrade `brew outdated`" docmd "brew upgrade `brew outdated`"
return return
;; ;;
ipkg) ipkg)
...@@ -95,6 +97,9 @@ epm_upgrade() ...@@ -95,6 +97,9 @@ epm_upgrade()
docmd_foreach "epm install" $(short=1 epm packages) docmd_foreach "epm install" $(short=1 epm packages)
return return
;; ;;
xbps)
CMD="xbps-install -Su"
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013 Etersoft # Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -40,6 +40,9 @@ case $PMTYPE in ...@@ -40,6 +40,9 @@ case $PMTYPE in
yum-rpm) yum-rpm)
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
urpm-rpm)
CMD="urpmq --whatrequires"
;;
dnf-rpm) dnf-rpm)
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
...@@ -53,6 +56,9 @@ case $PMTYPE in ...@@ -53,6 +56,9 @@ case $PMTYPE in
aptcyg) aptcyg)
CMD="apt-cyg rdepends" CMD="apt-cyg rdepends"
;; ;;
xbps)
CMD="xbps-query -X"
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013 Etersoft # Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -38,6 +38,9 @@ case $PMTYPE in ...@@ -38,6 +38,9 @@ case $PMTYPE in
yum-rpm) yum-rpm)
CMD="yum whatprovides" CMD="yum whatprovides"
;; ;;
urpm-rpm)
CMD="urpmq --whatprovides"
;;
dnf-rpm) dnf-rpm)
CMD="yum provides" CMD="yum provides"
;; ;;
......
...@@ -76,6 +76,9 @@ case $DISTRNAME in ...@@ -76,6 +76,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig" CMD="service-chkconfig"
;; ;;
VoidLinux)
CMD="runit"
;;
Slackware) Slackware)
CMD="service-initd" CMD="service-initd"
;; ;;
...@@ -98,8 +101,18 @@ is_active_systemd && CMD="systemd" ...@@ -98,8 +101,18 @@ is_active_systemd && CMD="systemd"
SERVICETYPE=$CMD SERVICETYPE=$CMD
ANYSERVICE=$(which anyservice 2>/dev/null)
} }
# TODO: done it on anyservice part
is_anyservice()
{
[ -n "$ANYSERVICE" ] || return
[ -n "$1" ] || return
# check if anyservice is exists and checkd returns true
$ANYSERVICE "$1" checkd 2>/dev/null
}
phelp() phelp()
...@@ -117,7 +130,7 @@ $(get_help HELPOPT) ...@@ -117,7 +130,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version @VERSION@" echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016" echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
} }
...@@ -154,7 +167,9 @@ check_command() ...@@ -154,7 +167,9 @@ check_command()
restart) # HELPCMD: restart service restart) # HELPCMD: restart service
serv_cmd=restart serv_cmd=restart
;; ;;
#reload) # HELPCMD: reload service reload) # HELPCMD: reload service
serv_cmd=reload
;;
start) # HELPCMD: start service start) # HELPCMD: start service
serv_cmd=start serv_cmd=start
;; ;;
...@@ -186,6 +201,9 @@ check_command() ...@@ -186,6 +201,9 @@ check_command()
serv_cmd=print serv_cmd=print
withoutservicename=1 withoutservicename=1
;; ;;
log|journal) # HELPCMD: print log for the service
serv_cmd=log
;;
*) *)
return 1 return 1
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -24,6 +24,9 @@ serv_common() ...@@ -24,6 +24,9 @@ serv_common()
shift shift
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
fatal "Have no idea how to call anyservice service with args"
fi
sudocmd service $SERVICE "$@" sudocmd service $SERVICE "$@"
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -37,6 +40,9 @@ serv_common() ...@@ -37,6 +40,9 @@ serv_common()
sudocmd systemctl "$@" $SERVICE sudocmd systemctl "$@" $SERVICE
fi fi
;; ;;
runit)
sudocmd sv $SERVICE "$@"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -23,11 +23,17 @@ load_helper serv-status ...@@ -23,11 +23,17 @@ load_helper serv-status
# Enable service by default # Enable service by default
serv_disable() serv_disable()
{ {
local SERVICE="$1"
is_service_running $1 && { serv_stop $1 || return ; } 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 case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE off
return
fi
sudocmd chkconfig $1 off sudocmd chkconfig $1 off
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -36,6 +42,9 @@ serv_disable() ...@@ -36,6 +42,9 @@ serv_disable()
systemd) systemd)
sudocmd systemctl disable $1 sudocmd systemctl disable $1
;; ;;
runit)
sudocmd rm -fv /var/service/$SERVICE
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -21,13 +21,18 @@ load_helper serv-start ...@@ -21,13 +21,18 @@ load_helper serv-start
load_helper serv-status load_helper serv-status
# Enable service by default # Enable service by default
serv_enable() __serv_enable()
{ {
is_service_running $1 || serv_start $1 || return 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 case $SERVICETYPE in
service-chkconfig) service-chkconfig)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE on
return
fi
sudocmd chkconfig --add $1 || return sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on sudocmd chkconfig $1 on
;; ;;
...@@ -41,9 +46,22 @@ serv_enable() ...@@ -41,9 +46,22 @@ serv_enable()
systemd) systemd)
sudocmd systemctl enable $1 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" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
esac esac
} }
serv_enable()
{
__serv_enable "$1" || return
# start if need
is_service_running $1 && info "Service $1 is already running" && return
serv_start $1
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012,2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012,2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -24,6 +24,11 @@ serv_list_all() ...@@ -24,6 +24,11 @@ serv_list_all()
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
# service --status-all for Ubuntu/Fedora # service --status-all for Ubuntu/Fedora
sudocmd chkconfig --list | cut -f1 sudocmd chkconfig --list | cut -f1
if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice --quiet list
return
fi
;; ;;
service-initd|service-update) service-initd|service-update)
sudocmd ls $INITDIR/ | grep -v README sudocmd ls $INITDIR/ | grep -v README
......
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 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
# 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_log_altlinux()
{
local SERVICE="$1"
case "$SERVICE" in
postfix)
sudocmd tail -f /var/log/mail/all /var/log/mail/errors
;;
cups)
sudocmd tail -f /var/log/cups/access_log /var/log/cups/error_log
;;
fail2ban)
sudocmd tail -f /var/log/$SERVICE.log
;;
*)
fatal "Have no suitable for $SERVICE service"
;;
esac
}
serv_log()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
systemd)
sudocmd journalctl -f -b -u "$SERVICE" "$@"
;;
*)
case $DISTRNAME in
ALTLinux)
__serv_log_altlinux "$SERVICE"
return ;;
*)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
;;
esac
esac
}
...@@ -20,4 +20,5 @@ ...@@ -20,4 +20,5 @@
serv_print() serv_print()
{ {
echo "Detected init system: $SERVICETYPE" echo "Detected init system: $SERVICETYPE"
[ -n "$ANYSERVICE" ] && echo "anyservice is detected too"
} }
#!/bin/sh
#
# 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
# 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
# Reload service (try send SIGHUP or so on to reread config)
serv_reload()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE reload
return
fi
sudocmd service $SERVICE reload "$@"
;;
service-initd|service-update)
sudocmd $INITDIR/$SERVICE reload "$@"
;;
systemd)
sudocmd systemctl reload $SERVICE "$@"
;;
*)
info "Fallback to restart..."
load_helper serv-restart
serv_restart "$SERVICE" "$@"
;;
esac
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -27,6 +27,10 @@ serv_restart() ...@@ -27,6 +27,10 @@ serv_restart()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE restart
return
fi
sudocmd service $SERVICE restart "$@" sudocmd service $SERVICE restart "$@"
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -35,6 +39,9 @@ serv_restart() ...@@ -35,6 +39,9 @@ serv_restart()
systemd) systemd)
sudocmd systemctl restart $SERVICE "$@" sudocmd systemctl restart $SERVICE "$@"
;; ;;
runit)
sudocmd sv restart "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -25,6 +25,10 @@ serv_start() ...@@ -25,6 +25,10 @@ serv_start()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE start
return
fi
sudocmd service $SERVICE start "$@" sudocmd service $SERVICE start "$@"
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -33,6 +37,9 @@ serv_start() ...@@ -33,6 +37,9 @@ serv_start()
systemd) systemd)
sudocmd systemctl start "$SERVICE" "$@" sudocmd systemctl start "$SERVICE" "$@"
;; ;;
runit)
sudocmd sv up "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013 Etersoft # Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012, 2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -20,8 +20,14 @@ ...@@ -20,8 +20,14 @@
# FIXME: sudo ask password, but we do not print command before # FIXME: sudo ask password, but we do not print command before
is_service_running() is_service_running()
{ {
local SERVICE="$1"
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $1 ; then
$SUDO anyservice $1 status >/dev/null
return
fi
$SUDO service $1 status >/dev/null $SUDO service $1 status >/dev/null
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -30,6 +36,9 @@ is_service_running() ...@@ -30,6 +36,9 @@ is_service_running()
systemd) systemd)
$SUDO systemctl status $1 >/dev/null $SUDO systemctl status $1 >/dev/null
;; ;;
runit)
$SUDO sv status "$SERVICE" >/dev/null
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
...@@ -39,9 +48,16 @@ is_service_running() ...@@ -39,9 +48,16 @@ is_service_running()
# FIXME: sudo ask password, but we do not print command before # FIXME: sudo ask password, but we do not print command before
is_service_autostart() is_service_autostart()
{ {
local SERVICE="$1"
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
# FIXME: check for current runlevel if is_anyservice $SERVICE; then
$ANYSERVICE $SERVICE isautostarted
return
fi
# FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on" LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -50,6 +66,9 @@ is_service_autostart() ...@@ -50,6 +66,9 @@ is_service_autostart()
systemd) systemd)
$SUDO systemctl is-enabled $1 $SUDO systemctl is-enabled $1
;; ;;
runit)
test -L /var/service/$SERVICE
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
...@@ -65,6 +84,10 @@ serv_status() ...@@ -65,6 +84,10 @@ serv_status()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE status
return
fi
sudocmd service $SERVICE status "$@" sudocmd service $SERVICE status "$@"
;; ;;
service-update) service-update)
...@@ -73,6 +96,9 @@ serv_status() ...@@ -73,6 +96,9 @@ serv_status()
systemd) systemd)
sudocmd systemctl status $SERVICE "$@" sudocmd systemctl status $SERVICE "$@"
;; ;;
runit)
sudocmd sv status "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -25,6 +25,10 @@ serv_stop() ...@@ -25,6 +25,10 @@ serv_stop()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE stop
return
fi
sudocmd service $SERVICE stop "$@" sudocmd service $SERVICE stop "$@"
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -33,6 +37,9 @@ serv_stop() ...@@ -33,6 +37,9 @@ serv_stop()
systemd) systemd)
sudocmd systemctl stop $SERVICE "$@" sudocmd systemctl stop $SERVICE "$@"
;; ;;
runit)
sudocmd sv down "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -26,19 +26,14 @@ serv_try_restart() ...@@ -26,19 +26,14 @@ serv_try_restart()
shift shift
case $SERVICETYPE in 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 $INITDIR/$SERVICE restart "$@"
;;
systemd) systemd)
sudocmd systemctl try-restart $SERVICE "$@" 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 esac
} }
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
# Example use: # Example use:
# eget ftp://ftp.altlinux.ru/pub/security/ssl/* # eget ftp://ftp.altlinux.ru/pub/security/ssl/*
# #
# Copyright (C) 2014-2014 Etersoft # Copyright (C) 2014-2014, 2016 Etersoft
# Copyright (C) 2014-2014 Daniil Mikhailov <danil@etersoft.ru> # Copyright (C) 2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -28,12 +29,21 @@ if [ "$1" = "-q" ] ; then ...@@ -28,12 +29,21 @@ if [ "$1" = "-q" ] ; then
fi fi
# TODO: # TODO:
# download to this file
WGET_OPTION_TARGET=
if [ "$1" = "-O" ] ; then
TARGETFILE="$2"
WGET_OPTION_TARGET="-O $2"
shift 2
fi
# TODO:
# -P support # -P support
# If ftp protocol or have no asterisk, jus download # If ftp protocol or have no asterisk, just download
# TODO: use has() # TODO: use has()
if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then if echo "$1" | grep -q "\(^ftp://\|[^*]\)" ; then
$WGET "$1" $WGET $WGET_OPTION_TARGET "$1"
exit exit
fi fi
......
/bin/echo
coreutils
eepm
file
findutils
grep
less
procps
rpm
sed
sudo
termutils
which
#!/bin/sh #!/bin/sh
/usr/lib/rpm/shell.req bin/epm-* | sort -u /usr/lib/rpm/shell.req bin/epm-* | sort -u | tee ./check_eepm.log
git diff ./check_eepm.log
# This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 1.8.6 Version: 1.9.8
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -52,6 +52,7 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv ...@@ -52,6 +52,7 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
# shebang.req.files # shebang.req.files
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/tools_*
%files %files
%doc README TODO LICENSE %doc README TODO LICENSE
...@@ -67,9 +68,77 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +68,77 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6-alt0.M70P.1 * Fri Dec 02 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.8-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Thu Dec 01 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.8-alt1
- epm-install: move download code to epm-download
- epm-checkpkg: add support for checking package by url
- downgrade: use distro-sync for downgrade with yum/dnf
- autoorphans/autoremove: fix uses package-cleanup with yum/dnf
- epmqf: use realpath for exists files by default
- improve systemd detection
* Tue Nov 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.7-alt1
- fix build install
- small fixes
* Sun Oct 02 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.6-alt1
- epm: improve message about incorrect command
- workaround for sudo -h prints first line in stderr
- example support for service SERVICE log command
* Fri Sep 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.5-alt1
- fix systemd detection
- initial log command support
- fix anyservice list (need anyservice 0.5 or above)
* Fri Sep 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.4-alt1
- distr_info: fix checking on MacOS
- brew fixes
- autoremove: enable deep remove by default
- small fixes
* 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
- improve eget to support -O file
- epm-install: add real support install by url
- epm_install: rewrite, use direct install via epm_install
- epm_install: rewrite with pkg_urls support using
* Wed Aug 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.0-alt1
- improve urpmi support
- serv: check anyservice support against anyservice version 0.3
- autoremove: ignore libvirt
* Mon Aug 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.8-alt1
- epm-install: skip low-level when install by path
- anyservice support fixes
- serv: some anyssh fixes
* Sun Aug 14 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.7-alt1
- realize autoorphans/autoremove for zypper >= 1.9.2 in SUSE
- introduce epm remove-old-kernels command
- epm clean: clean local repo cache only with --force
- serv: add anyservice support
- small fixes
* Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6-alt1 * Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6-alt1
- epm-sh-functions: fix sudo -- detection - epm-sh-functions: fix sudo -- detection
- distr_info: add AstraLinux support - distr_info: add AstraLinux support
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# #
# Run for create one-file-scripts # Run for create one-file-scripts
# #
# Copyright (C) 2012 Etersoft # Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -20,14 +20,15 @@ ...@@ -20,14 +20,15 @@
# #
incorporate_distr_info() incorporate_subfile()
{ {
cat <<EOF >>$OUTPUT cat <<EOF >>$OUTPUT
internal_distr_info()
internal_$1()
{ {
EOF EOF
cat bin/distr_info >>$OUTPUT cat bin/$1 | grep -v "^#!/bin/sh" | sed -e "s| exit$| return|g" >>$OUTPUT
cat <<EOF >>$OUTPUT cat <<EOF >>$OUTPUT
} }
...@@ -41,7 +42,9 @@ get_version() ...@@ -41,7 +42,9 @@ get_version()
filter_out() filter_out()
{ {
grep -v "^[ ]*load_helper " | sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \ grep -v "^[ ]*load_helper " | \
sed -e 's|$SHAREDIR/tools_eget|internal_tools_eget|g' | \
sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g" sed -e "s|@VERSION@|$(get_version)|g"
} }
...@@ -59,7 +62,8 @@ for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functi ...@@ -59,7 +62,8 @@ for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functi
cat $i | grep -v "^#" cat $i | grep -v "^#"
done | filter_out >>$OUTPUT done | filter_out >>$OUTPUT
incorporate_distr_info incorporate_subfile distr_info
incorporate_subfile tools_eget
awk 'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT awk 'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT
chmod 0755 $OUTPUT chmod 0755 $OUTPUT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment