Commit b0761cf6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play: add support for run direct script

parent e8e48215
......@@ -158,9 +158,9 @@ __check_play_script()
}
__epm_play_run()
__epm_play_run_script()
{
local script="$psdir/$1.sh"
local script="$1"
shift
local addopt
......@@ -173,6 +173,13 @@ __epm_play_run()
( export EPM_OPTIONS="$EPM_OPTIONS $addopt" export PATH=$SCPATH ; docmd $CMDSHELL $bashopt $script "$@" )
}
__epm_play_run()
{
local script="$psdir/$1.sh"
shift
__epm_play_run_script "$script" "$@"
}
__epm_play_list_installed()
{
local i
......@@ -257,11 +264,20 @@ Examples:
EOF
}
__epm_is_shell_script()
{
local script="$1"
[ -x "$script" ] && rhas "$script" "\.sh$" && head -n1 "$script" | grep -q "^#!/bin/sh"
}
__epm_play_remove()
{
local prescription
for prescription in $* ; do
if __epm_is_shell_script "$prescription" ; then
__epm_play_run_script $prescription --remove
continue
fi
if __check_play_script "$prescription" ; then
__epm_play_run $prescription --remove
__remove_installed_app "$prescription"
......@@ -305,6 +321,12 @@ __epm_play_install_one()
local prescription="$1"
shift
if __epm_is_shell_script "$prescription" ; then
# direct run play script
__epm_play_run_script "$prescription" --run "$@" || fatal "There was some error during install the application."
return
fi
if __check_play_script "$prescription" ; then
#__is_app_installed "$prescription" && info "$$prescription is already installed (use --remove to remove)" && exit 1
__epm_play_run "$prescription" --run "$@" && __save_installed_app "$prescription" || fatal "There was some error during install the application."
......
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