Commit 6f6ffd53 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm: introduce --debug and use it to enable bash -x

parent ddc0a086
......@@ -95,6 +95,7 @@ print_version()
Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager"
debug=
verbose=$EPM_VERBOSE
quiet=
nodeps=
......@@ -473,6 +474,9 @@ check_option()
--verbose) # HELPOPT: verbose mode
verbose="--verbose"
;;
--debug) # HELPOPT: more debug output mode
debug="--debug"
;;
--skip-installed) # HELPOPT: skip already installed packages during install
skip_installed=1
;;
......
......@@ -41,7 +41,7 @@ __epm_pack()
[ "$PROGDIR" = "/usr/bin" ] && SCPATH="$PATH" || SCPATH="$PROGDIR:$PATH"
local bashopt=''
[ -n "$verbose" ] && bashopt='-x'
[ -n "$debug" ] && bashopt='-x'
#info "Running $($script --description 2>/dev/null) ..."
( unset EPMCURDIR ; export PATH=$SCPATH ;docmd $CMDSHELL $bashopt $repackcode "$tarname" "$filefortarname" "$packversion" ) || fatal
returntarname="$(cat "$filefortarname")" || fatal "pack script $repackcode didn't set tarname"
......
......@@ -152,7 +152,7 @@ __epm_play_run()
addopt="$dryrun $non_interactive"
local bashopt=''
[ -n "$verbose" ] && bashopt='-x'
[ -n "$debug" ] && bashopt='-x'
#info "Running $($script --description 2>/dev/null) ..."
[ "$PROGDIR" = "/usr/bin" ] && SCPATH="$PATH" || SCPATH="$PROGDIR:$PATH"
( export EPM_OPTIONS="$EPM_OPTIONS $addopt" export PATH=$SCPATH ; docmd $CMDSHELL $bashopt $script "$@" )
......
......@@ -84,7 +84,7 @@ __apply_fix_code()
shift
[ "$PROGDIR" = "/usr/bin" ] && SCPATH="$PATH" || SCPATH="$PROGDIR:$PATH"
local bashopt=''
[ -n "$verbose" ] && bashopt='-x'
[ -n "$debug" ] && bashopt='-x'
( unset EPMCURDIR ; export PATH=$SCPATH ; docmd $CMDSHELL $bashopt $repackcode "$1" "$2" "$3" "$4" ) || fatal "There is an error from $repackcode script"
}
......
......@@ -286,7 +286,7 @@ epm()
# run epm again to full initialization
local bashopt=''
[ -n "$verbose" ] && bashopt='-x'
[ -n "$debug" ] && bashopt='-x'
$CMDSHELL $bashopt $PROGDIR/$PROGNAME --inscript "$@"
}
......@@ -297,7 +297,7 @@ sudoepm()
[ "$EPMMODE" = "pipe" ] && fatal "Can't use sudo epm call from the piped script"
local bashopt=''
[ -n "$verbose" ] && bashopt='-x'
[ -n "$debug" ] && bashopt='-x'
sudorun $CMDSHELL $bashopt $PROGDIR/$PROGNAME --inscript "$@"
}
......@@ -317,6 +317,21 @@ fatal()
exit 1
}
# Print debug message
debug()
{
[ -n "$debug" ] || return
if [ -z "$TEXTDOMAIN" ] ; then
set_color $YELLOW >&2
echo -n "WARNING: " >&2
restore_color >&2
echo "$*" >&2
# else
# echog "Error in $0: $@" >&2
fi
}
# Print warning message
warning()
{
......
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