citadel-core/scripts/app
2022-04-07 17:09:23 +00:00

27 lines
1018 B
Bash
Executable File

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
NODE_ROOT="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/.."
# If the first argument is stop, start, install or uninstall, and there are multiple other arguments,
# Run the "${NODE_ROOT}/app/app-manager.py" for each of the other arguments.
# Otherwise, run the "${NODE_ROOT}/app/app-manager.py" with the first argument as the command.
if [ "$1" == "stop" ] || [ "$1" == "start" ] || [ "$1" == "install" ] || [ "$1" == "uninstall" ]; then
for app in "${@:2}"; do
"${NODE_ROOT}/app/app-manager.py" "$1" "$app"
done
elif [ "$1" == "update" ] && [[ "$2" != "" ]]; then
for app in "${@:2}"; do
"${NODE_ROOT}/app/app-manager.py" --invoked-by-configure update "$app"
done
"${NODE_ROOT}/app/app-manager.py" generate
for app in "${@:2}"; do
"${NODE_ROOT}/app/app-manager.py" start "$app"
done
else
"${NODE_ROOT}/app/app-manager.py" "$@"
fi