Commit ee51b229 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents f20146a4 13092601
...@@ -30,6 +30,7 @@ rpmvendor() ...@@ -30,6 +30,7 @@ rpmvendor()
{ {
[ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return [ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return [ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]" echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
} }
...@@ -52,6 +53,7 @@ pkgtype() ...@@ -52,6 +53,7 @@ pkgtype()
windows) echo "exe" ;; windows) echo "exe" ;;
android) echo "apk" ;; android) echo "apk" ;;
alpine) echo "apk" ;; alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
cygwin) echo "tar.xz" ;; cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst) echo "deb" ;; 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)
...@@ -137,6 +139,11 @@ elif distro os-release && which apk 2>/dev/null >/dev/null ; then ...@@ -137,6 +139,11 @@ elif distro os-release && which apk 2>/dev/null >/dev/null ; then
DISTRIB_ID="$ID" DISTRIB_ID="$ID"
DISTRIB_RELEASE="$VERSION_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 arch-release ; then elif distro arch-release ; then
DISTRIB_ID="ArchLinux" DISTRIB_ID="ArchLinux"
DISTRIB_RELEASE="2010" DISTRIB_RELEASE="2010"
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
PROGDIR=$(dirname $0) PROGDIR=$(dirname $0)
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd) [ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
PROGDIR=""
fi
# will replaced to /usr/share/eepm during install # will replaced to /usr/share/eepm during install
SHAREDIR=$PROGDIR SHAREDIR=$PROGDIR
...@@ -239,7 +242,7 @@ check_command() ...@@ -239,7 +242,7 @@ check_command()
clean) # HELPCMD: clean local package cache clean) # HELPCMD: clean local package cache
epm_cmd=clean epm_cmd=clean
;; ;;
autoremove) # HELPCMD: auto remove unneeded package(s) autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s)
epm_cmd=autoremove epm_cmd=autoremove
;; ;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
...@@ -364,8 +367,8 @@ for opt in "$@" ; do ...@@ -364,8 +367,8 @@ for opt in "$@" ; do
check_filenames $opt check_filenames $opt
done done
# if input is not console, get pkg from it too # if input is not console and run script from file, get pkgs from stdin too
if ! inputisatty ; then if ! inputisatty && [ -n "$PROGDIR" ] ; then
for opt in $(withtimeout 1 cat) ; do for opt in $(withtimeout 1 cat) ; do
check_filenames $opt check_filenames $opt
done done
......
...@@ -34,7 +34,10 @@ case $PMTYPE in ...@@ -34,7 +34,10 @@ case $PMTYPE in
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
echo "We will try remove all installed packages which are missed in repositories" echo "We will try remove all installed packages which are missed in repositories"
warning "Use with caution!" warning "Use with caution!"
local PKGLIST=$(__epm_orphan_altrpm | sed -e "s/\.32bit//g" | grep -v -- "^kernel") local PKGLIST=$(__epm_orphan_altrpm \
| sed -e "s/\.32bit//g" \
| grep -v -- "^eepm$" \
| grep -v -- "^kernel")
docmd epm remove $PKGLIST docmd epm remove $PKGLIST
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
...@@ -47,7 +50,13 @@ case $PMTYPE in ...@@ -47,7 +50,13 @@ case $PMTYPE in
# ;; # ;;
yum-rpm) yum-rpm)
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans) local PKGLIST=$(package-cleanup --orphans | grep -v "^eepm$")
docmd epm remove $PKGLIST
;;
dnf-rpm)
# TODO: dnf list extras
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans | grep -v "^eepm$")
docmd epm remove $PKGLIST docmd epm remove $PKGLIST
;; ;;
urpm-rpm) urpm-rpm)
......
...@@ -32,11 +32,11 @@ __epm_autoremove_altrpm() ...@@ -32,11 +32,11 @@ __epm_autoremove_altrpm()
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps # https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\"" showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" | \ pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \
grep -E -v -- "-(devel|debuginfo)$" | \ | grep -E -v -- "-(devel|debuginfo)$" \
grep -E -v -- "-(util|tool|plugin|daemon)" | \ | grep -E -v -- "-(util|tool|plugin|daemon)" \
sed -e "s/\.32bit$//g" | \ | sed -e "s/\.32bit$//g" \
grep -E -v -- "^(libsystemd|libreoffice|libnss)" ) | grep -E -v -- "^(libsystemd|libreoffice|libnss|eepm)" )
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1 [ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
info "Removing unused python/perl modules..." info "Removing unused python/perl modules..."
...@@ -55,7 +55,7 @@ __epm_autoremove_altrpm() ...@@ -55,7 +55,7 @@ __epm_autoremove_altrpm()
return 0 return 0
} }
# TODO: keep our eepm package
epm_autoremove() epm_autoremove()
{ {
...@@ -82,7 +82,7 @@ case $PMTYPE in ...@@ -82,7 +82,7 @@ case $PMTYPE in
while true ; do while true ; do
docmd package-cleanup --leaves $(subst_option non_interactive --assumeyes) docmd package-cleanup --leaves $(subst_option non_interactive --assumeyes)
# FIXME: package-cleanup have to use stderr for errors # 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 --leaves | grep -v "Loaded plugins" | grep -v "Unable to" | grep -v "^eepm$")
[ -n "$PKGLIST" ] || break [ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST sudocmd yum remove $PKGLIST
done done
......
...@@ -31,7 +31,13 @@ epm_download() ...@@ -31,7 +31,13 @@ epm_download()
yum-rpm) yum-rpm)
# TODO: check yum install --downloadonly --downloaddir=/tmp <package-name> # TODO: check yum install --downloadonly --downloaddir=/tmp <package-name>
assure_exists yumdownloader yum-utils assure_exists yumdownloader yum-utils
sudo yumdownloader $pkg_filenames 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" fatal "Have no suitable command for $PMTYPE"
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
etersoft_updates_site="http://updates.etersoft.ru/pub/Etersoft/Sisyphus/$($DISTRVENDOR -e)/" myinit(){
download_dir="/tmp" etersoft_updates_site="http://updates.etersoft.ru/pub/Etersoft/Sisyphus/$($DISTRVENDOR -e)/"
download_dir="/tmp"
}
download_epm(){ download_epm(){
download_link=$etersoft_updates_site$(wget -qO- $etersoft_updates_site/ | grep -m1 -Eo "eepm[^\"]+\.$($DISTRVENDOR -p)" | tail -n1) #" download_link=$etersoft_updates_site$(wget -qO- $etersoft_updates_site/ | grep -m1 -Eo "eepm[^\"]+\.$($DISTRVENDOR -p)" | tail -n1) #"
...@@ -27,6 +29,7 @@ download_epm(){ ...@@ -27,6 +29,7 @@ download_epm(){
} }
epm_epm_install(){ epm_epm_install(){
myinit
download_epm || fatal "Error. Check download link: $download_link" download_epm || fatal "Error. Check download link: $download_link"
epm i $eepm_package || fatal epm i $eepm_package || fatal
rm -fv $eepm_package rm -fv $eepm_package
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013 Etersoft # Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-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
...@@ -101,7 +101,7 @@ epm_install_names() ...@@ -101,7 +101,7 @@ epm_install_names()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
sudocmd apt-get $APTOPTIONS install $@ sudocmd apt-get $APTOPTIONS $noremove install $@
return ;; return ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude install $@ sudocmd aptitude install $@
...@@ -166,6 +166,9 @@ epm_install_names() ...@@ -166,6 +166,9 @@ epm_install_names()
apk) apk)
sudocmd apk add $@ sudocmd apk add $@
return ;; return ;;
tce)
sudocmd tce-load -wi $@
return ;;
guix) guix)
__separate_sudocmd "guix package -i" "guix package -i" $@ __separate_sudocmd "guix package -i" "guix package -i" $@
return ;; return ;;
...@@ -188,7 +191,7 @@ epm_ni_install_names() ...@@ -188,7 +191,7 @@ epm_ni_install_names()
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
export DEBIAN_FRONTEND=noninteractive 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 ;; return ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitde -y install $@ sudocmd aptitde -y install $@
...@@ -237,6 +240,9 @@ epm_ni_install_names() ...@@ -237,6 +240,9 @@ epm_ni_install_names()
apk) apk)
sudocmd apk add $@ sudocmd apk add $@
return ;; return ;;
tce)
sudocmd tce-load -wi $@
return ;;
#android) #android)
# sudocmd pm install $@ # sudocmd pm install $@
# return ;; # return ;;
...@@ -256,6 +262,58 @@ __epm_check_if_rpm_already_installed() ...@@ -256,6 +262,58 @@ __epm_check_if_rpm_already_installed()
LANG=C $SUDO rpm -Uvh $force $nodeps $@ 2>&1 | grep -q "is 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
showcmd alien -r -k --scripts "$pkg"
# TODO: need check for return status
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
local TDIR=$(mktemp -d)
cd $TDIR
for pkg in $rpmpkgs ; do
showcmd alien -d -k --scripts "$pkg"
# TODO: need check for return status
done
rm -f $TDIR/*
rmdir $TDIR/
return 0
}
epm_install_files() epm_install_files()
{ {
...@@ -267,6 +325,8 @@ epm_install_files() ...@@ -267,6 +325,8 @@ epm_install_files()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$? local RES=$?
...@@ -277,11 +337,15 @@ epm_install_files() ...@@ -277,11 +337,15 @@ epm_install_files()
# use install_names # use install_names
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
# the new version of the conf. file is installed with a .dpkg-dist suffix # the new version of the conf. file is installed with a .dpkg-dist suffix
if [ -n "$non_interactive" ] ; then if [ -n "$non_interactive" ] ; then
DPKGOPTIONS="--force-confdef --force-confold" DPKGOPTIONS="--force-confdef --force-confold"
fi fi
__epm_check_if_try_install_rpm $@ && return
# FIXME: return false in case no install and in case install with broken deps # FIXME: return false in case no install and in case install with broken deps
sudocmd dpkg $DPKGOPTIONS -i $@ sudocmd dpkg $DPKGOPTIONS -i $@
local RES=$? local RES=$?
...@@ -296,7 +360,10 @@ epm_install_files() ...@@ -296,7 +360,10 @@ epm_install_files()
sudocmd dpkg $DPKGOPTIONS -i $@ sudocmd dpkg $DPKGOPTIONS -i $@
return return
;; ;;
yum-rpm|dnf-rpm) yum-rpm|dnf-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
# if run with --nodeps, do not fallback on hi level # if run with --nodeps, do not fallback on hi level
...@@ -306,7 +373,9 @@ epm_install_files() ...@@ -306,7 +373,9 @@ epm_install_files()
YUMOPTIONS=--nogpgcheck YUMOPTIONS=--nogpgcheck
# use install_names # use install_names
;; ;;
zypper-rpm) zypper-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$? local RES=$?
...@@ -318,7 +387,9 @@ epm_install_files() ...@@ -318,7 +387,9 @@ epm_install_files()
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks) ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names # use install_names
;; ;;
urpm-rpm) urpm-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$? local RES=$?
...@@ -406,6 +477,9 @@ epm_print_install_command() ...@@ -406,6 +477,9 @@ epm_print_install_command()
aptcyg) aptcyg)
echo "apt-cyg install $@" echo "apt-cyg install $@"
;; ;;
tce)
echo "tce-load -wi $@"
;;
*) *)
fatal "Have no suitable appropriate install command for $PMTYPE" fatal "Have no suitable appropriate install command for $PMTYPE"
;; ;;
......
...@@ -125,6 +125,9 @@ case $PMTYPE in ...@@ -125,6 +125,9 @@ case $PMTYPE in
apk) apk)
CMD="apk info" CMD="apk info"
;; ;;
tce)
CMD="ls -1 /usr/local/tce.installed"
;;
guix) guix)
CMD="guix package -I" CMD="guix package -I"
;; ;;
......
...@@ -39,7 +39,9 @@ print_binpkgfilelist() ...@@ -39,7 +39,9 @@ print_binpkgfilelist()
local PKGNAME=$(basename $2) local PKGNAME=$(basename $2)
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \ find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
rpmquery -p --qf='%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n' "{}" \; \ 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 # TODO: need try detect more strict
......
...@@ -146,6 +146,16 @@ __epm_query_file() ...@@ -146,6 +146,16 @@ __epm_query_file()
docmd $CMD $@ 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() __epm_query_name()
{ {
local CMD local CMD
...@@ -158,7 +168,10 @@ __epm_query_name() ...@@ -158,7 +168,10 @@ __epm_query_name()
;; ;;
*-dpkg) *-dpkg)
#docmd dpkg -l $@ | grep "^ii" #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) npackd)
docmd "npackdcl path --package=$@" docmd "npackdcl path --package=$@"
...@@ -197,7 +210,10 @@ __epm_query_shortname() ...@@ -197,7 +210,10 @@ __epm_query_shortname()
CMD="rpm -q --queryformat %{name}\n" CMD="rpm -q --queryformat %{name}\n"
;; ;;
*-dpkg) *-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) npackd)
docmd "npackdcl path --package=$@" docmd "npackdcl path --package=$@"
...@@ -228,7 +244,7 @@ __epm_query_shortname() ...@@ -228,7 +244,7 @@ __epm_query_shortname()
# check if pkg is installed # check if pkg is installed
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!) # broken way to recursive call here (overhead!)
#epm installed $@ >/dev/null 2>/dev/null #epm installed $@ >/dev/null 2>/dev/null
} }
......
...@@ -35,15 +35,21 @@ __wcount() ...@@ -35,15 +35,21 @@ __wcount()
__detect_alt_release_by_repo() __detect_alt_release_by_repo()
{ {
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \ 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 ) | grep -v "^#" \
| grep "p[5-9]/branch/" \
| sed -e "s|.*\(p[5-9]\)/branch.*|\1|g" \
| sort -u )
if [ $(__wcount $BRD) = "1" ] ; then if [ $(__wcount $BRD) = "1" ] ; then
echo "$BRD" echo "$BRD"
return return
fi fi
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \ 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 ) | grep -v "^#" \
| grep "Sisyphus/" \
| sed -e "s|.*\(Sisyphus\).*|\1|g" \
| sort -u )
if [ $(__wcount $BRD) = "1" ] ; then if [ $(__wcount $BRD) = "1" ] ; then
echo "$BRD" echo "$BRD"
return return
...@@ -58,8 +64,11 @@ __replace_alt_version_in_repo() ...@@ -58,8 +64,11 @@ __replace_alt_version_in_repo()
assure_exists apt-repo assure_exists apt-repo
#echo "Upgrading $DISTRNAME from $1 to $2 ..." #echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1" docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
confirm "Are these correct changes? [y/N]" || fatal "Exiting" # ask and replace only we will have changes
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g" if 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 docmd apt-repo list
} }
...@@ -94,8 +103,8 @@ __update_to_the_distro() ...@@ -94,8 +103,8 @@ __update_to_the_distro()
p8) p8)
docmd epm update || fatal docmd epm update || fatal
if ! docmd epm install apt rpm apt-conf-branch $(get_fix_release_pkg p8) ; then if ! docmd epm install apt rpm apt-conf-branch $(get_fix_release_pkg p8) ; then
# error: execution of %post scriptlet from glibc-core-2.23-alt1.eter1 # Hack for 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 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" docmd epm install apt rpm apt-conf-branch $(get_fix_release_pkg p8) || fatal "Check an error and run epm release-upgrade again"
fi fi
__alt_repofix __alt_repofix
...@@ -160,6 +169,7 @@ __update_alt_to_next_distro() ...@@ -160,6 +169,7 @@ __update_alt_to_next_distro()
*) *)
warning "Have no idea how to update from $DISTRNAME $DISTRVERSION." warning "Have no idea how to update from $DISTRNAME $DISTRVERSION."
info "Try run f.i. # epm release-upgrade p8 or # epm release-upgrade Sisyphus" 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 return 1
esac esac
} }
...@@ -177,8 +187,12 @@ epm_release_upgrade() ...@@ -177,8 +187,12 @@ epm_release_upgrade()
# try to detect current release by repo # try to detect current release by repo
if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then
DISTRVERSION="$(__detect_alt_release_by_repo)" local dv
[ "$DISTRVERSION" != "Sisyphus" ] && info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)" 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 fi
__alt_repofix __alt_repofix
...@@ -197,7 +211,7 @@ epm_release_upgrade() ...@@ -197,7 +211,7 @@ epm_release_upgrade()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd epm update #docmd epm update
info "Have no idea how to upgrade $DISTRNAME" info "Have no idea how to upgrade $DISTRNAME"
;; ;;
*-dpkg) *-dpkg)
...@@ -211,6 +225,18 @@ epm_release_upgrade() ...@@ -211,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 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 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) urpm-rpm)
sudocmd urpmi.removemedia -av sudocmd urpmi.removemedia -av
# TODO # TODO
......
...@@ -19,6 +19,16 @@ ...@@ -19,6 +19,16 @@
load_helper epm-query 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() __fix_apt_sources_list()
{ {
local SUBST_ALT_RULE='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p8[/ ]branch|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi' local SUBST_ALT_RULE='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p8[/ ]branch|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
...@@ -31,15 +41,34 @@ __fix_apt_sources_list() ...@@ -31,15 +41,34 @@ __fix_apt_sources_list()
#sed -i -r -e "$SUBST_ALT_RULE" $i #sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! $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 local br
for br in $DISTRVERSION ; do for br in $DISTRVERSION ; do
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 regexp_subst "/ALTLinux\/$br\/branch/s/^rpm *([fhr])/rpm [$br] \1/" $i
if is_installed apt-conf-etersoft-common ; then done
regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
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 fi
regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
done done
regexp_subst "/ALTLinux\/Sisyphus\//s/^rpm *([fhr])/rpm [alt] \1/" $i
done done
} }
......
...@@ -67,6 +67,9 @@ case $PMTYPE in ...@@ -67,6 +67,9 @@ case $PMTYPE in
apk) apk)
CMD="apk search" CMD="apk search"
;; ;;
tce)
CMD="tce-ab"
;;
conary) conary)
CMD="conary repquery" CMD="conary repquery"
;; ;;
......
...@@ -261,7 +261,12 @@ set_sudo() ...@@ -261,7 +261,12 @@ set_sudo()
[ $EFFUID = "0" ] && return [ $EFFUID = "0" ] && return
# use sudo if possible # 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 --
sudo --help | grep -q " --" || SUDO="sudo"
return
fi
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
...@@ -389,6 +394,10 @@ get_package_type() ...@@ -389,6 +394,10 @@ get_package_type()
# print options description from HELPCMD/HELPOPT lines in the code # print options description from HELPCMD/HELPOPT lines in the code
get_help() get_help()
{ {
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return
fi
grep -v -- "^#" $0 | grep -- "# $1" | while read n ; do grep -v -- "^#" $0 | grep -- "# $1" | while read n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g") opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g") desc=$(echo $n | sed -e "s|.*) # $1:||g")
...@@ -474,6 +483,9 @@ case $DISTRNAME in ...@@ -474,6 +483,9 @@ case $DISTRNAME in
alpine) alpine)
CMD="apk" CMD="apk"
;; ;;
TinyCoreLinux)
CMD="tce"
;;
*) *)
fatal "Have no suitable DISTRNAME $DISTRNAME" fatal "Have no suitable DISTRNAME $DISTRNAME"
;; ;;
......
...@@ -44,7 +44,7 @@ epm_upgrade() ...@@ -44,7 +44,7 @@ epm_upgrade()
CMD="yum update" CMD="yum update"
;; ;;
dnf-rpm) dnf-rpm)
CMD="dnf update" CMD="dnf distro-sync"
;; ;;
snappy) snappy)
CMD="snappy update" CMD="snappy update"
......
# This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 1.8.3 Version: 1.8.5
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,24 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,24 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Mon May 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.3-alt0.M70P.1 * Sat Jul 16 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.5-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* 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 * Mon May 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.3-alt1
- autoorphans: do real removing - autoorphans: do real removing
- autoremove: add update-kernel version 0.9.9 checking - autoremove: add update-kernel version 0.9.9 checking
......
...@@ -41,7 +41,7 @@ get_version() ...@@ -41,7 +41,7 @@ get_version()
filter_out() 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|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g" sed -e "s|@VERSION@|$(get_version)|g"
} }
......
...@@ -258,7 +258,12 @@ set_sudo() ...@@ -258,7 +258,12 @@ set_sudo()
[ $EFFUID = "0" ] && return [ $EFFUID = "0" ] && return
# use sudo if possible # 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 --
sudo --help | grep -q " --" || SUDO="sudo"
return
fi
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
...@@ -326,7 +331,6 @@ regexp_subst() ...@@ -326,7 +331,6 @@ regexp_subst()
assure_exists() assure_exists()
{ {
load_helper epm-assure
local package="$2" local package="$2"
local textpackage= local textpackage=
[ -n "$package" ] || package="$(__get_package_for_command "$1")" [ -n "$package" ] || package="$(__get_package_for_command "$1")"
...@@ -379,6 +383,10 @@ get_package_type() ...@@ -379,6 +383,10 @@ get_package_type()
get_help() get_help()
{ {
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return
fi
grep -v -- "^#" $0 | grep -- "# $1" | while read n ; do grep -v -- "^#" $0 | grep -- "# $1" | while read n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g") opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g") desc=$(echo $n | sed -e "s|.*) # $1:||g")
...@@ -578,8 +586,6 @@ serv_list() ...@@ -578,8 +586,6 @@ serv_list()
sudocmd systemctl list-units $@ sudocmd systemctl list-units $@
;; ;;
*) *)
load_helper serv-list_all
load_helper serv-status
for i in $(serv_list_all) ; do for i in $(serv_list_all) ; do
is_service_running $i >/dev/null && echo $i is_service_running $i >/dev/null && echo $i
done done
...@@ -614,8 +620,6 @@ serv_list_startup() ...@@ -614,8 +620,6 @@ serv_list_startup()
{ {
case $SERVICETYPE in case $SERVICETYPE in
*) *)
load_helper serv-list_all
load_helper serv-status
for i in $(serv_list_all | cut -f 1 -d" " | grep "\.service$") ; do for i in $(serv_list_all | cut -f 1 -d" " | grep "\.service$") ; do
is_service_autostart >/dev/null $i && echo $i is_service_autostart >/dev/null $i && echo $i
done done
...@@ -1237,7 +1241,7 @@ $(get_help HELPOPT) ...@@ -1237,7 +1241,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.8.2" echo "Service manager version 1.8.4"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013, 2016" 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."
......
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