Commit b8401c9e authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 2b53de67 3be9c684
...@@ -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
...@@ -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,9 @@ case $PMTYPE in ...@@ -34,7 +34,9 @@ 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 -- "^kernel")
docmd epm remove $PKGLIST docmd epm remove $PKGLIST
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
......
...@@ -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)" )
[ -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..."
......
...@@ -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
......
...@@ -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 $@
...@@ -188,7 +188,7 @@ epm_ni_install_names() ...@@ -188,7 +188,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 $@
...@@ -256,6 +256,58 @@ __epm_check_if_rpm_already_installed() ...@@ -256,6 +256,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 +319,8 @@ epm_install_files() ...@@ -267,6 +319,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 +331,15 @@ epm_install_files() ...@@ -277,11 +331,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 +354,10 @@ epm_install_files() ...@@ -296,7 +354,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 +367,9 @@ epm_install_files() ...@@ -306,7 +367,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 +381,9 @@ epm_install_files() ...@@ -318,7 +381,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=$?
......
...@@ -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
} }
...@@ -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
} }
......
...@@ -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
} }
......
...@@ -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")
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 1.8.3 Version: 1.8.4
Release: alt0.M80P.1 Release: alt0.M80P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,19 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,19 @@ 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.M80P.1 * Mon May 30 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.4-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script) - backport to ALTLinux p8 (by rpmbph script)
* 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