fix(entrypoint): fix shell action

This commit is contained in:
Asif Bacchus 2021-07-22 18:44:29 -06:00
parent f30e22b333
commit ba7d33943e
1 changed files with 13 additions and 5 deletions

View File

@ -33,8 +33,9 @@ case "$1" in
listen | server | run | start) listen | server | run | start)
doServer=1 doServer=1
;; ;;
shell) ;; shell)
doShell=1
;;
new-cert) new-cert)
doCertNew=1 doCertNew=1
;; ;;
@ -47,20 +48,27 @@ export-cert)
*) *)
# invalid or unknown option # invalid or unknown option
printf "\nUnknown action requested: %s\n" "$1" printf "\nUnknown action requested: %s\n" "$1"
printf "Valid actions: [listen | server | run | start] | shell | new-cert | show-cert | export-cert" printf "Valid actions: [listen | server | run | start] | shell | new-cert | show-cert | export-cert\n\n"
exit 1 exit 1
;; ;;
esac esac
# action: run server # action: run server
if [ "$doServer" -eq 1 ]; then if [ "$doServer" -eq 1 ]; then
exec "node livereload.js" exec node livereload.js
exit "$?" exit "$?"
fi fi
# action: drop to shell # action: drop to shell
if [ "$doShell" -eq 1 ]; then if [ "$doShell" -eq 1 ]; then
exec /bin/sh "$@" if [ -z "$2" ]; then
printf "\nExecuting interactive shell:\n"
exec /bin/sh
else
shift
printf "\nExecuting shell: '%s'\n" "$*"
exec /bin/sh -c "$*"
fi
exit "$?" exit "$?"
fi fi