Commit f4051c4c authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed files

parent a37be6cd
...@@ -65,7 +65,7 @@ check_tty() ...@@ -65,7 +65,7 @@ check_tty()
# egrep from busybox may not --color # egrep from busybox may not --color
# egrep from MacOS print help to stderr # egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
which tput >/dev/null 2>/dev/null || return which tput >/dev/null 2>/dev/null || return
...@@ -264,8 +264,11 @@ set_sudo() ...@@ -264,8 +264,11 @@ set_sudo()
withtimeout() withtimeout()
{ {
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null) local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ && return if [ -x "$TO" ] ; then
# drop time arg $TO $@
return
fi
# fallback: drop time arg and run without timeout
shift shift
$@ $@
} }
...@@ -475,8 +478,6 @@ esac ...@@ -475,8 +478,6 @@ esac
# File bin/epm-assure: # File bin/epm-assure:
__check_command_in_path() __check_command_in_path()
{ {
PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null
...@@ -499,6 +500,8 @@ __epm_assure() ...@@ -499,6 +500,8 @@ __epm_assure()
# TODO: use package name normalization # TODO: use package name normalization
info "Installing appropriate package for $1 command..." info "Installing appropriate package for $1 command..."
load_helper epm-install
local PACKAGE="$2" local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1" [ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2 #epm install $2
...@@ -2172,7 +2175,6 @@ epm_query() ...@@ -2172,7 +2175,6 @@ epm_query()
# File bin/epm-query_file: # File bin/epm-query_file:
__do_query_real_file() __do_query_real_file()
{ {
local LINKTO1 LINKTO local LINKTO1 LINKTO
...@@ -2298,14 +2300,17 @@ epm_query_file() ...@@ -2298,14 +2300,17 @@ epm_query_file()
# TODO: move to separate command? # TODO: move to separate command?
# FIXME: it is possible use query # FIXME: it is possible use query
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
[ -n "$pkg_files" ] || fatal "Run query without file names (needed path to files)" [ -n "$pkg_files$pkg_dirs" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files __do_short_query $pkg_files $pkg_dirs
return return
fi fi
# file can exists or not # file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names" [ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_file
for pkg in $pkg_filenames ; do for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg" __do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file __do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file
...@@ -2666,7 +2671,7 @@ epm_removerepo() ...@@ -2666,7 +2671,7 @@ epm_removerepo()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo rm "$pkg_filenames" sudocmd apt-repo rm "$quoted_args"
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list" info "You need remove repo from /etc/apt/sources.list"
...@@ -3758,7 +3763,7 @@ $(get_help HELPOPT) ...@@ -3758,7 +3763,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version 1.5.8" echo "EPM package manager version 1.5.10"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2014" echo "Copyright (c) Etersoft 2012-2014"
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."
...@@ -3781,6 +3786,7 @@ skip_installed= ...@@ -3781,6 +3786,7 @@ skip_installed=
show_command_only= show_command_only=
epm_cmd= epm_cmd=
pkg_files= pkg_files=
pkg_dirs=
pkg_names= pkg_names=
pkg_urls= pkg_urls=
quoted_args= quoted_args=
...@@ -3791,6 +3797,9 @@ case $progname in ...@@ -3791,6 +3797,9 @@ case $progname in
epmi) epmi)
epm_cmd=install epm_cmd=install
;; ;;
epmI)
epm_cmd=Install
;;
epme) epme)
epm_cmd=remove epm_cmd=remove
;; ;;
...@@ -4011,6 +4020,8 @@ check_filenames() ...@@ -4011,6 +4020,8 @@ check_filenames()
# files can be with full path or have extension via . # files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt" pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then
pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then elif echo "$opt" | grep -q "://" ; then
pkg_urls="$pkg_names $opt" pkg_urls="$pkg_names $opt"
else else
...@@ -4039,10 +4050,11 @@ if ! inputisatty ; then ...@@ -4039,10 +4050,11 @@ if ! inputisatty ; then
fi fi
pkg_files=$(strip_spaces "$pkg_files") pkg_files=$(strip_spaces "$pkg_files")
pkg_dirs=$(strip_spaces "$pkg_dirs")
pkg_names=$(strip_spaces "$pkg_names") pkg_names=$(strip_spaces "$pkg_names")
pkg_urls=$(strip_spaces "$pkg_urls") pkg_urls=$(strip_spaces "$pkg_urls")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_dirs $pkg_names")
# Just debug # Just debug
#echover "command: $epm_cmd" #echover "command: $epm_cmd"
......
...@@ -63,7 +63,7 @@ check_tty() ...@@ -63,7 +63,7 @@ check_tty()
# egrep from busybox may not --color # egrep from busybox may not --color
# egrep from MacOS print help to stderr # egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
which tput >/dev/null 2>/dev/null || return which tput >/dev/null 2>/dev/null || return
...@@ -262,8 +262,11 @@ set_sudo() ...@@ -262,8 +262,11 @@ set_sudo()
withtimeout() withtimeout()
{ {
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null) local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ && return if [ -x "$TO" ] ; then
# drop time arg $TO $@
return
fi
# fallback: drop time arg and run without timeout
shift shift
$@ $@
} }
...@@ -490,9 +493,11 @@ serv_enable() ...@@ -490,9 +493,11 @@ serv_enable()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig) service-chkconfig)
sudocmd chkconfig --add $1 sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;; ;;
service-upstart) service-upstart)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on sudocmd chkconfig $1 on
;; ;;
service-initd|service-update) service-initd|service-update)
...@@ -616,10 +621,11 @@ is_service_autostart() ...@@ -616,10 +621,11 @@ is_service_autostart()
{ {
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
LANG=C $SUDO chkconfig $1 --list | grep -q "5:on" # FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;; ;;
service-initd|service-update) service-initd|service-update)
fatal "FIXME: don't know how detect current startup state" test -L $(echo /etc/rc5.d/S??$1)
;; ;;
systemd) systemd)
$SUDO systemctl is-enabled $1 $SUDO systemctl is-enabled $1
...@@ -1141,7 +1147,7 @@ $(get_help HELPOPT) ...@@ -1141,7 +1147,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.8" echo "Service manager version 1.5.10"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013" echo "Copyright (c) Etersoft 2012, 2013"
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