Commit 0eee1167 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm: add support for run script from stdin

parent 0b36f5c0
......@@ -19,6 +19,9 @@
PROGDIR=$(dirname $0)
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
PROGDIR=""
fi
# will replaced to /usr/share/eepm during install
SHAREDIR=$PROGDIR
......@@ -364,8 +367,8 @@ for opt in "$@" ; do
check_filenames $opt
done
# if input is not console, get pkg from it too
if ! inputisatty ; then
# if input is not console and run script from file, get pkgs from stdin too
if ! inputisatty && [ -n "$PROGDIR" ] ; then
for opt in $(withtimeout 1 cat) ; do
check_filenames $opt
done
......
......@@ -394,6 +394,10 @@ get_package_type()
# print options description from HELPCMD/HELPOPT lines in the code
get_help()
{
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return
fi
grep -v -- "^#" $0 | grep -- "# $1" | while read n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g")
......
......@@ -41,7 +41,7 @@ get_version()
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"
}
......
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