Commit f4b5d2a0 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60P as 1.9.9-alt0.M60P.1 (with rpmbph script)

parents fe78bb76 816228f8
......@@ -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 конфиг
[18:21:12] <danil> Вот так можно:
RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf
......@@ -15,8 +16,6 @@ yum list extras – имена тех пакетов, которые налич
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl
yum remove $(package-cleanup --orphans
https://github.com/biow0lf/prometheus-cli
......@@ -66,6 +65,4 @@ https://wiki.archlinux.org/index.php/Pacman_Rosetta
apt-rpm/install
apt-rpm/remove
при упаковке лучше собирать в один файл.
serv должен уметь показывать порядок загрузки?
#!/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!
......@@ -29,7 +29,10 @@ has()
rpmvendor()
{
[ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return
[ "$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]"
}
......@@ -52,8 +55,10 @@ pkgtype()
windows) echo "exe" ;;
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst) echo "deb" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel)
......@@ -77,11 +82,13 @@ get_major_version()
# Default values
DISTRIB_ID="Generic"
DISTRIB_RELEASE=""
DISTRIB_CODENAME=""
# Default with LSB
if distro lsb-release ; then
DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
DISTRIB_RELEASE=`cat $DISTROFILE | get_var DISTRIB_RELEASE`
DISTRIB_CODENAME=`cat $DISTROFILE | get_var DISTRIB_CODENAME`
fi
# ALT Linux based
......@@ -109,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)
......@@ -137,6 +140,16 @@ elif distro os-release && which apk 2>/dev/null >/dev/null ; then
DISTRIB_ID="$ID"
DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
. $ROOTDIR/etc/os-release
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"
......@@ -148,6 +161,12 @@ elif distro mcst_version ; then
DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
elif distro astra_version ; then
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
DISTRIB_ID="AstraLinux"
#DISTRIB_RELEASE=$(cat "$DISTROFILE" | head -n1 | sed -e "s|.* \([a-z]*\).*|\1|g")
DISTRIB_RELEASE=$DISTRIB_CODENAME
# for Ubuntu use standard LSB info
elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB version
......@@ -156,7 +175,7 @@ elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then
# Debian based
elif distro debian_version ; then
DISTRIB_ID="Debian"
DISTRIB_RELEASE=`cat $DISTROFILE`
DISTRIB_RELEASE=$(cat $DISTROFILE | sed -e "s/\..*//g")
# Mandriva based
......@@ -258,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)
......@@ -272,10 +291,18 @@ 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
true
case "$DISTRIB_ID" in
"openSUSE Tumbleweed")
DISTRIB_ID="Tumbleweed"
;;
esac
fi
case $1 in
......@@ -317,7 +344,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,8 +17,13 @@
# 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
SHAREDIR=$PROGDIR
......@@ -72,8 +77,10 @@ Descr="epm - EPM package manager"
verbose=
quiet=
nodeps=
noremove=
force=
short=
direct=
sort=
non_interactive=
skip_installed=
......@@ -85,9 +92,7 @@ pkg_names=
pkg_urls=
quoted_args=
progname="${0##*/}"
case $progname in
case $PROGNAME in
epmi)
epm_cmd=install
;;
......@@ -124,17 +129,25 @@ case $progname in
epmql)
epm_cmd=filelist
;;
epmrl)
epm_cmd=repolist
;;
epmu)
epm_cmd=update
;;
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
......@@ -233,12 +246,15 @@ 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
epm_cmd=clean
;;
autoremove) # HELPCMD: auto remove unneeded package(s)
autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s)
epm_cmd=autoremove
;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
......@@ -268,6 +284,9 @@ 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|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
epm_cmd=print
;;
......@@ -311,9 +330,15 @@ check_option()
--force) # HELPOPT: force install/remove package (f.i., override)
force="--force"
;;
--noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade
noremove="--no-remove"
;;
--short) # HELPOPT: short output (just 'package' instead 'package-version-release')
short="--short"
;;
--direct) # HELPOPT: direct install package file from ftp (not via hilevel repository manager)
direct="--direct"
;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort="$1"
......@@ -357,8 +382,8 @@ for opt in "$@" ; do
check_filenames $opt
done
# if input is not console, get pkg from it too
if ! inputisatty ; then
# if input is not console and run script from file, get pkgs from stdin too
if ! inputisatty && [ -n "$PROGDIR" ] ; then
for opt in $(withtimeout 1 cat) ; do
check_filenames $opt
done
......@@ -381,7 +406,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,56 @@
epm_addrepo()
{
case $PMTYPE in
apt-rpm)
local repo="$(eval echo "$quoted_args")"
case $DISTRNAME in
ALTLinux)
case "$repo" in
etersoft)
info "add etersoft repo"
load_helper epm-query
epm install --skip-installed apt-conf-etersoft-common apt-conf-etersoft-hold || fatal
local branch="$DISTRVERSION/branch"
[ "$DISTRVERSION" = "Sisyphus" ] && branch="$DISTRVERSION"
# FIXME
[ -n "$DISTRVERSION" ] || fatal "Empty $DISTRVERSION"
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list
fi
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list
repo="$DISTRVERSION"
return 0
;;
esac
assure_exists apt-repo
sudocmd apt-repo add "$pkg_filenames"
sudocmd apt-repo add "$repo"
return
;;
esac
case $PMTYPE in
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 +76,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"
......
#!/bin/sh
#
# Copyright (C) 2013, 2014, 2015 Etersoft
# Copyright (C) 2013, 2014, 2015 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,48 +38,82 @@ is_dirpath()
rhas "$1" "/"
}
# Do fast checking for command and install package if the command does not exist
__epm_need_update()
{
local PACKAGE="$1"
local PACKAGEVERSION="$2"
# $1 - command name
# $2 - package name
[ -n "$PACKAGEVERSION" ] || return 0
__epm_assure()
load_helper epm-query
is_installed "$PACKAGE" || return 0
load_helper epm-print
# epm print version for package N
local INSTALLEDVERSION=$(query_package_field "version" "$PACKAGE")
# if needed >= installed, return 0
[ "$(compare_version "$PACKAGEVERSION" "$INSTALLEDVERSION")" -gt 0 ] && return 0
return 1
}
__epm_assure_checking()
{
local CMD="$1"
local PACKAGE="$2"
local PACKAGEVERSION="$3"
[ -n "$PACKAGEVERSION" ] && return 1
if is_dirpath "$1" ; then
if [ -e "$1" ] ; then
if is_dirpath "$CMD" ; then
if [ -e "$CMD" ] ; then
if [ -n "$verbose" ] ; then
info "File or directory $1 is already exists."
epm qf "$1"
info "File or directory $CMD is already exists."
epm qf "$CMD"
fi
return 0
return 0
fi
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
docmd epm --auto --skip-installed install "$2"
return
[ -n "$PACKAGE" ] || fatal "You need run with package name param when use with absolute path"
return 1
fi
if __check_command_in_path "$1" >/dev/null ; then
if __check_command_in_path "$CMD" >/dev/null ; then
if [ -n "$verbose" ] ; then
local compath="$(__check_command_in_path "$1")"
info "Command $1 is exists: $compath"
info "Command $CMD is exists: $compath"
epm qf "$compath"
fi
return 0
fi
# TODO: use package name normalization
info "Installing appropriate package for $1 command..."
return 1
}
# Do fast checking for command and install package if the command does not exist
# $1 - command name
# $2 - [package name]
# $3 - [needed package version]
__epm_assure()
{
local CMD="$1"
local PACKAGE="$2"
local PACKAGEVERSION="$3"
[ -n "$PACKAGE" ] || PACKAGE="$1"
local PACKAGEVERSION="$3"
warning "TODO: check for PACKAGEVERSION is missed"
__epm_assure_checking $CMD $PACKAGE $PACKAGEVERSION && return 0
info "Installing appropriate package for $CMD command..."
__epm_need_update $PACKAGE $PACKAGEVERSION || return 0
docmd epm --auto install $PACKAGE || return
docmd epm --auto --skip-installed install "$PACKAGE"
[ -n "$PACKAGEVERSION" ] || return 0
# check if we couldn't update and still need update
__epm_need_update $PACKAGE $PACKAGEVERSION && return 1
return 0
}
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015, 2016 Etersoft
# Copyright (C) 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
......@@ -17,6 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__epm_orphan_altrpm()
{
docmd "apt-cache list-extras"
}
epm_autoorphans()
{
......@@ -24,29 +29,39 @@ epm_autoorphans()
case $PMTYPE in
#apt-rpm)
apt-rpm)
# ALT Linux only
#__epm_autoremove_altrpm
# ALT Linux only
#assure_exists remove-old-kernels
#sudocmd remove-old-kernels
# ;;
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
echo "We will try remove all installed packages which are missed in repositories"
warning "Use with caution!"
local PKGLIST=$(__epm_orphan_altrpm \
| sed -e "s/\.32bit//g" \
| grep -v -- "^eepm$" \
| grep -v -- "^kernel")
docmd epm remove $PKGLIST
;;
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)
sudocmd epm remove $PKGLIST
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 -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST
;;
urpm-rpm)
showcmd urpmq --auto-orphans
showcmd urpme --report-orphans
sudocmd urpme --auto-orphans
;;
#emerge)
......@@ -67,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"
;;
......
#!/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
......@@ -17,39 +17,98 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__epm_autoremove_altrpm()
__epm_autoremove_altrpm_pp()
{
local pkg
local pkgs
info "Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force
local flag=
load_helper epm-packages
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
libexclude='^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
showcmd "apt-cache list-nodeps | grep -E -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" )
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then
info ""
info "call again for next cycle until all modules will be removed"
__epm_autoremove_altrpm_pp
fi
return 0
}
__epm_autoremove_altrpm_lib()
{
local pkgs
info
info "Just removing all non -devel libs packages not need by anything"
for pkg in $(short=1 pkg_filenames= epm_packages | grep -- "^lib" | grep -v -- "-devel$" | grep -v -- "-debuginfo$" | grep -v -- ^libreoffice | grep -v -- libnss- ) ; do
sudocmd rpm -v -e $pkg && flag=1
done
info "Removing all non -devel/-debuginfo libs packages not need by anything..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force
# call again for next cycle until all libs will removed
[ -n "$flag" ] && __epm_autoremove_altrpm
local flag=
local libexclude='^lib'
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \
| grep -E -v -- "-(devel|devel-static|debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| sed -e "s/\.32bit$//g" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then
info ""
info "call again for next cycle until all libs will be removed"
__epm_autoremove_altrpm_lib
fi
return 0
}
__epm_autoremove_altrpm()
{
local pkg
load_helper epm-packages
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
__epm_autoremove_altrpm_pp
__epm_autoremove_altrpm_lib
return 0
}
# TODO: keep our eepm package
epm_autoremove()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
# ALT Linux only
case $DISTRNAME in
ALTLinux)
__epm_autoremove_altrpm
docmd epm remove-old-kernels
if which nvidia-clean-driver 2>/dev/null ; then
sudocmd nvidia-clean-driver
fi
# ALT Linux only
assure_exists remove-old-kernels
sudocmd remove-old-kernels
return
;;
*)
;;
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg)
sudocmd apt-get autoremove
;;
......@@ -61,7 +120,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")
local PKGLIST=$(package-cleanup -q --leaves | grep -v "^eepm-")
[ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST
done
......@@ -92,9 +151,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
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru>
# 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
......@@ -17,10 +17,124 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__use_url_install()
{
case $DISTRNAME in
"ALTLinux")
pkg_names="$pkg_names $pkg_urls"
return 0
;;
esac
case $PMTYPE in
#apt-rpm)
# 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 docmd 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=
# FIXME: check type of pkg_urls separately?
if [ "$(get_package_type "$pkg_urls")" != $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_get_altpkg_url()
{
info "TODO: https://packages.altlinux.org/api/branches"
load_helper epm-site
local arch=$(paoapi packages/$1 | get_pao_var arch)
# FIXME: arch can be list
[ "$arch" = "noarch" ] || arch=$(arch)
# HACK: filename can be list
local filename=$(paoapi packages/$1 | get_pao_var filename | grep $arch)
# fixme: get from /branches
local dv=$DISTRNAME/$DISTRVERSION/branch
[ "$DISTRVERSION" = "Sisyphus" ] && dv=$DISTRNAME/$DISTRVERSION
echo "http://ftp.basealt.ru/pub/distributions/$dv/$arch/RPMS.classic/$filename"
}
epm_download()
{
local CMD
case $DISTRNAME in
ALTLinux)
local pkg
for pkg in $pkg_filenames ; do
local url=$(__epm_get_altpkg_url $pkg)
[ -n "$url" ] || warning "Can't get url for $pkg"
docmd eget $url
done
return
;;
esac
case $PMTYPE in
dnf-rpm)
sudocmd dnf download $pkg_filenames
......@@ -28,6 +142,17 @@ epm_download()
aptcyg)
sudocmd apt-cyg download $pkg_filenames
;;
yum-rpm)
# TODO: check yum install --downloadonly --downloaddir=/tmp <package-name>
assure_exists yumdownloader yum-utils
sudocmd yumdownloader $pkg_filenames
;;
dnf-rpm)
sudocmd dnf download $pkg_filenames
;;
tce)
sudocmd tce-load -w $pkg_filenames
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-install
epm_epm_install(){
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
;;
......
#!/bin/sh
#
# Copyright (C) 2012-2013 Etersoft
# Copyright (C) 2012-2013 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
......@@ -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()
{
......@@ -101,7 +93,7 @@ epm_install_names()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
sudocmd apt-get $APTOPTIONS install $@
sudocmd apt-get $APTOPTIONS $noremove install $@
return ;;
aptitude-dpkg)
sudocmd aptitude install $@
......@@ -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
......@@ -166,6 +158,9 @@ epm_install_names()
apk)
sudocmd apk add $@
return ;;
tce)
sudocmd tce-load -wi $@
return ;;
guix)
__separate_sudocmd "guix package -i" "guix package -i" $@
return ;;
......@@ -175,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"
;;
......@@ -188,10 +186,10 @@ epm_ni_install_names()
case $PMTYPE in
apt-rpm|apt-dpkg)
export DEBIAN_FRONTEND=noninteractive
sudocmd apt-get -y --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 ;;
aptitude-dpkg)
sudocmd aptitde -y install $@
sudocmd aptitude -y install $@
return ;;
yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@
......@@ -237,6 +235,16 @@ epm_ni_install_names()
apk)
sudocmd apk add $@
return ;;
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 ;;
......@@ -256,6 +264,82 @@ __epm_check_if_rpm_already_installed()
LANG=C $SUDO rpm -Uvh $force $nodeps $@ 2>&1 | grep -q "is already installed"
}
# TODO: rewrite to convert (get some code from Korinf?)
__epm_check_if_try_install_deb()
{
local pkg
local debpkgs=""
for pkg in $@ ; do
[ "$(get_package_type "$pkg")" = "deb" ] || return 1
[ -e "$pkg" ] || fatal "Can't read $pkg"
debpkgs="$debpkgs $(realpath $pkg)"
done
[ -n "$debpkgs" ] || return 1
assure_exists alien
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $debpkgs ; do
# 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/
return 0
}
# TODO: rewrite to convert (get some code from Korinf?)
__epm_check_if_try_install_rpm()
{
local pkg
local rpmpkgs=""
for pkg in $@ ; do
[ "$(get_package_type "$pkg")" = "rpm" ] || return 1
[ -e "$pkg" ] || fatal "Can't read $pkg"
rpmpkgs="$rpmpkgs $(realpath $pkg)"
done
[ -n "$rpmpkgs" ] || return 1
assure_exists alien
assure_exists fakeroot
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $rpmpkgs ; do
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/
return 0
}
__handle_direct_install()
{
case "$DISTRNAME" in
"ALTLinux")
load_helper epm-download
local pkg url
for pkg in $pkg_names ; do
url=$(__epm_get_altpkg_url $pkg)
[ -n "$url" ] || continue
# TODO: use estrlist
pkg_urls="$pkg_urls $url"
done
# FIXME: need remove
pkg_names=""
;;
esac
}
epm_install_files()
{
......@@ -267,21 +351,30 @@ epm_install_files()
case $PMTYPE in
apt-rpm)
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
__epm_check_if_try_install_deb $@ && return
__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
;;
apt-dpkg|aptitude-dpkg)
# the new version of the conf. file is installed with a .dpkg-dist suffix
if [ -n "$non_interactive" ] ; then
DPKGOPTIONS="--force-confdef --force-confold"
fi
__epm_check_if_try_install_rpm $@ && return
# FIXME: return false in case no install and in case install with broken deps
sudocmd dpkg $DPKGOPTIONS -i $@
local RES=$?
......@@ -296,7 +389,10 @@ epm_install_files()
sudocmd dpkg $DPKGOPTIONS -i $@
return
;;
yum-rpm|dnf-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
# if run with --nodeps, do not fallback on hi level
......@@ -306,7 +402,9 @@ epm_install_files()
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
......@@ -318,7 +416,9 @@ epm_install_files()
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
......@@ -406,6 +506,17 @@ epm_print_install_command()
aptcyg)
echo "apt-cyg install $@"
;;
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"
;;
......@@ -420,27 +531,34 @@ 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 [ -n "$direct" ] ; then
__handle_direct_install
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_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
if [ -z "$files" ] ; then
if [ -z "$files" ] && [ -z "$direct" ] ; then
# it is useful for first time running
update_repo_if_needed
fi
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
}
#!/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
......@@ -28,8 +28,9 @@ epm_kernel_update()
info "No installed kernel packages, skipping update"
return
fi
assure_exists update-kernel
sudocmd update-kernel $pkg_filenames
assure_exists update-kernel update-kernel 0.9.9
sudocmd update-kernel $pkg_filenames || return
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"
......@@ -125,12 +136,26 @@ case $PMTYPE in
apk)
CMD="apk info"
;;
tce)
CMD="ls -1 /usr/local/tce.installed"
;;
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)
......@@ -149,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
}
......@@ -39,7 +39,9 @@ print_binpkgfilelist()
local PKGNAME=$(basename $2)
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
rpmquery -p --qf='%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n' "{}" \; \
| grep "^$PKGNAME[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo -n "$PKGDIR/{} "
| grep "^$PKGNAME[[:space:]].*" \
| cut -f2 \
| xargs -n1 -I "{}" echo -n "$PKGDIR/{} "
}
# TODO: need try detect more strict
......@@ -88,6 +90,11 @@ print_srcpkgname()
query_package_field sourcerpm "$@"
}
compare_version()
{
which rpmevrcmp 2>/dev/null >/dev/null || fatal "rpmevrcmp exists in ALT Linux only"
rpmevrcmp "$@"
}
__epm_print()
{
......@@ -124,6 +131,7 @@ cat <<EOF
epm print srcpkgname from [filename|package] NN print source package name for the binary package file
epm print specname from filename NN print spec filename for the source package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
epm print compare [package] version N1 N2 compare (package) versions and print -1, 0, 1
EOF
;;
"name")
......@@ -194,6 +202,15 @@ EOF
[ -n "$1" ] || fatal "source package filename is missed"
print_binpkgfilelist "$DIR" "$1"
;;
"compare")
[ "$1" = "version" ] && shift
[ -n "$1" ] || fatal "Arg is missed"
#if [ -n "$PKFLAG" ] ; then
# query_package_field "name" "$@"
#else
compare_version "$1" "$2"
#fi
;;
*)
fatal "Unknown command $ epm print $WHAT. Use epm print help for get help."
;;
......
#!/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
......@@ -146,6 +151,16 @@ __epm_query_file()
docmd $CMD $@
}
# hack: dpkg -W will print names for removed packages too (until newest Ubuntu)
__epm_query_dpkg_check()
{
local i
for i in $@ ; do
a= dpkg -s $i >/dev/null 2>/dev/null || return
done
return 0
}
__epm_query_name()
{
local CMD
......@@ -158,7 +173,10 @@ __epm_query_name()
;;
*-dpkg)
#docmd dpkg -l $@ | grep "^ii"
CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n"
#CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n"
docmd dpkg-query -W "--showformat=\${Package}-\${Version}\n" $@ || return
__epm_query_dpkg_check $@ || return
return
;;
npackd)
docmd "npackdcl path --package=$@"
......@@ -168,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
......@@ -197,7 +215,10 @@ __epm_query_shortname()
CMD="rpm -q --queryformat %{name}\n"
;;
*-dpkg)
CMD="dpkg-query -W --showformat=\${Package}\n"
#CMD="dpkg-query -W --showformat=\${Package}\n"
docmd dpkg-query -W "--showformat=\${Package}\n" $@ || return
__epm_query_dpkg_check $@ || return
return
;;
npackd)
docmd "npackdcl path --package=$@"
......@@ -207,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
......@@ -228,7 +249,7 @@ __epm_query_shortname()
# check if pkg is installed
is_installed()
{
short=1 pkg_filenames="$@" pkg_names="$@" epm_query >/dev/null 2>/dev/null
__epm_query_shortname $pkg_names >/dev/null 2>/dev/null
# broken way to recursive call here (overhead!)
#epm installed $@ >/dev/null 2>/dev/null
}
......
#!/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 ;;
......
......@@ -35,15 +35,21 @@ __wcount()
__detect_alt_release_by_repo()
{
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \
grep -v "^#" | grep "p[5-9]/branch/" | sed -e "s|.*\(p[5-9]\)/branch.*|\1|g" | sort -u )
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list \
| grep -v "^#" \
| grep "p[5-9]/branch/" \
| sed -e "s|.*\(p[5-9]\)/branch.*|\1|g" \
| sort -u )
if [ $(__wcount $BRD) = "1" ] ; then
echo "$BRD"
return
fi
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \
grep -v "^#" | grep "Sisyphus/" | sed -e "s|.*\(Sisyphus\).*|\1|g" | sort -u )
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list \
| grep -v "^#" \
| grep "Sisyphus/" \
| sed -e "s|.*\(Sisyphus\).*|\1|g" \
| sort -u )
if [ $(__wcount $BRD) = "1" ] ; then
echo "$BRD"
return
......@@ -58,39 +64,48 @@ __replace_alt_version_in_repo()
assure_exists apt-repo
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
confirm "Are these correct changes?" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
# ask and replace only we will have changes
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
docmd apt-repo list
}
__alt_repofix()
{
load_helper epm-repofix
pkg_filenames= epm_repofix
showcmd epm repofix
quiet=1 pkg_filenames= epm_repofix >/dev/null
__replace_text_in_alt_repo "/^ *#/! s!\[p[6-9]\]![updates]!g"
}
get_fix_release_pkg()
{
# TODO: check for version incompatibilities
if epmqf /etc/altlinux-release | grep -q sisyphus ; then
echo altlinux-release-$1
fi
}
__update_to_the_distro()
{
__alt_repofix
case "$1" in
p7)
docmd epm update || fatal
docmd epm install apt rpm apt-conf-branch altlinux-release-p7 || fatal "Check an error and run epm release-upgrade again"
docmd epm install apt rpm apt-conf-branch $(get_fix_release_pkg p7) || fatal "Check an error and run epm release-upgrade again"
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![p7]!g"
docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
docmd epm update-kernel
info "Done."
info "Run epm release-upgrade again for update to p8"
;;
p8)
docmd epm update || fatal
if ! docmd epm install apt rpm apt-conf-branch altlinux-release-p8 ; then
# error: execution of %post scriptlet from glibc-core-2.23-alt1.eter1
docmd epm erase glibc-core-2.17 || fatal "Check an error and run epm release-upgrade again"
docmd epm install apt rpm apt-conf-branch altlinux-release-p8 || fatal "Check an error and run epm release-upgrade again"
if ! docmd epm install apt rpm apt-conf-branch $(get_fix_release_pkg p8) ; then
# Hack for error: execution of %post scriptlet from glibc-core-2.23-alt1.eter1
docmd rpm -ev glibc-core-2.17 || fatal "Check an error and run epm release-upgrade again"
docmd epm install apt rpm apt-conf-branch $(get_fix_release_pkg p8) || fatal "Check an error and run epm release-upgrade again"
fi
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![p8]!g"
......@@ -99,19 +114,11 @@ __update_to_the_distro()
docmd epm install systemd || fatal
fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
#info " # epmi branding-simply-linux-release branding-simply-linux-graphics"
docmd epm update-kernel || fatal
info "Done."
;;
Sisyphus)
docmd epm update || fatal
docmd epm install apt rpm apt-conf-sisyphus altlinux-release-sisyphus || fatal "Check an error and run again"
#__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__alt_repofix
docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
docmd epm update-kernel || fatal
info "Done."
;;
*)
esac
......@@ -127,30 +134,42 @@ __update_alt_to_next_distro()
docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo p6/branch/ p7/branch/
__update_to_the_distro p7
docmd epm update-kernel
info "Done."
info "Run epm release-upgrade again for update to p8"
;;
"p7"|"p7 p8")
info "Upgrade $DISTRNAME from p7 to p8 ..."
docmd epm install apt-conf-branch altlinux-release-p7 || fatal
docmd epm install apt-conf-branch $(get_fix_release_pkg p7) || fatal
__replace_alt_version_in_repo p7/branch/ p8/branch/
__update_to_the_distro p8
docmd epm update-kernel || fatal
info "Done."
;;
"Sisyphus p8")
info "Downgrade $DISTRNAME from Sisyphus to p8 ..."
docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo Sisyphus/ p8/branch/
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![p8]!g"
__update_to_the_distro p8
docmd epm downgrade || fatal
info "Done."
;;
"p8 Sisyphus")
info "Upgrade $DISTRNAME from p8 to Sisyphus ..."
docmd epm install apt-conf-branch || fatal
docmd epm upgrade || fatal
__alt_repofix
__replace_alt_version_in_repo p8/branch/ Sisyphus/
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__update_to_the_distro Sisyphus
docmd epm update-kernel || fatal
info "Done."
;;
*)
warning "Have no idea how to update from $DISTRNAME $DISTRVERSION."
info "Try run f.i. # epm release-upgrade p8"
info "Try run f.i. # epm release-upgrade p8 or # epm release-upgrade Sisyphus"
info "Also possible you need install altlinux-release-p? package for correct distro version detecting"
return 1
esac
}
......@@ -163,16 +182,21 @@ epm_release_upgrade()
case $DISTRNAME in
ALTLinux)
__alt_repofix
docmd epm update
docmd epm install apt rpm
# try to detect current release by repo
if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then
DISTRVERSION="$(__detect_alt_release_by_repo)"
[ "$DISTRVERSION" != "Sisyphus" ] && info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)"
local dv
dv="$(__detect_alt_release_by_repo)"
if [ -n "$dv" ] && [ "$dv" != "$DISTRVERSION" ] ; then
DISTRVERSION="$dv"
info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)"
fi
fi
__alt_repofix
# check forced target
if [ -n "$pkg_filenames" ] ; then
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
......@@ -187,10 +211,11 @@ epm_release_upgrade()
case $PMTYPE in
apt-rpm)
docmd epm update
#docmd epm update
info "Have no idea how to upgrade $DISTRNAME"
;;
*-dpkg)
assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade -d
;;
yum-rpm)
......@@ -200,6 +225,18 @@ epm_release_upgrade()
showcmd rpm -Uvh http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm
docmd epm Upgrade
;;
dnf-rpm)
info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm install dnf
sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade
sudocmd dnf system-upgrade
local RELEASEVER="$pkg_filenames"
[ -n "$RELEASEVER" ] || fatal "Run me with new version"
sudocmd dnf system-upgrade download --refresh --releasever=$RELEASEVER
sudocmd dnf system-upgrade
info "Run epm autoorphans to remove orphaned packages"
;;
urpm-rpm)
sudocmd urpmi.removemedia -av
# TODO
......
#!/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"
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015-2016 Etersoft
# Copyright (C) 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
......@@ -17,6 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
__repofix_check_vendor()
{
local i
for i in /etc/apt/vendors.list.d/*.list; do
[ -e "$i" ] || continue
grep -q "^simple-key \"$1\"" $i && return
done
return 1
}
__fix_apt_sources_list()
{
......@@ -30,11 +41,32 @@ __fix_apt_sources_list()
#sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE" $i
# add signs
# Sisyphus uses 'alt' vendor key
if __repofix_check_vendor alt ; then
regexp_subst "/ALTLinux\/Sisyphus\//s/^rpm *([fhr])/rpm [alt] \1/" $i
else
warning "Skip set alt vendor key (it misssed)"
fi
# skip branch replacement for ALT Linux Sisyphus
[ "$DISTRVERSION" = "Sisyphus" ] && continue
# add signs for branches
local br
for br in $DISTRVERSION ; do
# sed -r -e "/ALTLinux\/p8\/branch/s/rpm *([fhr])/rpm [p8] \1/"
if ! __repofix_check_vendor $br ; then
warning "Skip set $br vendor key (it misssed)"
continue
fi
regexp_subst "/ALTLinux\/$br\/branch/s/^rpm *([fhr])/rpm [$br] \1/" $i
done
for br in $DISTRVERSION ; do
#if is_installed apt-conf-etersoft-common ; then
if ! __repofix_check_vendor etersoft ; then
warning "Skip set etersoft vendor key (it misssed)"
continue
fi
regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
done
done
......@@ -48,18 +80,22 @@ epm_repofix()
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
docmd apt-repo list
[ -n "$quiet" ] || docmd apt-repo list
__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
......@@ -67,6 +67,9 @@ case $PMTYPE in
apk)
CMD="apk search"
;;
tce)
CMD="tce-ab"
;;
conary)
CMD="conary repquery"
;;
......@@ -94,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,14 @@ __alt_local_content_search()
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
# TODO use something like
[ -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 +74,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
......
......@@ -154,6 +154,14 @@ sudocmd_foreach()
done
}
# add realpath if missed
if ! which realpath 2>/dev/null >/dev/null ; then
realpath()
{
readlink -f "$@"
}
fi
get_firstarg()
{
echon "$1"
......@@ -200,6 +208,12 @@ store_output()
#return $PIPESTATUS
}
showcmd_store_output()
{
showcmd "$@"
store_output "$@"
}
clean_store_output()
{
rm -f $RC_STDOUT $RC_STDOUT.pipestatus
......@@ -208,7 +222,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
......@@ -261,7 +276,12 @@ set_sudo()
[ $EFFUID = "0" ] && return
# use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo --" && return
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 2>/dev/null | grep -q " --" || SUDO="sudo"
return
fi
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
......@@ -336,13 +356,16 @@ assure_exists()
{
load_helper epm-assure
local package="$2"
local textpackage=
[ -n "$package" ] || package="$(__get_package_for_command "$1")"
__epm_assure "$1" $package || fatal "Can't assure in '$1' command"
[ -n "$3" ] && textpackage=" >= $3"
__epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package"
}
eget()
{
$SHAREDIR/tools-eget "$@"
assure_exists wget
$SHAREDIR/tools_eget "$@"
}
# TODO: improve and drop!
......@@ -387,6 +410,10 @@ get_package_type()
# print options description from HELPCMD/HELPOPT lines in the code
get_help()
{
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return
fi
grep -v -- "^#" $0 | grep -- "# $1" | while read n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g")
......@@ -412,6 +439,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"
......@@ -420,7 +449,7 @@ case $DISTRNAME in
PCLinux)
CMD="apt-rpm"
;;
Ubuntu|Debian|Mint)
Ubuntu|Debian|Mint|AstraLinux|Elbrus)
CMD="apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
which snappy 2>/dev/null >/dev/null && CMD=snappy
......@@ -445,7 +474,7 @@ case $DISTRNAME in
Slackware)
CMD="slackpkg"
;;
SUSE|SLED|SLES)
SUSE|SLED|SLES|Tumbleweed)
CMD="zypper-rpm"
;;
ForesightLinux|rPathLinux)
......@@ -472,6 +501,12 @@ case $DISTRNAME in
alpine)
CMD="apk"
;;
TinyCoreLinux)
CMD="tce"
;;
VoidLinux)
CMD="xbps"
;;
*)
fatal "Have no suitable DISTRNAME $DISTRNAME"
;;
......@@ -489,5 +524,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
}
......@@ -22,6 +22,24 @@ load_helper epm-print
PAOURL="https://packages.altlinux.org"
paoapi()
{
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1
showcmd curl "$PAOURL/api/$1"
a= curl -s --header "Accept: application/json" "$PAOURL/api/$1"
}
# TODO: use /home/lav/Projects/git/JSON.sh
get_pao_var()
{
local FIELD="$1"
#grep '"$FIELD"' | sed -e 's|.*"$FIELD":"||g' | sed -e 's|".*||g'
$SHAREDIR/tools_json -b | egrep "\[.*\"$FIELD\"\]" | sed -e 's|.*[[:space:]]"\(.*\)"|\1|g'
return 0
}
run_command_if_exists()
{
local CMD="$1"
......@@ -43,14 +61,9 @@ open_browser()
__query_package_hl_url()
{
local PAOAPI="$PAOURL/api"
case $DISTRNAME in
ALTLinux)
# 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'
return 0
paoapi srpms/$1 | get_pao_var url
;;
esac
return 1
......
#!/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"
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 update"
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"
;;
......
epm
\ No newline at end of file
......@@ -76,10 +76,13 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig"
;;
VoidLinux)
CMD="runit"
;;
Slackware)
CMD="service-initd"
;;
SUSE|SLED|SLES)
SUSE|SLED|SLES|Tumbleweed)
CMD="service-chkconfig"
;;
# Windows)
......@@ -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/sh
# License: MIT or Apache
# Homepage: http://github.com/dominictarr/JSON.sh
throw() {
echo "$*" >&2
exit 1
}
BRIEF=0
LEAFONLY=0
PRUNE=0
NO_HEAD=0
NORMALIZE_SOLIDUS=0
usage() {
echo
echo "Usage: JSON.sh [-b] [-l] [-p] [-s] [-h]"
echo
echo "-p - Prune empty. Exclude fields with empty values."
echo "-l - Leaf only. Only show leaf nodes, which stops data duplication."
echo "-b - Brief. Combines 'Leaf only' and 'Prune empty' options."
echo "-n - No-head. Do not show nodes that have no path (lines that start with [])."
echo "-s - Remove escaping of the solidus symbol (straight slash)."
echo "-h - This help text."
echo
}
parse_options() {
set -- "$@"
local ARGN=$#
while [ "$ARGN" -ne 0 ]
do
case $1 in
-h) usage
exit 0
;;
-b) BRIEF=1
LEAFONLY=1
PRUNE=1
;;
-l) LEAFONLY=1
;;
-p) PRUNE=1
;;
-n) NO_HEAD=1
;;
-s) NORMALIZE_SOLIDUS=1
;;
?*) echo "ERROR: Unknown option."
usage
exit 0
;;
esac
shift 1
ARGN=$((ARGN-1))
done
}
awk_egrep () {
local pattern_string=$1
gawk '{
while ($0) {
start=match($0, pattern);
token=substr($0, start, RLENGTH);
print token;
$0=substr($0, start+RLENGTH);
}
}' pattern="$pattern_string"
}
tokenize () {
local GREP
local ESCAPE
local CHAR
if echo "test string" | egrep -ao --color=never "test" >/dev/null 2>&1
then
GREP='egrep -ao --color=never'
else
GREP='egrep -ao'
fi
if echo "test string" | egrep -o "test" >/dev/null 2>&1
then
ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR='[^[:cntrl:]"\\]'
else
GREP=awk_egrep
ESCAPE='(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR='[^[:cntrl:]"\\\\]'
fi
local STRING="\"$CHAR*($ESCAPE$CHAR*)*\""
local NUMBER='-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?'
local KEYWORD='null|false|true'
local SPACE='[[:space:]]+'
# Force zsh to expand $A into multiple words
local is_wordsplit_disabled=$(unsetopt 2>/dev/null | grep -c '^shwordsplit$')
if [ $is_wordsplit_disabled != 0 ]; then setopt shwordsplit; fi
$GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | egrep -v "^$SPACE$"
if [ $is_wordsplit_disabled != 0 ]; then unsetopt shwordsplit; fi
}
parse_array () {
local index=0
local ary=''
read -r token
case "$token" in
']') ;;
*)
while :
do
parse_value "$1" "$index"
index=$((index+1))
ary="$ary""$value"
read -r token
case "$token" in
']') break ;;
',') ary="$ary," ;;
*) throw "EXPECTED , or ] GOT ${token:-EOF}" ;;
esac
read -r token
done
;;
esac
[ "$BRIEF" -eq 0 ] && value=$(printf '[%s]' "$ary") || value=
:
}
parse_object () {
local key
local obj=''
read -r token
case "$token" in
'}') ;;
*)
while :
do
case "$token" in
'"'*'"') key=$token ;;
*) throw "EXPECTED string GOT ${token:-EOF}" ;;
esac
read -r token
case "$token" in
':') ;;
*) throw "EXPECTED : GOT ${token:-EOF}" ;;
esac
read -r token
parse_value "$1" "$key"
obj="$obj$key:$value"
read -r token
case "$token" in
'}') break ;;
',') obj="$obj," ;;
*) throw "EXPECTED , or } GOT ${token:-EOF}" ;;
esac
read -r token
done
;;
esac
[ "$BRIEF" -eq 0 ] && value=$(printf '{%s}' "$obj") || value=
:
}
parse_value () {
local jpath="${1:+$1,}$2" isleaf=0 isempty=0 print=0
case "$token" in
'{') parse_object "$jpath" ;;
'[') parse_array "$jpath" ;;
# At this point, the only valid single-character tokens are digits.
''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;;
*) value=$token
# if asked, replace solidus ("\/") in json strings with normalized value: "/"
[ "$NORMALIZE_SOLIDUS" -eq 1 ] && value=$(echo "$value" | sed 's#\\/#/#g')
isleaf=1
[ "$value" = '""' ] && isempty=1
;;
esac
[ "$value" = '' ] && return
[ "$NO_HEAD" -eq 1 ] && [ -z "$jpath" ] && return
[ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 0 ] && print=1
[ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && [ $PRUNE -eq 0 ] && print=1
[ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 1 ] && [ "$isempty" -eq 0 ] && print=1
[ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && \
[ $PRUNE -eq 1 ] && [ $isempty -eq 0 ] && print=1
[ "$print" -eq 1 ] && printf "[%s]\t%s\n" "$jpath" "$value"
:
}
parse () {
read -r token
parse_value
read -r token
case "$token" in
'') ;;
*) throw "EXPECTED EOF GOT $token" ;;
esac
}
if ([ "$0" = "$BASH_SOURCE" ] || ! [ -n "$BASH_SOURCE" ]);
then
parse_options "$@"
tokenize | parse
fi
# vi: expandtab sw=2 ts=2
/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 p6 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.7.3
Version: 1.9.9
Release: alt0.M60P.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,145 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Sat Apr 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.3-alt0.M60P.1
* Thu Dec 08 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.9-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Wed Dec 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.9-alt1
- add realpath realization if missed
- add openSUSE Tumbleweed support
- autoremove: do separate removing cycles for python/perl and libs
- epm-site: fix json parsing
- epm-download: realize download via info from packages.altlinux.org
- epm-install: add direct install (not via apt) support for ALT Linux
- addrepo: implement support for epm addrepo etersoft
* 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
- epm-sh: add AstraLinux and Elbrus support
- add epmrl alias for epm rl
- epm-autoremove: add nvidia-clean-driver
- epm-autoremove: use ALTLinux case instead apt-rpm
* Sat Jun 25 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.5-alt1
- add Tiny Core Linux support (tcl, tce)
- improve dnf support: add release-upgrade
- improve ALT Linux release upgrade
* Mon May 30 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.4-alt1
- epm install: add initial support for cross install packages (deb/rpm packages on rpm/deb-based hosts)
- install: add --noremove support for apt
- repofix: add check for vendor key if set it
- add check if sudo supports --
- repofix: skip useless Sisyphus replacements
- release_upgrade: skip confirm if there are no changes
- epm-query: add semihack for check removed packages
- epm: add support for run script from stdin
* Mon May 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.3-alt1
- autoorphans: do real removing
- autoremove: add update-kernel version 0.9.9 checking
- autoorphans/autoremove: improve excludes
* Fri May 20 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.2-alt1
- epm_install: added command for install or update eepm package from all in one script
- add --no-remove support during upgrade
- epm-download: add yumdownloader support
- epm-autoorphans: realize print list
- epm-autoremove: realize with apt-cache list-nodeps from apt-scripts
- epm-assure: fix for existing path checking
- distr_info: drop subversion from Debian distro version
* Thu Apr 28 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.1-alt1
- release-upgrade: install altlinux-release-p? only if /etc/altlinux-release belongs to sisyphus
* Wed Apr 27 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.0-alt1
- commit packed files
- repofix: replace Etersoft branches only if have Etersoft key
- release_upgrade: install update-manager-core package for deb-based
* Sun Apr 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.6-alt1
- fix assure_exists
- epm-assure: improve version checking
* Sun Apr 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.5-alt1
- epm-print: add compare version command
- repofix: fix Sisyphus replace
- release_upgrade: do packages downgrade after changes to p8 from Sisyphus
- epm-assure: rewrite to realize correct version comparing
- kernel_update: run remove-old-kernels too
* Sat Apr 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.4-alt1
- release-upgrade: small logic improvements
* Sat Apr 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.3-alt1
- epm release-upgrade: check for glibc-core-2.17
- release-upgrade: add detect current system by apt repo
......
......@@ -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,10 @@ 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|$SHAREDIR/tools_json|internal_tools_json|g' | \
sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g"
}
......@@ -59,7 +63,9 @@ 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
incorporate_subfile tools_json
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