Skip to content

Commit b459237

Browse files
committed
Installation fixes
1 parent dce8b19 commit b459237

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

setup.sh

100755100644
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
# ----------------------------
55
# This script installs, uninstalls, backs up, restores App, and includes load testing using Locust.
66

7-
USER_NAME=$(logname)
7+
USER_NAME=$USER
8+
echo $USER_NAME
9+
echo $HOME
10+
if [ "$(whoami)" = "root" ]; then
11+
USER_NAME=$(cat /etc/passwd | grep '/home' | cut -d: -f1 | tail -n 1)
12+
else
13+
USER_NAME=$(whoami)
14+
fi
15+
echo $USER_NAME
816
USER_HOME=/home/$USER_NAME
917

1018
# Define directories and file paths
@@ -562,7 +570,7 @@ install_from_git() {
562570
# Construct the full Git URL with branch
563571
FULL_GIT_URL="$GITHUB_URL -b $BRANCH"
564572

565-
set_auto_update "$APP_NAME_LOWER-AUTO-UPDATE"
573+
set_auto_update "sg_auto_update"
566574

567575
log "Cloning the $APP_NAME repository from GitHub..."
568576
create_and_own_dir "$GIT_INSTALL_DIR"
@@ -874,8 +882,8 @@ update_dependencies() {
874882

875883
log "INFO" "Installing dependencies from $REQUIREMENTS_FILE..."
876884

877-
# Install dependencies silently
878-
sudo -u "$SUDO_USER" bash -c "source $CONDA_SETUP_SCRIPT && conda activate $CONDA_ENV_NAME && pip install -r $EXTRACT_DIR/$APP_NAME-*/$REQUIREMENTS_FILE" > /dev/null 2>&1 || {
885+
# Install dependencies
886+
sudo -u "$SUDO_USER" bash -c "source $CONDA_SETUP_SCRIPT && conda activate $CONDA_ENV_NAME && pip install -r $EXTRACT_DIR/$APP_NAME-*/$REQUIREMENTS_FILE" || {
879887
log "ERROR" "Failed to install dependencies from $REQUIREMENTS_FILE."
880888
exit 1
881889
}
@@ -888,7 +896,7 @@ install_conda_env() {
888896
log "Checking conda environment $CONDA_ENV_NAME..."
889897
if ! "$CONDA_EXECUTABLE" env list | grep -q "$CONDA_ENV_NAME"; then
890898
log "Creating Conda environment $CONDA_ENV_NAME..."
891-
"$CONDA_EXECUTABLE" create -n "$CONDA_ENV_NAME" python=3.8 -y || { log "ERROR" "Failed to create Conda environment $CONDA_ENV_NAME"; exit 1; }
899+
"$CONDA_EXECUTABLE" create -n "$CONDA_ENV_NAME" python=3.11 -y || { log "ERROR" "Failed to create Conda environment $CONDA_ENV_NAME"; exit 1; }
892900
# install the dependencies
893901
update_dependencies
894902
else
@@ -1050,3 +1058,4 @@ case $ACTION in
10501058
fetch_github_releases) fetch_github_releases ;;
10511059
*) echo "No action specified. Use --help for usage information." ;;
10521060
esac
1061+

src/scripts/dashboard.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ PROJECT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
5555
FLASK_APP_PATH="${FLASK_APP_PATH:-$PROJECT_DIR/app.py}"
5656
REQUIREMENTS_FILE="${REQUIREMENTS_FILE:-$PROJECT_DIR/requirements.txt}"
5757
FLASK_PORT="${FLASK_PORT:-5050}"
58-
$APP_NAME="systemguard"
58+
APP_NAME="systemguard"
5959
LOG_FILE="/home/$(whoami)/logs/$APP_NAME-flask.log"
6060
USERNAME="$(whoami)"
6161
CONDA_ENV_NAME=$APP_NAME
6262
GIT_REMOTE_URL="https://github.com/codeperfectplus/SystemDashboard" # Set this if you want to add a remote
6363

6464
# Fetch from bashrc for auto-update
65-
auto_update=$(grep -E "^export $APP_NAME-AUTO-UPDATE=" /home/$(whoami)/.bashrc | cut -d'=' -f2)
65+
auto_update=$(grep -E "^export sg_auto_update=" /home/$(whoami)/.bashrc | cut -d'=' -f2)
6666
echo "auto-update:" $auto_update
6767
#
6868
# Ensure log directory exists

0 commit comments

Comments
 (0)