Commit aeac7c5d authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 0bdbb892 5fd32a7e
[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
[18:23:40] <danil> > Ты знаешь способы?
colorise_word(){ //aba b
RED='\033[0;31m'
NC='\033[0m' b="b"
echo -e "$1" | sed -e "s|${2}|\\${RED}${2}\\${NC}|g" | xargs -0 printf
}
[18:24:18] <lav> Ну в общем-то да... Ещё можно попробовать готовый
yum list extras – имена тех пакетов, которые наличествуют в системе, но которыми в репозиториях и не пахло, то есть установленные “в лоб”, например, через
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl
......
......@@ -87,8 +87,12 @@ fi
if distro altlinux-release ; then
DISTRIB_ID="ALTLinux"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7.0" ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux 6.0" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
......
......@@ -28,7 +28,8 @@ case $PMTYPE in
info "You need manually add repo to /etc/apt/sources.list"
;;
yum-rpm)
info "You need manually add repo to /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager --add-repo "$pkg_filenames"
;;
urpm-rpm)
sudocmd urpmi.addmedia "$pkg_filenames"
......
......@@ -19,6 +19,9 @@
epm_audit()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
pkgng)
sudocmd pkg audit -F
......
......@@ -19,6 +19,10 @@
epm_autoorphans()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
#apt-rpm)
# ALT Linux only
......@@ -31,7 +35,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
deborphan | sudocmd epm remove
a= deborphan | sudocmd epm remove
;;
#aura)
# sudocmd aura -Oj
......
......@@ -37,6 +37,10 @@ __epm_autoremove_altrpm()
epm_autoremove()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
# ALT Linux only
......@@ -62,6 +66,9 @@ case $PMTYPE in
sudocmd yum remove $PKGLIST
done
;;
dnf-rpm)
sudocmd dnf autoremove
;;
# see autoorhans
#urpm-rpm)
# sudocmd urpme --auto-orphans
......
......@@ -58,10 +58,11 @@ update_repo_if_needed()
sudo -n true 2>/dev/null || { info "sudo requires a password, skip repo status checking" ; return 0 ; }
fi
cd /
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update
epm_update
return
pkg_filenames= epm_update
fi
cd - >/dev/null
}
......@@ -22,10 +22,11 @@
epm_checksystem_ALTLinux()
{
local TDIR=$(mktemp -d)
assure_exists time
touch $TDIR/added
for ft in $(ls /usr/lib/rpm/*.filetrigger | sort) ; do
echo "Try run $ft ..."
echo $TDIR/added $TDIR/removed | time $ft
echo $TDIR/added $TDIR/removed | a= time $ft
done
rm -f $TDIR/added fatal
rmdir $TDIR || fatal
......@@ -50,6 +51,10 @@ esac
}
SUDO=sudo
DISTRNAME=ALTLinux
epm_checksystem
# direct debug run
if [ "$1" = "--debug" ] ; then
shift
SUDO=sudo
DISTRNAME=ALTLinux
epm_checksystem
fi
......@@ -36,6 +36,10 @@ __remove_deb_apt_cache_file()
epm_clean()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
sudocmd apt-get clean
......
#!/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
......@@ -19,13 +19,39 @@
load_helper epm-check_updated_repo
__epm_add_apt_downgrade_preferences()
__epm_add_alt_apt_downgrade_preferences()
{
[ -r /etc/apt/preferences ] && fatal "/etc/apt/preferences already exists"
cat <<EOF | $SUDO tee /etc/apt/preferences
# main repo
Package: *
Pin: release c=$1
Pin: release c=classic
Pin-Priority: 1001
# overload with addon repo
Package: *
Pin: release c=addon
Pin-Priority: 1101
EOF
}
# See https://wiki.debian.org/ru/AptPreferences
__epm_add_deb_apt_downgrade_preferences()
{
[ -r /etc/apt/preferences ] && fatal "/etc/apt/preferences already exists"
info "Running with /etc/apt/preferences:"
cat <<EOF | $SUDO tee /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 1001
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release a=unstable
Pin-Priority: 800
EOF
}
......@@ -45,21 +71,29 @@ epm_downgrade()
case $PMTYPE in
apt-rpm)
__epm_add_apt_downgrade_preferences classic || return
sudocmd apt-get dist-upgrade
__epm_add_alt_apt_downgrade_preferences || return
if [ -n "$pkg_filenames" ] ; then
sudocmd apt-get install $pkg_filenames
else
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
;;
apt-dpkg)
__epm_add_apt_downgrade_preferences testing || return
sudocmd apt-get dist-upgrade
__epm_add_deb_apt_downgrade_preferences || return
if [ -n "$pkg_filenames" ] ; then
sudocmd apt-get install $pkg_filenames
else
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
;;
yum-rpm)
# can do update repobase automagically
sudocmd yum downgrade $pkg_filename
sudocmd yum downgrade $pkg_filenames
;;
dnf-rpm)
sudocmd dnf downgrade $pkg_filename
sudocmd dnf downgrade $pkg_filenames
;;
urpm-rpm)
assure_exists urpm-reposync urpm-tools
......
......@@ -43,7 +43,7 @@ __alt_local_content_filelist()
__deb_local_content_filelist()
{
showcmd "apt-file list $1 | grep '^$1: ' | sed -e 's|$1: ||g'"
apt-file list "$1" | grep "^$1: " | sed -e "s|$1: ||g"
a= apt-file list "$1" | grep "^$1: " | sed -e "s|$1: ||g"
}
......
......@@ -24,7 +24,7 @@ epm_kernel_update()
case $DISTRNAME in
ALTLinux)
assure_exists update-kernel
sudocmd update-kernel
sudocmd update-kernel $pkg_filenames
return ;;
esac
......
......@@ -32,6 +32,8 @@ __repack_rpm_base()
epm_optimize()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
*-rpm)
#__repack_rpm_base
......
......@@ -134,6 +134,7 @@ case $PMTYPE in
CMD="apt-cyg list $pkg_filenames"
if [ -z "$short" ] ; then
showcmd $CMD
# TODO: fix this slow way
for i in $($CMD) ; do
__aptcyg_print_full $i
done
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2008, 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015, 2016 Etersoft
# Copyright (C) 2008, 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
......@@ -77,6 +77,12 @@ print_srcname()
print_name $(print_srcpkgname "$@")
}
print_specname()
{
# CHECKME: it is possible to have two or more specs in one package?
rpm -qlp "$@" | grep "\.spec\$"
}
print_srcpkgname()
{
query_package_field sourcerpm "$@"
......@@ -113,9 +119,10 @@ cat <<EOF
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for package file
epm print srcname from filename NN print source name for package file
epm print pkgname from filename NN print package name for the package file
epm print srcname from filename NN print source name for the package file
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
EOF
;;
......@@ -172,6 +179,11 @@ EOF
[ -n "$1" ] || fatal "Arg is missed"
print_srcpkgname "$@"
;;
"specname")
[ -n "$FNFLAG" ] || [ -n "$PKFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_specname "$@"
;;
"binpkgfilelist")
# TODO: rpm only
# TODO: replace get_binpkg_list
......
......@@ -63,7 +63,7 @@ case $PMTYPE in
return
fi
;;
urpm-rpm|zypper-rpm|yum-rpm)
urpm-rpm|zypper-rpm|yum-rpm|dnf-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --provides"
else
......
......@@ -66,12 +66,12 @@ _query_via_packages_list()
# 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 $firstpkg || res=1
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages || res=1
local pkg
for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg)
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$pkg epm_packages $pkg || res=1
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$pkg epm_packages || res=1
done
return $res
......
......@@ -146,6 +146,7 @@ __do_short_query()
epm_query_file()
{
# И где это используется?
# in short mode print handle only real names and do short output
# TODO: move to separate command?
# FIXME: it is possible use query
......
......@@ -27,5 +27,6 @@ epm_query_package()
local MGS
MGS=$(eval __epm_search_make_grep $quoted_args)
EXTRA_SHOWDOCMD=$MGS
# Note: get all packages list and do grep
eval "pkg_filenames= epm_packages \"$(eval get_firstarg $quoted_args)\" $MGS"
}
......@@ -35,7 +35,7 @@ epm_reinstall_names()
sudocmd dnf reinstall $@
return ;;
pkgng)
sudocmf pkg install -f $@
sudocmd pkg install -f $@
return ;;
slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
......
......@@ -28,7 +28,8 @@ case $PMTYPE in
info "You need remove repo from /etc/apt/sources.list"
;;
yum-rpm)
info "You need remove repo from /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager --disable "$pkg_filenames"
;;
urpm-rpm)
sudocmd urpmi.removemedia "$pkg_filenames"
......
......@@ -31,6 +31,9 @@ __fix_apt_sources_list()
epm_repofix()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
......
......@@ -68,7 +68,18 @@ case $PMTYPE in
CMD="rpm -q --requires"
;;
yum-rpm)
CMD="yum deplist"
if is_installed $pkg_names ; then
CMD="rpm -q --requires"
else
CMD="yum deplist"
fi
;;
dnf-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --requires"
else
CMD="dnf repoquery --requires"
fi
;;
pacman)
CMD="pactree"
......
......@@ -96,7 +96,7 @@ case $PMTYPE in
;;
esac
docmd $CMD $string
LANG=C docmd $CMD $string
}
# TODO: use ^ as first word, use ~ for negate, for epmqp too
......@@ -123,22 +123,28 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN=$(strip_spaces $listN | sed -e "s/ /|/g" | sed -e "s/\^//g")
if [ "$short" ] ; then
echon " | sed -e \"s| .*||g\""
fi
[ -n "$listN" ] && echon " | egrep -i -v -- \"$listN\""
# FIXME: The World has not idea how to do grep both string
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
for i in $list ; do
# FIXME -n on MacOS?
echon " | egrep -i -- \"$i\""
done
if [ "$short" ] ; then
echon " | sed -e \"s| .*||g\""
# Need only if we have more than one word (with one word we will grep for colorify)
if [ "$(echo "$list" | wc -w)" -gt 1 ] ; then
for i in $list ; do
# FIXME -n on MacOS?
echon " | egrep -i -- \"$i\""
done
fi
# FIXME: move from it
#isatty || return
# TODO: sorts word by length from large to short
local COLO=""
# rule for colorife
for i in $list $listN; do
......@@ -146,6 +152,7 @@ __epm_search_make_grep()
COLO="$COLO$i"
done
# TODO: use some colorifer instead grep (check grep adove too)
if [ -n "$list" ] ; then
echon " | egrep -i $EGREPCOLOR -- \"($COLO)\""
fi
......
......@@ -49,9 +49,13 @@ case $PMTYPE in
docmd apt-file search $pkg_filenames
return ;;
yum-rpm)
# TODO
info "Search by full packages list does not realized"
CMD="yum provides"
;;
dnf-rpm)
# TODO
info "Search by full packages list does not realized"
CMD="dnf provides"
;;
urpm-rpm)
......
#!/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
......@@ -20,6 +20,8 @@
load_helper epm-query
load_helper epm-print
PAOURL="https://packages.altlinux.org"
run_command_if_exists()
{
local CMD="$1"
......@@ -41,12 +43,13 @@ 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 "http://packages.altlinux.org/api/srpms/$1"
curl -s --header "Accept: application/json" "http://packages.altlinux.org/api/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
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
;;
esac
......@@ -87,7 +90,7 @@ get_pao_url()
*)
loc=en
esac
echo "http://packages.altlinux.org/$loc/Sisyphus/srpms"
echo "$PAOURL/$loc/Sisyphus/srpms"
}
query_altlinux_url()
......@@ -109,7 +112,7 @@ epm_site()
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
PAO=
local PAO=""
for f in $pkg_names $pkg_files ; do
[ "$f" = "-p" ] && PAO="$f" && continue
if [ -n "$PAO" ] ; then
......
......@@ -21,6 +21,7 @@
epm_update()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
info "Running command for update remote package repository database"
case $PMTYPE in
......
......@@ -23,6 +23,8 @@ epm_upgrade()
{
local CMD
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
# it is useful for first time running
update_repo_if_needed
......
......@@ -40,6 +40,9 @@ case $PMTYPE in
yum-rpm)
CMD="repoquery --whatrequires"
;;
dnf-rpm)
CMD="repoquery --whatrequires"
;;
emerge)
assure_exists equery
CMD="equery depends -a"
......
......@@ -38,6 +38,9 @@ case $PMTYPE in
yum-rpm)
CMD="yum whatprovides"
;;
dnf-rpm)
CMD="yum provides"
;;
zypper-rpm)
CMD="zypper what-provides"
;;
......
#!/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
......@@ -61,7 +61,9 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR"
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack
pidof systemd >/dev/null
}
case $DISTRNAME in
......@@ -128,7 +130,7 @@ print_version()
{
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -192,6 +194,10 @@ check_command()
off|disable) # HELPCMD: remove service to run on startup and stop it now
serv_cmd=disable
;;
print) # HELPCMD: print some info
serv_cmd=print
withoutservicename=1
;;
*)
return 1
;;
......
#!/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_print()
{
echo "Detected init system: $SERVICETYPE"
}
......@@ -20,37 +20,61 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
WGET="wget"
WGET="wget -q"
if [ "$1" = "-q" ] ; then
WGET="wget -q"
shift
fi
# TODO:
# -P support
# If ftp protocol or have no asterisk, jus download
# TODO: use has()
if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then
$WGET $1 && exit 0
$WGET "$1"
exit
fi
URL=$(echo $1 | grep /$ || dirname $1)
MASK=$(basename $1)
MYTMPDIR="$(mktemp -d)"
DIRALLFILES="$MYTMPDIR/files/"
get_index(){
echo "Fall to http workaround"
URL=$(echo "$1" | grep "/$" || dirname "$1")
# mask allowed only in last part of path
MASK=$(basename "$1")
get_index()
{
MYTMPDIR="$(mktemp -d)"
INDEX=$MYTMPDIR/index
$WGET $URL -O $INDEX
}
save_temp_files(){
mkdir -p $DIRALLFILES
ALLFILES="$MYTMPDIR/allfiles"
cat $INDEX | grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2 > $ALLFILES
while read line ; do
touch $DIRALLFILES/$line
done <$ALLFILES
print_files()
{
cat $INDEX | grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2
}
create_fake_files()
{
DIRALLFILES="$MYTMPDIR/files/"
mkdir -p "$DIRALLFILES"
print_files | while read line ; do
touch $DIRALLFILES/$(basename "$line")
done
}
sort_files(){
download_files()
{
ERROR=0
for line in $DIRALLFILES/$MASK ; do
$WGET $URL/`basename "$line"` -P $CURRENTDIR/
$WGET $URL/$(basename "$line") || ERROR=1
done
return $ERROR
}
get_index
save_temp_files
sort_files
get_index || exit
create_fake_files
download_files || echo "There was some download errors" >&2
rm -rf "$MYTMPDIR"
#!/bin/sh
/usr/lib/rpm/shell.req bin/epm-* | sort -u
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
# This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.5.24
Version: 1.6.3
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
......@@ -67,8 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Mon Dec 07 2015 Andrey Cherepanov <cas@altlinux.org> 1.5.24-alt0.M70P.1
- Backport new version to p7 branch
* Thu Apr 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Tue Apr 05 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt1
- epm-checksystem: add assure_exists time
- check_updated_repo fix epm update
* Thu Mar 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.2-alt2
- add check_reqs script and cleanup all reqs
* Thu Mar 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.2-alt1
- epm: print error for extra unallowed args
- drop time requires
* Fri Feb 26 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.1-alt1
- distr_info: add Simply Linux detection
- epm: use yum-config-manager for managing repo in yum based distros
- fix downgrade for LINUX@Etersoft, Debian, Ubuntu, add support for downgrade one or a few packages
- epm search: optimize grep when search for one word, apply short option before all, disable localized description
- epm-site: use https for packages.altlinux.org
- add serv print command
- serv: fix systemd detection
* Wed Jan 27 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.0-alt1
- release long term support version 1.6
- epm-print: add print specname
- rewrite eget
* Wed Dec 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.25-alt1
- epm-checksystem: fix working in packed
- fix packed version
- improve dnf support
- small fixes
* Tue Dec 01 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.24-alt1
- add support apt-cyg on Cygwin
......@@ -76,9 +107,6 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
- epm-check_updated_rep: do not check on deb systems
- epm-query: fix print package version for other systems
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt1
- epm install: disable update if try install local package files
- epm clean: remove partial files
......
#!/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
......@@ -247,6 +247,10 @@ set_sudo()
SUDO=""
# skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return
if [ "$DISTRNAME" = "Cygwin" ] || [ "$DISTRNAME" = "Windows" ] ; then
# skip sudo using on Windows
return
fi
EFFUID=`id -u`
......@@ -278,7 +282,7 @@ set_eatmydata()
# use if possible
which eatmydata >/dev/null 2>/dev/null || return
SUDO="$SUDO eatmydata"
info "Uwaga! eatmydata is installed, we will use it for disable all sync operations."
[ -n "$verbose" ] && info "Uwaga! eatmydata is installed, we will use it for disable all sync operations."
return 0
}
......@@ -424,6 +428,9 @@ case $DISTRNAME in
Android)
CMD="android"
;;
Cygwin)
CMD="aptcyg"
;;
*)
fatal "Have no suitable DISTRNAME $DISTRNAME"
;;
......@@ -574,6 +581,13 @@ serv_list_startup()
esac
}
# File bin/serv-print:
serv_print()
{
echo "Detected init system: $SERVICETYPE"
}
# File bin/serv-restart:
......@@ -819,7 +833,8 @@ pkgtype()
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
debian|ubuntu|mint|runtu) echo "deb" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel)
......@@ -853,24 +868,31 @@ fi
# ALT Linux based
if distro altlinux-release ; then
DISTRIB_ID="ALTLinux"
if has Strawberry ; then DISTRIB_RELEASE="2.3"
elif has Citron ; then DISTRIB_RELEASE="2.4"
elif has 20050723 ; then DISTRIB_RELEASE="3.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux 6.0" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
elif has "ALT Linux 5.1" ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0"
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
elif has 6.0 ; then DISTRIB_RELEASE="p6"
elif has Centaurea ; then DISTRIB_RELEASE="p6"
elif has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20050723 ; then DISTRIB_RELEASE="3.0"
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)
......@@ -897,6 +919,10 @@ elif distro arch-release ; then
DISTRIB_RELEASE="2011"
fi
elif distro mcst_version ; then
DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
# for Ubuntu use standard LSB info
elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB version
......@@ -1106,7 +1132,9 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR"
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack
pidof systemd >/dev/null
}
case $DISTRNAME in
......@@ -1171,9 +1199,9 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.5.15"
echo "Service manager version 1.6.3"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -1237,6 +1265,10 @@ check_command()
off|disable) # HELPCMD: remove service to run on startup and stop it now
serv_cmd=disable
;;
print) # HELPCMD: print some info
serv_cmd=print
withoutservicename=1
;;
*)
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