Commit 29bb2c21 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update packed

parent 8e0db7bb
...@@ -95,7 +95,7 @@ showcmd() ...@@ -95,7 +95,7 @@ showcmd()
if [ -z "$quiet" ] ; then if [ -z "$quiet" ] ; then
set_boldcolor $GREEN set_boldcolor $GREEN
local PROMTSIG="\$" local PROMTSIG="\$"
[ "$UID" = 0 ] && PROMTSIG="#" [ "$EFFUID" = 0 ] && PROMTSIG="#"
echo " $PROMTSIG $@" echo " $PROMTSIG $@"
restore_color restore_color
fi >&2 fi >&2
...@@ -170,15 +170,19 @@ store_output() ...@@ -170,15 +170,19 @@ store_output()
{ {
# use make_temp_file from etersoft-build-utils # use make_temp_file from etersoft-build-utils
RC_STDOUT=$(mktemp) RC_STDOUT=$(mktemp)
local CMDSTATUS=$RC_STDOUT.pipestatus
echo 1 >$CMDSTATUS
#RC_STDERR=$(mktemp) #RC_STDERR=$(mktemp)
"$@" 2>&1 | tee $RC_STDOUT ( "$@" 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT
return $(cat $CMDSTATUS)
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF # http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
return $PIPESTATUS #return $PIPESTATUS
} }
clean_store_output() clean_store_output()
{ {
rm -f $RC_STDOUT rm -f $RC_STDOUT $RC_STDOUT.pipestatus
} }
...@@ -208,11 +212,10 @@ set_sudo() ...@@ -208,11 +212,10 @@ set_sudo()
# skip SUDO if disabled # skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return [ -n "$EPMNOSUDO" ] && return
# set SUDO not for root user EFFUID=`id -u`
[ -n "$UID" ] || UID=`id -u`
# do not need sudo # do not need sudo
[ $UID = "0" ] && return [ $EFFUID = "0" ] && return
# use sudo if possible # use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return
...@@ -220,6 +223,16 @@ set_sudo() ...@@ -220,6 +223,16 @@ set_sudo()
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.'"
} }
set_eatmydata()
{
# skip if disabled
[ -n "$EPMNOEATMYDATA" ] && return
# use if possible
which eatmydata >/dev/null 2>/dev/null || return
SUDO="$SUDO eatmydata"
echo "Uwaga! eatmydata is installed, we will use it for disable all sync operations."
}
assure_exists() assure_exists()
{ {
PATH=$PATH:/sbin:/usr/sbin which $1 2>/dev/null >/dev/null && return PATH=$PATH:/sbin:/usr/sbin which $1 2>/dev/null >/dev/null && return
...@@ -246,11 +259,22 @@ assure_exists() ...@@ -246,11 +259,22 @@ assure_exists()
get_package_type() get_package_type()
{ {
local i local i
for i in deb rpm ; do case $1 in
[ "${1/.$i/}" != "$1" ] && echo $i && return *.deb)
done echo "deb"
return
;;
*.rpm)
echo "rpm"
return
;;
*)
#fatal "Don't know type of $1"
# return package name for info
echo "$1" echo "$1"
return 0 return 1
;;
esac
} }
......
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