Commit 537524b7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 89b43b7e d8814981
......@@ -6,14 +6,15 @@ instpkgdatadir=$(pkgdatadir)
install:
mkdir -p $(DESTDIR)$(bindir)/
# breaks link
#install -m 755 `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "[-_]"` $(DESTDIR)$(bindir)/
cp -a bin/distr_info $(DESTDIR)$(bindir)/
chmod 0755 $(DESTDIR)$(bindir)/*
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/epm >$(DESTDIR)$(bindir)/epm
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/serv >$(DESTDIR)$(bindir)/serv
mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "[-_]"` $(DESTDIR)$(pkgdatadir)/
rm -f $(DESTDIR)$(pkgdatadir)/distr_info
mkdir -p $(DESTDIR)$(mandir)/man1
cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man1/
......@@ -50,13 +50,14 @@ case $PMTYPE in
# ;;
yum-rpm)
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans | grep -v "^eepm$")
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST
;;
dnf-rpm)
# TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead.
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans | grep -v "^eepm$")
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST
;;
urpm-rpm)
......
......@@ -89,7 +89,7 @@ case $PMTYPE in
while true ; do
docmd package-cleanup --leaves $(subst_option non_interactive --assumeyes)
# FIXME: package-cleanup have to use stderr for errors
local PKGLIST=$(package-cleanup --leaves | grep -v "Loaded plugins" | grep -v "Unable to" | grep -v "^eepm$")
local PKGLIST=$(package-cleanup -q --leaves | grep -v "^eepm-")
[ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST
done
......
#!/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
}
......@@ -90,10 +90,18 @@ epm_downgrade()
;;
yum-rpm)
# can do update repobase automagically
if [ -n "$pkg_filenames" ] ; then
sudocmd yum downgrade $pkg_filenames
else
sudocmd yum distro-sync
fi
;;
dnf-rpm)
if [ -n "$pkg_filenames" ] ; then
sudocmd dnf downgrade $pkg_filenames
else
sudocmd dnf distro-sync
fi
;;
urpm-rpm)
assure_exists urpm-reposync urpm-tools
......
......@@ -17,6 +17,88 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__use_url_install()
{
case $PMTYPE in
apt-rpm)
# ALT Linux really?
pkg_names="$pkg_names $pkg_urls"
;;
#deepsolver-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
#urpm-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
pacman)
pkg_names="$pkg_names $pkg_urls"
;;
yum-rpm|dnf-rpm)
pkg_names="$pkg_names $pkg_urls"
;;
#zypper-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
*)
return 1
;;
esac
return 0
}
# for download before install / checking
__download_pkg_urls()
{
local url
[ -z "$pkg_urls" ] && return
for url in $pkg_urls ; do
# TODO: use some individual tmp dir
local new_file=/tmp/$(basename "$url")
if eget -O $new_file $url && [ -s "$new_file" ] ; then
pkg_files="$pkg_files $new_file"
to_remove_pkg_files="$to_remove_pkg_files $new_file"
else
warning "Failed to download $url, ignoring"
fi
done
}
# NOTE: call __clean_downloaded_pkg_files after
__handle_pkg_urls_to_install()
{
#[ -n "$pkg_urls" ] || return
# TODO: do it correctly
to_remove_pkg_files=
if [ "$(get_package_type "$pkg")" != $PKGFORMAT ] || ! __use_url_install ; then
# use workaround with eget: download and put in pkg_files
__download_pkg_urls
fi
pkg_urls=
}
__handle_pkg_urls_to_checking()
{
#[ -n "$pkg_urls" ] || return
# TODO: do it correctly
to_remove_pkg_files=
# use workaround with eget: download and put in pkg_files
__download_pkg_urls
pkg_urls=
}
#__clean_downloaded_pkg_files()
#{
# [ -z "$to_remove_pkg_files" ] && return
# rm -fv $to_remove_pkg_files
#}
epm_download()
{
local CMD
......
......@@ -506,64 +506,6 @@ epm_print_install_command()
esac
}
download_pkg_urls()
{
local url
[ -z "$pkg_urls" ] && return
for url in $pkg_urls ; do
# TODO: use some individual tmp dir
local new_file=/tmp/$(basename "$url")
if eget -O $new_file $url && [ -s "$new_file" ] ; then
pkg_files="$pkg_files $new_file"
to_remove_pkg_files="$to_remove_pkg_files $new_file"
else
warning "Failed to download $url, ignoring"
fi
done
}
__use_url_install()
{
case $PMTYPE in
apt-rpm)
# ALT Linux really?
pkg_names="$pkg_names $pkg_urls"
;;
#deepsolver-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
#urpm-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
pacman)
pkg_names="$pkg_names $pkg_urls"
;;
yum-rpm|dnf-rpm)
pkg_names="$pkg_names $pkg_urls"
;;
#zypper-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
*)
return 1
;;
esac
return 0
}
__handle_pkg_urls()
{
[ -n "$pkg_urls" ] || return
# TODO: do it correctly
to_remove_pkg_files=
if [ "$(get_package_type "$pkg")" != $PKGFORMAT ] || ! __use_url_install ; then
# use workaround with eget: download and put in pkg_files
download_pkg_urls
fi
pkg_urls=
}
epm_install()
{
......@@ -572,8 +514,11 @@ epm_install()
return
fi
# in any case it will put pkg_urls into pkg_files or pkg_names
__handle_pkg_urls
# 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" ] && info "Skip empty install list" && return 22
......@@ -589,9 +534,10 @@ epm_install()
epm_install_names $names || return
epm_install_files $files
local RETVAL=$?
# TODO: reinvent
local RETVAL=$?
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
return $RETVAL
}
......@@ -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
......
#!/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 ;;
......
......@@ -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
......
......@@ -516,5 +516,5 @@ is_active_systemd()
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack
ps ax | grep -q '[s]ystemd' >/dev/null
ps ax | grep -q '[s]ystemd' | grep -v 'systemd-udev' >/dev/null
}
......@@ -42,7 +42,7 @@ fi
# If ftp protocol or have no asterisk, just download
# TODO: use has()
if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then
if echo "$1" | grep -q "\(^ftp://\|[^*]\)" ; then
$WGET $WGET_OPTION_TARGET "$1"
exit
fi
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.9.6
Version: 1.9.8
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -68,9 +68,21 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Thu Oct 06 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.6-alt0.M80P.1
* Fri Dec 02 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.8-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Thu Dec 01 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.8-alt1
- epm-install: move download code to epm-download
- epm-checkpkg: add support for checking package by url
- downgrade: use distro-sync for downgrade with yum/dnf
- autoorphans/autoremove: fix uses package-cleanup with yum/dnf
- epmqf: use realpath for exists files by default
- improve systemd detection
* Tue Nov 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.7-alt1
- fix build install
- small fixes
* Sun Oct 02 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.6-alt1
- epm: improve message about incorrect command
- workaround for sudo -h prints first line in stderr
......
......@@ -275,7 +275,7 @@ set_sudo()
if which sudo >/dev/null 2>/dev/null ; then
SUDO="sudo --"
# check for < 1.7 version which do not support -- (and --help possible too)
sudo -h | grep -q " --" || SUDO="sudo"
sudo -h 2>/dev/null | grep -q " --" || SUDO="sudo"
return
fi
......@@ -508,7 +508,7 @@ 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' >/dev/null
}
# File bin/epm-addrepo:
......@@ -3108,7 +3108,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
......@@ -4687,7 +4687,7 @@ __query_package_hl_url()
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1
showcmd curl "$PAOAPI/srpms/$1"
curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
a= curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
return 0
;;
esac
......@@ -5519,7 +5519,7 @@ $(get_help HELPOPT)
print_version()
{
echo "EPM package manager version 1.9.3"
echo "EPM package manager version 1.9.6"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......@@ -5858,7 +5858,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
......
......@@ -268,7 +268,7 @@ set_sudo()
if which sudo >/dev/null 2>/dev/null ; then
SUDO="sudo --"
# check for < 1.7 version which do not support -- (and --help possible too)
sudo -h | grep -q " --" || SUDO="sudo"
sudo -h 2>/dev/null | grep -q " --" || SUDO="sudo"
return
fi
......@@ -501,7 +501,7 @@ 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' >/dev/null
}
# File bin/serv-common:
......@@ -636,11 +636,6 @@ serv_list()
for i in $(serv_list_all) ; do
is_service_running $i >/dev/null && echo $i
done
# TODO: только запущенные
if [ -n "$ANYSERVICE" ] ; then
sudocmd $ANYSERVICE list
return
fi
;;
esac
}
......@@ -655,7 +650,7 @@ serv_list_all()
sudocmd chkconfig --list | cut -f1
if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice list
sudocmd anyservice --quiet list
return
fi
;;
......@@ -685,6 +680,49 @@ serv_list_startup()
esac
}
# File bin/serv-log:
__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
}
# File bin/serv-print:
serv_print()
......@@ -1498,8 +1536,8 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.9.3"
echo "Running on $($DISTRVENDOR)"
echo "Service manager version 1.9.6"
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."
}
......@@ -1570,6 +1608,9 @@ check_command()
serv_cmd=print
withoutservicename=1
;;
log|journal) # HELPCMD: print log for the service
serv_cmd=log
;;
*)
return 1
;;
......
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