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 --dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl add epm site / epmurl in replace to rpmurl
......
...@@ -87,8 +87,12 @@ fi ...@@ -87,8 +87,12 @@ fi
if distro altlinux-release ; then if distro altlinux-release ; then
DISTRIB_ID="ALTLinux" DISTRIB_ID="ALTLinux"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" 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 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 p7" ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6" elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5" elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
......
...@@ -28,7 +28,8 @@ case $PMTYPE in ...@@ -28,7 +28,8 @@ case $PMTYPE in
info "You need manually add repo to /etc/apt/sources.list" info "You need manually add repo to /etc/apt/sources.list"
;; ;;
yum-rpm) yum-rpm)
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) urpm-rpm)
sudocmd urpmi.addmedia "$pkg_filenames" sudocmd urpmi.addmedia "$pkg_filenames"
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
epm_audit() epm_audit()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
pkgng) pkgng)
sudocmd pkg audit -F sudocmd pkg audit -F
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
epm_autoorphans() epm_autoorphans()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
#apt-rpm) #apt-rpm)
# ALT Linux only # ALT Linux only
...@@ -31,7 +35,7 @@ case $PMTYPE in ...@@ -31,7 +35,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
assure_exists deborphan assure_exists deborphan
showcmd deborphan showcmd deborphan
deborphan | sudocmd epm remove a= deborphan | sudocmd epm remove
;; ;;
#aura) #aura)
# sudocmd aura -Oj # sudocmd aura -Oj
......
...@@ -37,6 +37,10 @@ __epm_autoremove_altrpm() ...@@ -37,6 +37,10 @@ __epm_autoremove_altrpm()
epm_autoremove() epm_autoremove()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# ALT Linux only # ALT Linux only
...@@ -62,6 +66,9 @@ case $PMTYPE in ...@@ -62,6 +66,9 @@ case $PMTYPE in
sudocmd yum remove $PKGLIST sudocmd yum remove $PKGLIST
done done
;; ;;
dnf-rpm)
sudocmd dnf autoremove
;;
# see autoorhans # see autoorhans
#urpm-rpm) #urpm-rpm)
# sudocmd urpme --auto-orphans # sudocmd urpme --auto-orphans
......
...@@ -58,10 +58,11 @@ update_repo_if_needed() ...@@ -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 ; } sudo -n true 2>/dev/null || { info "sudo requires a password, skip repo status checking" ; return 0 ; }
fi fi
cd /
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update load_helper epm-update
epm_update pkg_filenames= epm_update
return
fi fi
cd - >/dev/null
} }
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
epm_checksystem_ALTLinux() epm_checksystem_ALTLinux()
{ {
local TDIR=$(mktemp -d) local TDIR=$(mktemp -d)
assure_exists time
touch $TDIR/added touch $TDIR/added
for ft in $(ls /usr/lib/rpm/*.filetrigger | sort) ; do for ft in $(ls /usr/lib/rpm/*.filetrigger | sort) ; do
echo "Try run $ft ..." echo "Try run $ft ..."
echo $TDIR/added $TDIR/removed | time $ft echo $TDIR/added $TDIR/removed | a= time $ft
done done
rm -f $TDIR/added fatal rm -f $TDIR/added fatal
rmdir $TDIR || fatal rmdir $TDIR || fatal
...@@ -50,6 +51,10 @@ esac ...@@ -50,6 +51,10 @@ esac
} }
SUDO=sudo # direct debug run
DISTRNAME=ALTLinux if [ "$1" = "--debug" ] ; then
epm_checksystem shift
SUDO=sudo
DISTRNAME=ALTLinux
epm_checksystem
fi
...@@ -36,6 +36,10 @@ __remove_deb_apt_cache_file() ...@@ -36,6 +36,10 @@ __remove_deb_apt_cache_file()
epm_clean() epm_clean()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
sudocmd apt-get clean sudocmd apt-get clean
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014 Etersoft # Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -19,13 +19,39 @@ ...@@ -19,13 +19,39 @@
load_helper epm-check_updated_repo 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" [ -r /etc/apt/preferences ] && fatal "/etc/apt/preferences already exists"
cat <<EOF | $SUDO tee /etc/apt/preferences cat <<EOF | $SUDO tee /etc/apt/preferences
# main repo
Package: * Package: *
Pin: release c=$1 Pin: release c=classic
Pin-Priority: 1001 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 EOF
} }
...@@ -45,21 +71,29 @@ epm_downgrade() ...@@ -45,21 +71,29 @@ epm_downgrade()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
__epm_add_apt_downgrade_preferences classic || return __epm_add_alt_apt_downgrade_preferences || return
sudocmd apt-get dist-upgrade if [ -n "$pkg_filenames" ] ; then
sudocmd apt-get install $pkg_filenames
else
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences __epm_remove_apt_downgrade_preferences
;; ;;
apt-dpkg) apt-dpkg)
__epm_add_apt_downgrade_preferences testing || return __epm_add_deb_apt_downgrade_preferences || return
sudocmd apt-get dist-upgrade if [ -n "$pkg_filenames" ] ; then
sudocmd apt-get install $pkg_filenames
else
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences __epm_remove_apt_downgrade_preferences
;; ;;
yum-rpm) yum-rpm)
# can do update repobase automagically # can do update repobase automagically
sudocmd yum downgrade $pkg_filename sudocmd yum downgrade $pkg_filenames
;; ;;
dnf-rpm) dnf-rpm)
sudocmd dnf downgrade $pkg_filename sudocmd dnf downgrade $pkg_filenames
;; ;;
urpm-rpm) urpm-rpm)
assure_exists urpm-reposync urpm-tools assure_exists urpm-reposync urpm-tools
......
...@@ -43,7 +43,7 @@ __alt_local_content_filelist() ...@@ -43,7 +43,7 @@ __alt_local_content_filelist()
__deb_local_content_filelist() __deb_local_content_filelist()
{ {
showcmd "apt-file list $1 | grep '^$1: ' | sed -e 's|$1: ||g'" 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() ...@@ -24,7 +24,7 @@ epm_kernel_update()
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
assure_exists update-kernel assure_exists update-kernel
sudocmd update-kernel sudocmd update-kernel $pkg_filenames
return ;; return ;;
esac esac
......
...@@ -32,6 +32,8 @@ __repack_rpm_base() ...@@ -32,6 +32,8 @@ __repack_rpm_base()
epm_optimize() epm_optimize()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
*-rpm) *-rpm)
#__repack_rpm_base #__repack_rpm_base
......
...@@ -134,6 +134,7 @@ case $PMTYPE in ...@@ -134,6 +134,7 @@ case $PMTYPE in
CMD="apt-cyg list $pkg_filenames" CMD="apt-cyg list $pkg_filenames"
if [ -z "$short" ] ; then if [ -z "$short" ] ; then
showcmd $CMD showcmd $CMD
# TODO: fix this slow way
for i in $($CMD) ; do for i in $($CMD) ; do
__aptcyg_print_full $i __aptcyg_print_full $i
done done
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015 Etersoft # Copyright (C) 2015, 2016 Etersoft
# Copyright (C) 2008, 2015 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2008, 2015, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -77,6 +77,12 @@ print_srcname() ...@@ -77,6 +77,12 @@ print_srcname()
print_name $(print_srcpkgname "$@") 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() print_srcpkgname()
{ {
query_package_field sourcerpm "$@" query_package_field sourcerpm "$@"
...@@ -113,9 +119,10 @@ cat <<EOF ...@@ -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 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 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 field FF for package NN print field of the package
epm print pkgname from filename NN print package 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 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 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 binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
EOF EOF
;; ;;
...@@ -172,6 +179,11 @@ EOF ...@@ -172,6 +179,11 @@ EOF
[ -n "$1" ] || fatal "Arg is missed" [ -n "$1" ] || fatal "Arg is missed"
print_srcpkgname "$@" print_srcpkgname "$@"
;; ;;
"specname")
[ -n "$FNFLAG" ] || [ -n "$PKFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_specname "$@"
;;
"binpkgfilelist") "binpkgfilelist")
# TODO: rpm only # TODO: rpm only
# TODO: replace get_binpkg_list # TODO: replace get_binpkg_list
......
...@@ -63,7 +63,7 @@ case $PMTYPE in ...@@ -63,7 +63,7 @@ case $PMTYPE in
return return
fi fi
;; ;;
urpm-rpm|zypper-rpm|yum-rpm) urpm-rpm|zypper-rpm|yum-rpm|dnf-rpm)
if is_installed $pkg_names ; then if is_installed $pkg_names ; then
CMD="rpm -q --provides" CMD="rpm -q --provides"
else else
......
...@@ -66,12 +66,12 @@ _query_via_packages_list() ...@@ -66,12 +66,12 @@ _query_via_packages_list()
# Note: we use short=1 here due grep by ^name$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages $firstpkg || res=1 short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages || res=1
local pkg local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg) 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 done
return $res return $res
......
...@@ -146,6 +146,7 @@ __do_short_query() ...@@ -146,6 +146,7 @@ __do_short_query()
epm_query_file() epm_query_file()
{ {
# И где это используется?
# in short mode print handle only real names and do short output # in short mode print handle only real names and do short output
# TODO: move to separate command? # TODO: move to separate command?
# FIXME: it is possible use query # FIXME: it is possible use query
......
...@@ -27,5 +27,6 @@ epm_query_package() ...@@ -27,5 +27,6 @@ epm_query_package()
local MGS local MGS
MGS=$(eval __epm_search_make_grep $quoted_args) MGS=$(eval __epm_search_make_grep $quoted_args)
EXTRA_SHOWDOCMD=$MGS EXTRA_SHOWDOCMD=$MGS
# Note: get all packages list and do grep
eval "pkg_filenames= epm_packages \"$(eval get_firstarg $quoted_args)\" $MGS" eval "pkg_filenames= epm_packages \"$(eval get_firstarg $quoted_args)\" $MGS"
} }
...@@ -35,7 +35,7 @@ epm_reinstall_names() ...@@ -35,7 +35,7 @@ epm_reinstall_names()
sudocmd dnf reinstall $@ sudocmd dnf reinstall $@
return ;; return ;;
pkgng) pkgng)
sudocmf pkg install -f $@ sudocmd pkg install -f $@
return ;; return ;;
slackpkg) slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@ sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
......
...@@ -28,7 +28,8 @@ case $PMTYPE in ...@@ -28,7 +28,8 @@ case $PMTYPE in
info "You need remove repo from /etc/apt/sources.list" info "You need remove repo from /etc/apt/sources.list"
;; ;;
yum-rpm) 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) urpm-rpm)
sudocmd urpmi.removemedia "$pkg_filenames" sudocmd urpmi.removemedia "$pkg_filenames"
......
...@@ -31,6 +31,9 @@ __fix_apt_sources_list() ...@@ -31,6 +31,9 @@ __fix_apt_sources_list()
epm_repofix() epm_repofix()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
......
...@@ -68,7 +68,18 @@ case $PMTYPE in ...@@ -68,7 +68,18 @@ case $PMTYPE in
CMD="rpm -q --requires" CMD="rpm -q --requires"
;; ;;
yum-rpm) 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) pacman)
CMD="pactree" CMD="pactree"
......
...@@ -96,7 +96,7 @@ case $PMTYPE in ...@@ -96,7 +96,7 @@ case $PMTYPE in
;; ;;
esac esac
docmd $CMD $string LANG=C docmd $CMD $string
} }
# TODO: use ^ as first word, use ~ for negate, for epmqp too # TODO: use ^ as first word, use ~ for negate, for epmqp too
...@@ -123,22 +123,28 @@ __epm_search_make_grep() ...@@ -123,22 +123,28 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g") #list=$(strip_spaces $list | sed -e "s/ /|/g")
listN=$(strip_spaces $listN | sed -e "s/ /|/g" | 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\"" [ -n "$listN" ] && echon " | egrep -i -v -- \"$listN\""
# FIXME: The World has not idea how to do grep both string # 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 # 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 # Need only if we have more than one word (with one word we will grep for colorify)
echon " | sed -e \"s| .*||g\"" if [ "$(echo "$list" | wc -w)" -gt 1 ] ; then
for i in $list ; do
# FIXME -n on MacOS?
echon " | egrep -i -- \"$i\""
done
fi fi
# FIXME: move from it # FIXME: move from it
#isatty || return #isatty || return
# TODO: sorts word by length from large to short
local COLO="" local COLO=""
# rule for colorife # rule for colorife
for i in $list $listN; do for i in $list $listN; do
...@@ -146,6 +152,7 @@ __epm_search_make_grep() ...@@ -146,6 +152,7 @@ __epm_search_make_grep()
COLO="$COLO$i" COLO="$COLO$i"
done done
# TODO: use some colorifer instead grep (check grep adove too)
if [ -n "$list" ] ; then if [ -n "$list" ] ; then
echon " | egrep -i $EGREPCOLOR -- \"($COLO)\"" echon " | egrep -i $EGREPCOLOR -- \"($COLO)\""
fi fi
......
...@@ -49,9 +49,13 @@ case $PMTYPE in ...@@ -49,9 +49,13 @@ case $PMTYPE in
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
yum-rpm) yum-rpm)
# TODO
info "Search by full packages list does not realized"
CMD="yum provides" CMD="yum provides"
;; ;;
dnf-rpm) dnf-rpm)
# TODO
info "Search by full packages list does not realized"
CMD="dnf provides" CMD="dnf provides"
;; ;;
urpm-rpm) urpm-rpm)
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015 Etersoft # Copyright (C) 2015,2016 Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2015,2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
load_helper epm-query load_helper epm-query
load_helper epm-print load_helper epm-print
PAOURL="https://packages.altlinux.org"
run_command_if_exists() run_command_if_exists()
{ {
local CMD="$1" local CMD="$1"
...@@ -41,12 +43,13 @@ open_browser() ...@@ -41,12 +43,13 @@ open_browser()
__query_package_hl_url() __query_package_hl_url()
{ {
local PAOAPI="$PAOURL/api"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs # http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1 epm assure curl || return 1
showcmd curl "http://packages.altlinux.org/api/srpms/$1" showcmd curl "$PAOAPI/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' curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
return 0 return 0
;; ;;
esac esac
...@@ -87,7 +90,7 @@ get_pao_url() ...@@ -87,7 +90,7 @@ get_pao_url()
*) *)
loc=en loc=en
esac esac
echo "http://packages.altlinux.org/$loc/Sisyphus/srpms" echo "$PAOURL/$loc/Sisyphus/srpms"
} }
query_altlinux_url() query_altlinux_url()
...@@ -109,7 +112,7 @@ epm_site() ...@@ -109,7 +112,7 @@ epm_site()
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name" [ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
PAO= local PAO=""
for f in $pkg_names $pkg_files ; do for f in $pkg_names $pkg_files ; do
[ "$f" = "-p" ] && PAO="$f" && continue [ "$f" = "-p" ] && PAO="$f" && continue
if [ -n "$PAO" ] ; then if [ -n "$PAO" ] ; then
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
epm_update() epm_update()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
info "Running command for update remote package repository database" info "Running command for update remote package repository database"
case $PMTYPE in case $PMTYPE in
......
...@@ -23,6 +23,8 @@ epm_upgrade() ...@@ -23,6 +23,8 @@ epm_upgrade()
{ {
local CMD local CMD
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
# it is useful for first time running # it is useful for first time running
update_repo_if_needed update_repo_if_needed
......
...@@ -40,6 +40,9 @@ case $PMTYPE in ...@@ -40,6 +40,9 @@ case $PMTYPE in
yum-rpm) yum-rpm)
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
dnf-rpm)
CMD="repoquery --whatrequires"
;;
emerge) emerge)
assure_exists equery assure_exists equery
CMD="equery depends -a" CMD="equery depends -a"
......
...@@ -38,6 +38,9 @@ case $PMTYPE in ...@@ -38,6 +38,9 @@ case $PMTYPE in
yum-rpm) yum-rpm)
CMD="yum whatprovides" CMD="yum whatprovides"
;; ;;
dnf-rpm)
CMD="yum provides"
;;
zypper-rpm) zypper-rpm)
CMD="zypper what-provides" CMD="zypper what-provides"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013 Etersoft # Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -61,7 +61,9 @@ is_active_systemd() ...@@ -61,7 +61,9 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return [ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || 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 case $DISTRNAME in
...@@ -128,7 +130,7 @@ print_version() ...@@ -128,7 +130,7 @@ print_version()
{ {
echo "Service manager version @VERSION@" echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)" 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." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
} }
...@@ -192,6 +194,10 @@ check_command() ...@@ -192,6 +194,10 @@ check_command()
off|disable) # HELPCMD: remove service to run on startup and stop it now off|disable) # HELPCMD: remove service to run on startup and stop it now
serv_cmd=disable serv_cmd=disable
;; ;;
print) # HELPCMD: print some info
serv_cmd=print
withoutservicename=1
;;
*) *)
return 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 @@ ...@@ -20,37 +20,61 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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 if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then
$WGET $1 && exit 0 $WGET "$1"
exit
fi 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 INDEX=$MYTMPDIR/index
$WGET $URL -O $INDEX $WGET $URL -O $INDEX
} }
save_temp_files(){ print_files()
mkdir -p $DIRALLFILES {
ALLFILES="$MYTMPDIR/allfiles" cat $INDEX | grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2
cat $INDEX | grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2 > $ALLFILES }
while read line ; do
touch $DIRALLFILES/$line create_fake_files()
done <$ALLFILES {
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 for line in $DIRALLFILES/$MASK ; do
$WGET $URL/`basename "$line"` -P $CURRENTDIR/ $WGET $URL/$(basename "$line") || ERROR=1
done done
return $ERROR
} }
get_index get_index || exit
save_temp_files create_fake_files
sort_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 Name: eepm
Version: 1.5.24 Version: 1.6.3
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,8 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,8 +67,39 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Mon Dec 07 2015 Andrey Cherepanov <cas@altlinux.org> 1.5.24-alt0.M70P.1 * Thu Apr 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt0.M70P.1
- Backport new version to p7 branch - 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 * Tue Dec 01 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.24-alt1
- add support apt-cyg on Cygwin - add support apt-cyg on Cygwin
...@@ -76,9 +107,6 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -76,9 +107,6 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
- epm-check_updated_rep: do not check on deb systems - epm-check_updated_rep: do not check on deb systems
- epm-query: fix print package version for other 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 * Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt1
- epm install: disable update if try install local package files - epm install: disable update if try install local package files
- epm clean: remove partial files - epm clean: remove partial files
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013 Etersoft # Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -247,6 +247,10 @@ set_sudo() ...@@ -247,6 +247,10 @@ set_sudo()
SUDO="" SUDO=""
# skip SUDO if disabled # skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return [ -n "$EPMNOSUDO" ] && return
if [ "$DISTRNAME" = "Cygwin" ] || [ "$DISTRNAME" = "Windows" ] ; then
# skip sudo using on Windows
return
fi
EFFUID=`id -u` EFFUID=`id -u`
...@@ -278,7 +282,7 @@ set_eatmydata() ...@@ -278,7 +282,7 @@ set_eatmydata()
# use if possible # use if possible
which eatmydata >/dev/null 2>/dev/null || return which eatmydata >/dev/null 2>/dev/null || return
SUDO="$SUDO eatmydata" 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 return 0
} }
...@@ -424,6 +428,9 @@ case $DISTRNAME in ...@@ -424,6 +428,9 @@ case $DISTRNAME in
Android) Android)
CMD="android" CMD="android"
;; ;;
Cygwin)
CMD="aptcyg"
;;
*) *)
fatal "Have no suitable DISTRNAME $DISTRNAME" fatal "Have no suitable DISTRNAME $DISTRNAME"
;; ;;
...@@ -574,6 +581,13 @@ serv_list_startup() ...@@ -574,6 +581,13 @@ serv_list_startup()
esac esac
} }
# File bin/serv-print:
serv_print()
{
echo "Detected init system: $SERVICETYPE"
}
# File bin/serv-restart: # File bin/serv-restart:
...@@ -819,7 +833,8 @@ pkgtype() ...@@ -819,7 +833,8 @@ pkgtype()
gentoo) echo "tbz2" ;; gentoo) echo "tbz2" ;;
windows) echo "exe" ;; windows) echo "exe" ;;
android) echo "apk" ;; 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) alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;; echo "rpm" ;;
fedora|redhat|scientific|centos|rhel) fedora|redhat|scientific|centos|rhel)
...@@ -853,24 +868,31 @@ fi ...@@ -853,24 +868,31 @@ fi
# ALT Linux based # ALT Linux based
if distro altlinux-release ; then if distro altlinux-release ; then
DISTRIB_ID="ALTLinux" DISTRIB_ID="ALTLinux"
if has Strawberry ; then DISTRIB_RELEASE="2.3" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has Citron ; then DISTRIB_RELEASE="2.4" elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has 20050723 ; then DISTRIB_RELEASE="3.0" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has Ajuga ; then DISTRIB_RELEASE="4.0" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has 20070810 ; then DISTRIB_RELEASE="4.0" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0" 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 "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has Walnut ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0" elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1" elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5" elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6" elif has 20050723 ; then DISTRIB_RELEASE="3.0"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7" elif has Citron ; then DISTRIB_RELEASE="2.4"
elif has 6.0 ; then DISTRIB_RELEASE="p6"
elif has Centaurea ; then DISTRIB_RELEASE="p6"
elif has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
fi fi
elif [ `uname -o` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
elif distro gentoo-release ; then elif distro gentoo-release ; then
DISTRIB_ID="Gentoo" DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile) MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
...@@ -897,6 +919,10 @@ elif distro arch-release ; then ...@@ -897,6 +919,10 @@ elif distro arch-release ; then
DISTRIB_RELEASE="2011" DISTRIB_RELEASE="2011"
fi 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 # for Ubuntu use standard LSB info
elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB version # use LSB version
...@@ -1106,7 +1132,9 @@ is_active_systemd() ...@@ -1106,7 +1132,9 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return [ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || 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 case $DISTRNAME in
...@@ -1171,9 +1199,9 @@ $(get_help HELPOPT) ...@@ -1171,9 +1199,9 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.15" echo "Service manager version 1.6.3"
echo "Running on $($DISTRVENDOR)" 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." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
} }
...@@ -1237,6 +1265,10 @@ check_command() ...@@ -1237,6 +1265,10 @@ check_command()
off|disable) # HELPCMD: remove service to run on startup and stop it now off|disable) # HELPCMD: remove service to run on startup and stop it now
serv_cmd=disable serv_cmd=disable
;; ;;
print) # HELPCMD: print some info
serv_cmd=print
withoutservicename=1
;;
*) *)
return 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