Commit a8dc5a5f authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm prescription: implement via epm play functions

parent fcef1a06
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015, 2017, 2019, 2020 Etersoft # Copyright (C) 2015, 2017, 2019, 2020, 2022 Etersoft
# Copyright (C) 2015, 2017, 2019, 2020 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2015, 2017, 2019, 2020, 2022 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -17,28 +17,7 @@ ...@@ -17,28 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# TODO load_helper epm-play
epm_vardir=/var/lib/eepm
__epm_prescription_run()
{
local script="$psdir/$1.sh"
shift
local option="$1"
if [ ! -x "$script" ] ; then
fatal "Can't find $script prescription."
fi
# allow use EGET in the scripts
__set_EGET
# also we will have DISTRVENDOR there
export PATH=$PROGDIR:$PATH
#info "Running $($script --description 2>/dev/null) ..."
docmd $script $option
}
epm_prescription() epm_prescription()
{ {
...@@ -48,34 +27,22 @@ local psdir="$CONFIGDIR/prescription.d" ...@@ -48,34 +27,22 @@ local psdir="$CONFIGDIR/prescription.d"
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
cat <<EOF cat <<EOF
Options: Options:
<receipt> - run receipt <receipt> - run <receipt>
--list-all - list all available receipts --list-all - list all available receipts
EOF EOF
exit exit
fi fi
[ "$($DISTRVENDOR -a)" = "x86_64" ] && IGNOREi586='' || IGNOREi586=1
if [ "$1" == "--list-all" ] || [ -z "$*" ] ; then if [ "$1" == "--list-all" ] || [ -z "$*" ] ; then
if [ -n "$short" ] ; then [ -n "$short" ] || [ -n "$quiet" ] || echo "Run with a name of a prescription to run:"
for i in $psdir/*.sh ; do __epm_play_list $psdir
local name=$(basename $i .sh)
[ -n "$IGNOREi586" ] && rhas "$name" "^i586-" && continue
rhas "$name" "^common" && continue
echo "$name"
done
exit
fi
echo "Run with a name of a prescription to run:"
for i in $psdir/*.sh ; do
local name=$(basename $i .sh)
[ -n "$IGNOREi586" ] && rhas "$name" "^i586-" && continue
rhas "$name" "^common" && continue
printf " %-20s - %s\n" "$name" "$($i --description 2>/dev/null)"
done
echo
exit exit
fi fi
__epm_prescription_run "$1" --run prescription="$1"
shift
__check_play_script "$prescription" || fatal "We have no idea how to play $prescription (checked in $psdir)"
__epm_play_run "$prescription" --run "$@" || fatal "There was some error during run the script."
} }
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