From 4f7a7047793b0a745ee0cc9bfc580f0ad9616244 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 25 Feb 2025 12:27:48 +0100 Subject: [PATCH] update --- README.md | 2 +- installation.sh | 46 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c80a7f0..b78c328 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can download the `installation.sh` and run it: ``` wget http://gitea.aircarto.fr/PaulVua/nebuleair_pro_4g/raw/branch/main/installation.sh chmod +x installation.sh -./installation.sh +sudo ./installation.sh ``` diff --git a/installation.sh b/installation.sh index 068daa4..ce0cba3 100755 --- a/installation.sh +++ b/installation.sh @@ -18,7 +18,7 @@ error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; } # Check for root privileges if [[ "$EUID" -ne 0 ]]; then - error "This script must be run as root. Use 'sudo ./script.sh'" + error "This script must be run as root. Use 'sudo ./installation.sh'" fi # Update and install necessary packages @@ -65,12 +65,13 @@ fi # Set up repository files and permissions info "Setting up repository files and permissions..." sudo mkdir -p "$REPO_DIR/logs" -sudo touch "$REPO_DIR/logs/app.log" "$REPO_DIR/logs/loop.log" "$REPO_DIR/wifi_list.csv" +sudo touch "$REPO_DIR/logs/app.log" "$REPO_DIR/logs/master.log" "$REPO_DIR/logs/master_errors.log" "$REPO_DIR/wifi_list.csv" sudo cp "$REPO_DIR/config.json.dist" "$REPO_DIR/config.json" sudo chmod -R 755 "$REPO_DIR/" sudo chown -R www-data:www-data "$REPO_DIR/" -sudo -u www-data git config --global core.fileMode false -sudo -u www-data git config --global --add safe.directory "$REPO_DIR" +sudo git config --global core.fileMode false +sudo git -C /var/www/nebuleair_pro_4g config core.fileMode false +sudo git config --global --add safe.directory "$REPO_DIR" # Set up cron jobs (ensure file exists first) info "Setting up cron jobs..." @@ -128,6 +129,43 @@ info "Enabling I2C ports..." sudo raspi-config nonint do_i2c 0 success "I2C ports enabled." +#Add master_nebuleair.service +SERVICE_FILE="/etc/systemd/system/master_nebuleair.service" +info "Setting up systemd service for master_nebuleair..." + +# Create the systemd service file (overwrite if necessary) +sudo bash -c "cat > $SERVICE_FILE" <