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)
install:
mkdir -p $(DESTDIR)$(bindir)/
# breaks link
#install -m 755 `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "[-_]"` $(DESTDIR)$(bindir)/
cp -a bin/distr_info $(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/serv >$(DESTDIR)$(bindir)/serv
mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "-"` $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "[-_]"` $(DESTDIR)$(pkgdatadir)/
rm -f $(DESTDIR)$(pkgdatadir)/distr_info
mkdir -p $(DESTDIR)$(mandir)/man1
cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man1/
......@@ -37,7 +37,12 @@ Note: epm is placed as /usr/bin/epm
$ rpm -qf /usr/bin/epm
eepm-1.1.0-alt2
== How to add new distro support ==
1. Fix detection with distr_info
2. Add distro support in set_pm_type function
3. Realize every command in epm-* files
4. Check epm packages and epm --short packages works correctly
(epm package 'awk' have to print packages with awk substring in their names)
See detailed description in russian at
http://wiki.etersoft.ru/Epm
......
/etc/eepm.conf конфиг
FIXME: epm-install need realpath, missed on some systems
[18:21:12] <danil> Вот так можно:
......
#!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012 (c) Etersoft
# 2007 Public domain
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007-2016 Public domain
# Detect the distro and version
# Welcome to send updates!
......@@ -32,6 +32,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
}
......@@ -55,6 +56,7 @@ pkgtype()
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
......@@ -114,10 +116,6 @@ if distro altlinux-release ; then
elif has Citron ; then DISTRIB_RELEASE="2.4"
fi
elif [ `uname -o` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
elif distro gentoo-release ; then
DISTRIB_ID="Gentoo"
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
DISTRIB_ID="TinyCoreLinux"
DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which xbps-query 2>/dev/null >/dev/null ; then
. $ROOTDIR/etc/os-release
DISTRIB_ID="VoidLinux"
DISTRIB_RELEASE="Live"
elif distro arch-release ; then
DISTRIB_ID="ArchLinux"
DISTRIB_RELEASE="2010"
......@@ -274,7 +277,7 @@ elif [ `uname` = "SunOS" ] ; then
DISTRIB_RELEASE=$(uname -r)
# fixme: can we detect by some file?
elif [ `uname` = "Darwin" ] ; then
elif [ `uname -s 2>/dev/null` = "Darwin" ] ; then
DISTRIB_ID="MacOS"
DISTRIB_RELEASE=$(uname -r)
......@@ -288,6 +291,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
DISTRIB_ID="Android"
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
elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB
......@@ -333,7 +340,7 @@ case $1 in
exit 0
;;
-V)
echo "20120519"
echo "20160822"
exit 0
;;
*)
......
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -17,10 +17,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PROGDIR=$(dirname $0)
PROGDIR=$(dirname "$0")
PROGNAME=$(basename "$0")
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
PROGDIR=""
PROGNAME=""
fi
# will replaced to /usr/share/eepm during install
......@@ -89,9 +91,7 @@ pkg_names=
pkg_urls=
quoted_args=
progname="${0##*/}"
case $progname in
case $PROGNAME in
epmi)
epm_cmd=install
;;
......@@ -136,12 +136,17 @@ case $progname in
;;
epm|upm|eepm)
;;
epm.sh)
;;
*)
# epm by default
# fatal "Unknown command: $progname"
;;
esac
# was called with alias name
[ -n "$epm_cmd" ] && PROGNAME="epm"
check_command()
{
# do not override command
......@@ -240,6 +245,9 @@ check_command()
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
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
clean) # HELPCMD: clean local package cache
......@@ -275,7 +283,7 @@ check_command()
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org 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
;;
print) # HELPCMD: print various info, run epm print help for details
......@@ -394,7 +402,7 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
if [ -z "$epm_cmd" ] ; then
print_version
echo
fatal "Run $ $progname --help for get help"
fatal "Unknown command $@. Run $ $PROGNAME --help for get help"
fi
# Use eatmydata for write specific operations
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -19,26 +19,27 @@
epm_addrepo()
{
local repo="$(eval echo $quoted_args)"
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo add "$pkg_filenames"
sudocmd apt-repo add "$repo"
;;
apt-dpkg|aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list"
;;
yum-rpm)
assure_exists yum-utils
sudocmd yum-config-manager --add-repo "$pkg_filenames"
sudocmd yum-config-manager --add-repo "$repo"
;;
urpm-rpm)
sudocmd urpmi.addmedia "$pkg_filenames"
sudocmd urpmi.addmedia "$repo"
;;
zypper-rpm)
sudocmd zypper ar "$pkg_filenames"
sudocmd zypper ar "$repo"
;;
emerge)
sudocmd layman -a $"pkg_filenames"
sudocmd layman -a "$repo"
;;
pacman)
info "You need manually add repo to /etc/pacman.conf"
......@@ -46,7 +47,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames
;;
npackd)
sudocmd npackdcl add-repo --url="$pkg_filenames"
sudocmd npackdcl add-repo --url="$repo"
;;
slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors"
......
......@@ -43,24 +43,25 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
a= deborphan | sudocmd epm remove
a= deborphan | docmd epm remove
;;
#aura)
# sudocmd aura -Oj
# ;;
yum-rpm)
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
;;
dnf-rpm)
# TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead.
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
;;
urpm-rpm)
showcmd urpmq --auto-orphans
showcmd urpme --report-orphans
sudocmd urpme --auto-orphans
;;
#emerge)
......@@ -81,9 +82,18 @@ case $PMTYPE in
#pkgng)
# sudocmd pkg autoremove
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
zypper-rpm)
# 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"
;;
......
......@@ -24,7 +24,8 @@ __epm_autoremove_altrpm()
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
info
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 libexclude='^lib'
......@@ -34,9 +35,9 @@ __epm_autoremove_altrpm()
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \
| 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" \
| 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
info "Removing unused python/perl modules..."
......@@ -64,13 +65,12 @@ epm_autoremove()
case $DISTRNAME in
ALTLinux)
__epm_autoremove_altrpm
assure_exists remove-old-kernels update-kernel 0.9.9
sudocmd remove-old-kernels
docmd epm remove-old-kernels
if which nvidia-clean-driver 2>/dev/null ; then
sudocmd nvidia-clean-driver
fi
return
;;
*)
......@@ -89,7 +89,7 @@ case $PMTYPE in
while true ; do
docmd package-cleanup --leaves $(subst_option non_interactive --assumeyes)
# 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
sudocmd yum remove $PKGLIST
done
......@@ -120,9 +120,17 @@ case $PMTYPE in
pkgng)
sudocmd pkg autoremove
;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
zypper-rpm)
# 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"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -85,9 +85,9 @@ __epm_changelog_unlocal_names()
#yum-rpm)
# sudocmd yum clean all
# ;;
#urpm-rpm)
# sudocmd urpmi --clean
# ;;
urpm-rpm)
docmd urpmq --changelog $@ | less
;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
......
......@@ -28,11 +28,11 @@ case $PMTYPE in
apt-dpkg)
#sudocmd apt-get update || exit
#sudocmd apt-get check || exit
sudocmd apt-get -f install || exit
sudocmd apt-get -f install || return
sudocmd apt-get autoremove
;;
aptitude-dpkg)
sudocmd aptitude -f install || exit
sudocmd aptitude -f install || return
#sudocmd apt-get autoremove
;;
yum-rpm)
......@@ -60,7 +60,7 @@ case $PMTYPE in
sudocmd pkg check -d -a
;;
homebrew)
sudocmd brew doctor
docmd brew doctor
;;
*)
fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh
#
# Copyright (C) 2009, 2012, 2013, 2014 Etersoft
# Copyright (C) 2009, 2012, 2013, 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2009, 2012, 2013, 2014, 2016 Etersoft
# Copyright (C) 2009, 2012, 2013, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -75,14 +75,30 @@ esac
epm_checkpkg()
{
if [ -n "$pkg_names" ] ; then
# TODO: если есть / или расширение, это отсутствующий файл
info "Suggest $pkg_names are name(s) of installed packages"
__epm_check_installed_pkg $pkg_names
return
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)"
local RETVAL=0
local pkg
for pkg in $pkg_files ; do
check_pkg_integrity $pkg || fatal "Broken package $pkg"
check_pkg_integrity $pkg || RETVAL=1
done
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
#fatal "Broken package $pkg"
return $RETVAL
}
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -43,15 +43,15 @@ epm_clean()
case $PMTYPE in
apt-rpm)
sudocmd apt-get clean
__remove_alt_apt_cache_file
[ -n "$force" ] && __remove_alt_apt_cache_file
;;
apt-dpkg)
sudocmd apt-get clean
__remove_deb_apt_cache_file
[ -n "$force" ] && __remove_deb_apt_cache_file
;;
aptitude-dpkg)
sudocmd aptitude clean
__remove_deb_apt_cache_file
[ -n "$force" ] && __remove_deb_apt_cache_file
;;
yum-rpm)
sudocmd yum clean all
......@@ -77,6 +77,9 @@ case $PMTYPE in
pkgng)
sudocmd pkg clean -a
;;
xbps)
sudocmd xbps-remove -O
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -90,10 +90,18 @@ epm_downgrade()
;;
yum-rpm)
# 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)
sudocmd dnf downgrade $pkg_filenames
if [ -n "$pkg_filenames" ] ; then
sudocmd dnf downgrade $pkg_filenames
else
sudocmd dnf distro-sync
fi
;;
urpm-rpm)
assure_exists urpm-reposync urpm-tools
......
......@@ -17,6 +17,88 @@
# 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()
{
local CMD
......
......@@ -2,6 +2,7 @@
# Copyright (C) 2016 Etersoft
# 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
# it under the terms of the GNU Affero General Public License as published by
......@@ -17,20 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
myinit(){
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
}
load_helper epm-install
epm_epm_install(){
myinit
download_epm || fatal "Error. Check download link: $download_link"
epm i $eepm_package || fatal
rm -fv $eepm_package
assure_exists wget
local etersoft_updates_site="http://updates.etersoft.ru/pub/Korinf/$($DISTRVENDOR -e)"
# FIXME: some way to get latest 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
#
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -28,6 +28,7 @@ __alt_local_content_filelist()
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
[ -n "$CI" ] || fatal "Have no local contents index"
# TODO: safe way to use less
#local OUTCMD="less"
......@@ -35,7 +36,7 @@ __alt_local_content_filelist()
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"
} | $OUTCMD
}
......@@ -119,9 +120,15 @@ __epm_filelist_name()
assure_exists equery
CMD="equery files"
;;
homebrew)
CMD="brew list"
;;
pkgng)
CMD="pkg info -l"
;;
xbps)
CMD="xbps-query -f"
;;
aptcyg)
docmd apt-cyg listfiles $@ | sed -e "s|^|/|g"
return
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -59,6 +59,10 @@ case $PMTYPE in
__epm_info_rpm_low && return
docmd yum info $pkg_names
;;
urpmi-rpm)
__epm_info_rpm_low && return
docmd urpmq -i $pkg_names
;;
dnf-rpm)
__epm_info_rpm_low && return
docmd dnf info $pkg_names
......@@ -99,6 +103,9 @@ case $PMTYPE in
pkgng)
docmd pkg info $pkg_names
;;
xbps)
docmd xbps-query --show $pkg_names
;;
homebrew)
docmd brew info $pkg_names
;;
......
......@@ -18,6 +18,7 @@
#
load_helper epm-query
load_helper epm-assure
load_helper epm-check_updated_repo
# TODO: use when run install with epm --skip-installed install
......@@ -81,15 +82,6 @@ __separate_sudocmd()
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
epm_install_names()
{
......@@ -154,7 +146,7 @@ epm_install_names()
return ;;
homebrew)
# FIXME: sudo and quote
__separate_sudocmd "brew install" "brew upgrade" $@
SUDO= __separate_sudocmd "brew install" "brew upgrade" $@
return ;;
ipkg)
[ -n "$force" ] && force=-force-depends
......@@ -178,6 +170,9 @@ epm_install_names()
aptcyg)
sudocmd apt-cyg install $@
return ;;
xbps)
sudocmd xbps-install $@
return ;;
*)
fatal "Have no suitable install command for $PMTYPE"
;;
......@@ -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 $@
return ;;
aptitude-dpkg)
sudocmd aptitde -y install $@
sudocmd aptitude -y install $@
return ;;
yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@
......@@ -243,6 +238,13 @@ epm_ni_install_names()
tce)
sudocmd tce-load -wi $@
return ;;
xbps)
sudocmd xbps-install -y $@
return ;;
homebrew)
# FIXME: sudo and quote
SUDO= __separate_sudocmd "brew install" "brew upgrade" $@
return ;;
#android)
# sudocmd pm install $@
# return ;;
......@@ -279,8 +281,11 @@ __epm_check_if_try_install_deb()
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $debpkgs ; do
showcmd alien -r -k --scripts "$pkg"
# TODO: need check for return status
# TODO: fakeroot for non ALT?
showcmd_store_output alien -r -k --scripts "$pkg" || fatal
local RPMCONVERTED=$(grep "rpm generated" $RC_STDOUT | sed -e "s| generated||g")
clean_store_output
epm install $RPMCONVERTED
done
rm -f $TDIR/*
rmdir $TDIR/
......@@ -301,12 +306,16 @@ __epm_check_if_try_install_rpm()
[ -n "$rpmpkgs" ] || return 1
assure_exists alien
assure_exists fakeroot
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $rpmpkgs ; do
showcmd alien -d -k --scripts "$pkg"
# TODO: need check for return status
showcmd_store_output fakeroot alien -d -k --scripts "$pkg"
clean_store_output
local DEBCONVERTED=$(grep "deb generated" $RC_STDOUT | sed -e "s| generated||g")
clean_store_output
epm install $DEBCONVERTED
done
rm -f $TDIR/*
rmdir $TDIR/
......@@ -327,13 +336,16 @@ epm_install_files()
apt-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
__epm_check_if_rpm_already_installed $@ && return
# do not use low-level for install by file path
if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
# TODO: check rpm result code and convert it to compatible format if possible
__epm_check_if_rpm_already_installed $@ && return
# if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES
fi
# use install_names
;;
......@@ -480,6 +492,14 @@ epm_print_install_command()
tce)
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"
;;
......@@ -494,19 +514,16 @@ epm_install()
return
fi
# Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?)
#[ -n "$pkg_urls" ] && warning "URL using does not realize yet"
#download_pkg_urls "$pkg_urls"
# temp. hack
pkg_files="$pkg_files $pkg_urls"
# TODO: add downloaded files to $pkg_files
# 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_install
fi
[ -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 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
......@@ -517,4 +534,10 @@ epm_install()
epm_install_names $names || return
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()
fi
assure_exists update-kernel update-kernel 0.9.9
sudocmd update-kernel $pkg_filenames || return
sudocmd remove-old-kernels $pkg_filenames
docmd epm remove-old-kernels $pkg_filenames || fatal
return ;;
esac
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -41,6 +41,11 @@ __aptcyg_print_full()
echo "$1-$VERSION"
}
__fo_pfn()
{
grep -v "^$" | grep -- "$pkg_filenames"
}
# TODO: we have a problem with error status here
epm_packages()
{
......@@ -49,23 +54,28 @@ epm_packages()
case $PMTYPE in
apt-rpm)
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
;;
docmd $CMD
return ;;
*-dpkg)
# FIXME: strong equal
#CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
docmd $CMD | grep "^i" | sed -e "s|.* ||g"
return
;;
showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
return ;;
snappy)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
;;
docmd $CMD
return ;;
emerge)
CMD="qlist -I -C"
# print with colors for console output
......@@ -73,26 +83,27 @@ case $PMTYPE in
;;
pkgsrc)
CMD="pkg_info"
docmd $CMD | sed -e "s| .*||g"
return
;;
showcmd $CMD
$CMD | sed -e "s| .*||g" | __fo_pfn
return ;;
pkgng)
if [ -n "$pkg_filenames" ] ; then
CMD="pkg info -E $pkg_filenames"
else
CMD="pkg info"
fi
showcmd $CMD
if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g"
$CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g" | __fo_pfn
else
docmd $CMD | sed -e "s| .*||g"
$CMD | sed -e "s| .*||g" | __fo_pfn
fi
return
;;
return ;;
pacman)
CMD="pacman -Qs $pkg_filenames"
showcmd $CMD
if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" -e "s|.*/||g" | grep -v "^$"
$CMD | sed -e "s| .*||g" -e "s|.*/||g" | __fo_pfn
return
fi
;;
......@@ -112,12 +123,12 @@ case $PMTYPE in
# FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g"
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g" | __fo_pfn
return
fi
;;
homebrew)
CMD="brew list $pkg_filenames"
docmd brew list | xargs -n1 echo
;;
ipkg)
CMD="ipkg list"
......@@ -131,9 +142,20 @@ case $PMTYPE in
guix)
CMD="guix package -I"
;;
xbps)
CMD="xbps-query -l"
showcmd $CMD
if [ -n "$short" ] ; then
$CMD | sed -e "s|^ii ||g" -e "s| .*||g" -e "s|\(.*\)-.*|\1|g" | __fo_pfn
else
$CMD | sed -e "s|^ii ||g" -e "s| .*||g" | __fo_pfn
fi
return 0
;;
android)
CMD="pm list packages"
docmd $CMD | sed -e "s|^package:||g"
showcmd $CMD
$CMD | sed -e "s|^package:||g" | __fo_pfn
return
;;
aptcyg)
......@@ -152,8 +174,7 @@ case $PMTYPE in
;;
esac
docmd $CMD
# FIXME: do not print empty lines, but we will lost error status definitely
# | grep -v "^$"
docmd $CMD | __fo_pfn
# FIXME: we print empty lines, but will lost error status
}
#!/bin/sh
#
# Copyright (C) 2012, 2013, 2015 Etersoft
# Copyright (C) 2012, 2013, 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2015, 2016 Etersoft
# Copyright (C) 2012, 2013, 2015, 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
......@@ -33,16 +33,18 @@ _get_grep_exp()
# TODO: combine with -qa (the difference only in return status now)
_shortquery_via_packages_list()
{
local res=0
local res=1
local grepexp
local firstpkg=$1
shift
grepexp=$(_get_grep_exp $firstpkg)
# TODO: we miss status due grep
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" || res=1
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" && res=0 || res=1
local pkg
for pkg in "$@" ; do
......@@ -57,16 +59,19 @@ _shortquery_via_packages_list()
# TODO: non optimal double epm packages call
_query_via_packages_list()
{
local res=0
local res=1
local grepexp
local firstpkg=$1
shift
grepexp=$(_get_grep_exp $firstpkg)
# TODO: we miss status due grep
# TODO: grep correctly
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages || res=1
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages && res=0 || res=1
local pkg
for pkg in "$@" ; do
......@@ -181,7 +186,7 @@ __epm_query_name()
CMD="conary query"
;;
homebrew)
warning "fix query"
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1
;;
# TODO: need to print name if exists
......@@ -223,7 +228,7 @@ __epm_query_shortname()
CMD="conary query"
;;
homebrew)
warning "fix query"
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1
;;
# TODO: need to print name if exists
......
#!/bin/sh
#
# Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2009, 2012, 2016 Etersoft
# Copyright (C) 2009, 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -25,7 +25,7 @@ __do_query_real_file()
# get canonical path
if [ -e "$1" ] ; then
TOFILE="$1"
TOFILE=$(realpath "$1")
else
TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then
......@@ -98,6 +98,10 @@ __do_query()
ipkg)
CMD="ipkg files"
;;
xbps)
# FIXME: maybe it is search file?
CMD="xbps-query -o"
;;
aptcyg)
#CMD="apt-cyg packageof"
# do not realized locally
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -31,6 +31,9 @@ epm_reinstall_names()
aptitude-dpkg)
sudocmd aptitude reinstall $@
return ;;
yum-rpm)
sudocmd yum reinstall $@
return ;;
dnf-rpm)
sudocmd dnf reinstall $@
return ;;
......
......@@ -65,7 +65,7 @@ __replace_alt_version_in_repo()
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
# ask and replace only we will have changes
if apt-repo list | egrep -q -- "$1" ; then
if a= apt-repo list | egrep -q -- "$1" ; then
confirm "Are these correct changes? [y/N]" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
fi
......
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2014, 2016 Etersoft
# Copyright (C) 2012-2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -93,7 +93,7 @@ epm_remove_names()
sudocmd snappy uninstall $@
return ;;
zypper-rpm)
sudocmd zypper remove $@
sudocmd zypper remove --clean-deps $@
return ;;
mpkg)
sudocmd mpkg remove $@
......@@ -123,11 +123,14 @@ epm_remove_names()
sudocmd /usr/sbin/slackpkg remove $@
return ;;
homebrew)
sudocmd brew remove $@
docmd brew remove $@
return ;;
aptcyg)
sudocmd apt-cyg remove $@
return ;;
xbps)
sudocmd xbps remove -R $@
return ;;
ipkg)
sudocmd ipkg $(subst_option force -force-depends) remove $@
return ;;
......@@ -160,7 +163,7 @@ epm_remove_nonint()
sudocmd yum -y remove $@
return ;;
zypper-rpm)
sudocmd zypper --non-interactive remove $@
sudocmd zypper --non-interactive remove --clean-deps $@
return ;;
slackpkg)
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@
......@@ -171,6 +174,9 @@ epm_remove_nonint()
ipkg)
sudocmd ipkg -force-defaults remove $@
return ;;
xbps)
sudocmd xbps remove -y $@
return ;;
esac
return 5
}
......@@ -205,6 +211,9 @@ epm_print_remove_command()
aptcyg)
echo "apt-cyg remove $@"
;;
xbps)
echo "xbps remove -y $@"
;;
*)
fatal "Have no suitable appropriate remove command for $PMTYPE"
;;
......
#!/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
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -19,32 +19,33 @@
epm_removerepo()
{
local repo="$(eval echo $quoted_args)"
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo rm "$quoted_args"
sudocmd apt-repo rm "$repo"
;;
apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
;;
yum-rpm)
assure_exists yum-utils
sudocmd yum-config-manager --disable "$pkg_filenames"
sudocmd yum-config-manager --disable "$repo"
;;
urpm-rpm)
sudocmd urpmi.removemedia "$pkg_filenames"
sudocmd urpmi.removemedia "$repo"
;;
zypper-rpm)
sudocmd zypper removerepo "$pkg_filenames"
sudocmd zypper removerepo "$repo"
;;
emerge)
sudocmd layman "-d$pkg_filenames"
sudocmd layman "-d$repo"
;;
pacman)
info "You need remove repo from /etc/pacman.conf"
;;
npackd)
sudocmd npackdcl remove-repo --url="$pkg_filenames"
sudocmd npackdcl remove-repo --url="$repo"
;;
slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors"
......
......@@ -84,14 +84,18 @@ case $PMTYPE in
__fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list
docmd apt-repo list
# FIXME: what the best place?
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm)
sudocmd rm -fv /var/lib/rpm/__db*
sudocmd rpm --rebuilddb
# FIXME: what the best place?
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
xbps)
sudocmd xbps-pkgdb -a
;;
*)
fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -43,7 +43,7 @@ case $PMTYPE in
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
;;
yum-rpm)
docmd yum repolist
docmd yum repolist -v
;;
dnf-rpm)
docmd dnf repolist -v
......@@ -58,6 +58,9 @@ case $PMTYPE in
docmd eselect profile list
docmd layman -L
;;
xbps)
docmd xbps-query -L
;;
pacman)
docmd grep -v -- "^#\|^$" /etc/pacman.conf
;;
......
#!/bin/sh
#
# Copyright (C) 2012-2013 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -63,9 +63,12 @@ case $PMTYPE in
fi
;;
urpm-rpm|zypper-rpm)
# FIXME: use hi level commands
CMD="rpm -q --requires"
#zypper-rpm)
# # FIXME: use hi level commands
# CMD="rpm -q --requires"
# ;;
urpm-rpm)
CMD="urpmq --requires"
;;
yum-rpm)
if is_installed $pkg_names ; then
......@@ -102,6 +105,9 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d"
;;
xbps)
CMD="xbps-query -x"
;;
aptcyg)
#CMD="apt-cyg depends"
# print show version
......
#!/bin/sh
#
# Copyright (C) 2012,2013 Etersoft
# Copyright (C) 2012,2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012, 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -97,6 +97,9 @@ case $PMTYPE in
aptcyg)
CMD="apt-cyg searchall"
;;
xbps)
CMD="xbps-query -s"
;;
*)
fatal "Have no suitable search command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -22,13 +22,13 @@ __alt_local_content_search()
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
[ -n "$CI" ] || fatal "Have no local contents index"
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
{
[ -n "$USETTY" ] && echo "Search in $CI for $1..."
[ -n "$USETTY" ] && info "Search in $CI for $1..."
# note! tabulation below!
grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD
......@@ -73,6 +73,9 @@ case $PMTYPE in
ipkg)
CMD="ipkg search"
;;
xbps)
CMD="xbps-query -Ro"
;;
aptcyg)
docmd apt-cyg searchall $(echo " $pkg_filenames" | sed -e "s| /| |g")
return
......
......@@ -200,6 +200,12 @@ store_output()
#return $PIPESTATUS
}
showcmd_store_output()
{
showcmd "$@"
store_output "$@"
}
clean_store_output()
{
rm -f $RC_STDOUT $RC_STDOUT.pipestatus
......@@ -208,7 +214,8 @@ clean_store_output()
# run epm, possible from side repo
epm()
{
$PROGDIR/epm $@
[ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script"
$PROGDIR/$PROGNAME $@
}
# Print error message and stop the program
......@@ -264,7 +271,7 @@ set_sudo()
if which sudo >/dev/null 2>/dev/null ; then
SUDO="sudo --"
# 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
fi
......@@ -349,7 +356,8 @@ assure_exists()
eget()
{
$SHAREDIR/tools-eget "$@"
assure_exists wget
$SHAREDIR/tools_eget "$@"
}
# TODO: improve and drop!
......@@ -423,6 +431,8 @@ if [ -n "$FORCEPM" ] ; then
return
fi
# TODO: move it in distr_vendor?
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRNAME in
ALTLinux)
CMD="apt-rpm"
......@@ -486,6 +496,9 @@ case $DISTRNAME in
TinyCoreLinux)
CMD="tce"
;;
VoidLinux)
CMD="xbps"
;;
*)
fatal "Have no suitable DISTRNAME $DISTRNAME"
;;
......@@ -503,5 +516,5 @@ is_active_systemd()
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# 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()
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 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
;;
esac
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -26,11 +26,11 @@ epm_update()
case $PMTYPE in
apt-rpm)
sudocmd apt-get update || exit
sudocmd apt-get update || return
#sudocmd apt-get -f install || exit
;;
apt-dpkg)
sudocmd apt-get update || exit
sudocmd apt-get update || return
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
......@@ -38,7 +38,7 @@ case $PMTYPE in
# sudocmd snappy
# ;;
aptitude-dpkg)
sudocmd aptitude update || exit
sudocmd aptitude update || return
;;
yum-rpm)
info "update command is stubbed for yum"
......@@ -75,7 +75,7 @@ case $PMTYPE in
sudocmd packdcl detect # get packages from MSI database
;;
homebrew)
sudocmd brew update
docmd brew update
;;
ipkg)
sudocmd ipkg update
......@@ -90,6 +90,9 @@ case $PMTYPE in
aptcyg)
sudocmd apt-cyg update
;;
xbps)
sudocmd xbps-install -S
;;
*)
fatal "Have no suitable update command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -32,26 +32,28 @@ epm_upgrade()
case $PMTYPE in
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)
CMD="aptitude dist-upgrade"
;;
yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically
CMD="yum update"
CMD="yum $OPTIONS update"
;;
dnf-rpm)
CMD="dnf distro-sync"
local OPTIONS="$(subst_option non_interactive -y)"
CMD="dnf $OPTIONS distro-sync"
;;
snappy)
CMD="snappy update"
;;
urpm-rpm)
# or --auto-select --replace-files
CMD="urpmi --auto-update"
CMD="urpmi --update --auto-select"
;;
zypper-rpm)
CMD="zypper dist-upgrade"
......@@ -79,7 +81,7 @@ epm_upgrade()
;;
homebrew)
#CMD="brew upgrade"
sudocmd "brew upgrade `brew outdated`"
docmd "brew upgrade `brew outdated`"
return
;;
ipkg)
......@@ -95,6 +97,9 @@ epm_upgrade()
docmd_foreach "epm install" $(short=1 epm packages)
return
;;
xbps)
CMD="xbps-install -Su"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -40,6 +40,9 @@ case $PMTYPE in
yum-rpm)
CMD="repoquery --whatrequires"
;;
urpm-rpm)
CMD="urpmq --whatrequires"
;;
dnf-rpm)
CMD="repoquery --whatrequires"
;;
......@@ -53,6 +56,9 @@ case $PMTYPE in
aptcyg)
CMD="apt-cyg rdepends"
;;
xbps)
CMD="xbps-query -X"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -38,6 +38,9 @@ case $PMTYPE in
yum-rpm)
CMD="yum whatprovides"
;;
urpm-rpm)
CMD="urpmq --whatprovides"
;;
dnf-rpm)
CMD="yum provides"
;;
......
......@@ -76,6 +76,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig"
;;
VoidLinux)
CMD="runit"
;;
Slackware)
CMD="service-initd"
;;
......@@ -98,8 +101,18 @@ is_active_systemd && CMD="systemd"
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()
......@@ -117,7 +130,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -154,7 +167,9 @@ check_command()
restart) # HELPCMD: restart service
serv_cmd=restart
;;
#reload) # HELPCMD: reload service
reload) # HELPCMD: reload service
serv_cmd=reload
;;
start) # HELPCMD: start service
serv_cmd=start
;;
......@@ -186,6 +201,9 @@ check_command()
serv_cmd=print
withoutservicename=1
;;
log|journal) # HELPCMD: print log for the service
serv_cmd=log
;;
*)
return 1
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -24,6 +24,9 @@ serv_common()
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
fatal "Have no idea how to call anyservice service with args"
fi
sudocmd service $SERVICE "$@"
;;
service-initd|service-update)
......@@ -37,6 +40,9 @@ serv_common()
sudocmd systemctl "$@" $SERVICE
fi
;;
runit)
sudocmd sv $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -23,11 +23,17 @@ load_helper serv-status
# Enable service by default
serv_disable()
{
local SERVICE="$1"
is_service_running $1 && { serv_stop $1 || return ; }
is_service_autostart $1 || { echo "Service $1 already disabled for startup" && return ; }
is_service_autostart $1 || { info "Service $1 already disabled for startup" && return ; }
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE off
return
fi
sudocmd chkconfig $1 off
;;
service-initd|service-update)
......@@ -36,6 +42,9 @@ serv_disable()
systemd)
sudocmd systemctl disable $1
;;
runit)
sudocmd rm -fv /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -21,13 +21,18 @@ load_helper serv-start
load_helper serv-status
# Enable service by default
serv_enable()
__serv_enable()
{
is_service_running $1 || serv_start $1 || return
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
local SERVICE="$1"
is_service_autostart $1 && info "Service $1 is already enabled for startup" && return
case $SERVICETYPE in
service-chkconfig)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE on
return
fi
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
......@@ -41,9 +46,22 @@ serv_enable()
systemd)
sudocmd systemctl enable $1
;;
runit)
epm assure $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
sudocmd ln -s /etc/sv/$SERVICE /var/service/
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
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
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2016 Etersoft
# Copyright (C) 2012,2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -24,6 +24,11 @@ serv_list_all()
service-chkconfig|service-upstart)
# service --status-all for Ubuntu/Fedora
sudocmd chkconfig --list | cut -f1
if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice --quiet list
return
fi
;;
service-initd|service-update)
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 @@
serv_print()
{
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
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -27,6 +27,10 @@ serv_restart()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE restart
return
fi
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
......@@ -35,6 +39,9 @@ serv_restart()
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
runit)
sudocmd sv restart "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,10 @@ serv_start()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE start
return
fi
sudocmd service $SERVICE start "$@"
;;
service-initd|service-update)
......@@ -33,6 +37,9 @@ serv_start()
systemd)
sudocmd systemctl start "$SERVICE" "$@"
;;
runit)
sudocmd sv up "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012, 2013 Etersoft
# Copyright (C) 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012, 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -20,8 +20,14 @@
# FIXME: sudo ask password, but we do not print command before
is_service_running()
{
local SERVICE="$1"
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $1 ; then
$SUDO anyservice $1 status >/dev/null
return
fi
$SUDO service $1 status >/dev/null
;;
service-initd|service-update)
......@@ -30,6 +36,9 @@ is_service_running()
systemd)
$SUDO systemctl status $1 >/dev/null
;;
runit)
$SUDO sv status "$SERVICE" >/dev/null
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -39,9 +48,16 @@ is_service_running()
# FIXME: sudo ask password, but we do not print command before
is_service_autostart()
{
local SERVICE="$1"
case $SERVICETYPE in
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"
;;
service-initd|service-update)
......@@ -50,6 +66,9 @@ is_service_autostart()
systemd)
$SUDO systemctl is-enabled $1
;;
runit)
test -L /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -65,6 +84,10 @@ serv_status()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE status
return
fi
sudocmd service $SERVICE status "$@"
;;
service-update)
......@@ -73,6 +96,9 @@ serv_status()
systemd)
sudocmd systemctl status $SERVICE "$@"
;;
runit)
sudocmd sv status "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,10 @@ serv_stop()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE stop
return
fi
sudocmd service $SERVICE stop "$@"
;;
service-initd|service-update)
......@@ -33,6 +37,9 @@ serv_stop()
systemd)
sudocmd systemctl stop $SERVICE "$@"
;;
runit)
sudocmd sv down "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -26,19 +26,14 @@ serv_try_restart()
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $SERVICE || return 0
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $SERVICE || return 0
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
info "Fallback to restart..."
is_service_running $SERVICE || { info "Service $SERVICE is not running, restart skipping…" ; return 0 ; }
load_helper serv-restart
serv_restart "$SERVICE" "$@"
;;
esac
}
......@@ -3,8 +3,9 @@
# Example use:
# eget ftp://ftp.altlinux.ru/pub/security/ssl/*
#
# Copyright (C) 2014-2014 Etersoft
# Copyright (C) 2014-2014 Daniil Mikhailov <danil@etersoft.ru>
# Copyright (C) 2014-2014, 2016 Etersoft
# 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
# it under the terms of the GNU Affero General Public License as published by
......@@ -28,12 +29,21 @@ if [ "$1" = "-q" ] ; then
fi
# 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
# If ftp protocol or have no asterisk, jus download
# If ftp protocol or have no asterisk, just download
# TODO: use has()
if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then
$WGET "$1"
if echo "$1" | grep -q "\(^ftp://\|[^*]\)" ; then
$WGET $WGET_OPTION_TARGET "$1"
exit
fi
......
/bin/echo
coreutils
eepm
file
findutils
grep
less
procps
rpm
sed
sudo
termutils
which
#!/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.
#
Name: eepm
Version: 1.8.6
Version: 1.9.8
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
......@@ -52,6 +52,7 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
# shebang.req.files
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/tools_*
%files
%doc README TODO LICENSE
......@@ -67,9 +68,77 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%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)
* 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
- epm-sh-functions: fix sudo -- detection
- distr_info: add AstraLinux support
......
......@@ -2,8 +2,8 @@
#
# Run for create one-file-scripts
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -20,14 +20,15 @@
#
incorporate_distr_info()
incorporate_subfile()
{
cat <<EOF >>$OUTPUT
internal_distr_info()
internal_$1()
{
EOF
cat bin/distr_info >>$OUTPUT
cat bin/$1 | grep -v "^#!/bin/sh" | sed -e "s| exit$| return|g" >>$OUTPUT
cat <<EOF >>$OUTPUT
}
......@@ -41,7 +42,9 @@ get_version()
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"
}
......@@ -59,7 +62,8 @@ for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functi
cat $i | grep -v "^#"
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
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