Skip to content

Commit

Permalink
feat: Install script dependencies on first script run
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWeez committed Jun 6, 2024
1 parent 68b91d9 commit 796f8f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/ctrlhelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# System vars | DO NOT TOUCH!!!
readonly SCRIPT_VER="0.0.1"
readonly DEFAULT_DIR="/var/www/controlpanel/"
readonly DEPENDENCIES_INSTALLED_FILE="/bin/.CHdeps.lock"
cpgg_dir=""
cli_mode="false"

Expand Down Expand Up @@ -208,6 +209,12 @@ set_cpgg_dir
# Moving to the CtrlPanel directory
cd "${cpgg_dir:-$DEFAULT_DIR}" || { echo " ERROR: An error occurred while trying to switch to the working directory. Please try to run the script again, if the error persists, create support forum post on CtrlPanel's Discord server!"; exit 1; }

# Install script dependencies on first run
if [ ! -f "${cpgg_dir:-$DEFAULT_DIR}$DEPENDENCIES_INSTALLED_FILE" ]; then
sudo apt-get install -y curl jq grep > /dev/null 2>&1 || { echo " ERROR: An error occurred while trying to install script dependencies. Please try to run the script again, if the error persists, create support forum post on CtrlPanel's Discord server!"; exit 1; }
touch "${cpgg_dir:-$DEFAULT_DIR}$DEPENDENCIES_INSTALLED_FILE"
fi

# Main functions
if [ "$cli_mode" == "false" ]; then

Expand Down

0 comments on commit 796f8f0

Please sign in to comment.