Skip to content

Commit af4b347

Browse files
chore: Remove existing installation and clean up cron jobs for SystemGuard
This commit removes any existing installation of SystemGuard in the specified directory and cleans up previous cron jobs related to SystemGuard. It ensures a clean installation and prevents conflicts with previous installations.
1 parent 79df1f3 commit af4b347

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

setup.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,22 @@ install() {
177177
if [ "$INSTALL_METHOD" == "git" ]; then
178178
log "Installing SystemGuard from Git repository..."
179179

180-
log "Removing any existing installation in the directory $EXTRACT_DIR..."
180+
181+
log "Removing any existing installation in the directory $EXTRACT_DIR/SystemGuard-dev ..."
181182
if [ -d "$EXTRACT_DIR/SystemGuard-*" ]; then
182183
rm -rf "$EXTRACT_DIR/SystemGuard-*"
183184
log "Old installation removed."
184185
fi
185186

187+
# Clean up previous cron jobs related to SystemGuard
188+
log "Cleaning up previous cron jobs related to SystemGuard..."
189+
if $crontab_cmd -l | grep -q "$CRON_PATTERN"; then
190+
$crontab_cmd -l | grep -v "$CRON_PATTERN" | $crontab_cmd -
191+
log "Old cron jobs removed."
192+
else
193+
log "No previous cron jobs found."
194+
fi
195+
186196
log "Cloning the SystemGuard repository from GitHub..."
187197
if ! git clone https://github.com/codeperfectplus/SystemGuard.git "$EXTRACT_DIR/SystemGuard-dev"; then
188198
log "Error: Failed to clone the repository. Please check your internet connection and try again."
@@ -438,6 +448,6 @@ change_ownership() {
438448
# Call the change_ownership function
439449
change_ownership "$EXTRACT_DIR"
440450

441-
log "For any issues or feedback, please report at: $ISSUE_URL"
442-
log "For more information, check the log file: $LOG_FILE"
443-
# End of script
451+
# log "For any issues or feedback, please report at: $ISSUE_URL"
452+
# log "For more information, check the log file: $LOG_FILE"
453+
# # End of script

0 commit comments

Comments
 (0)