|
|
@@ -92,6 +92,27 @@ check_root() {
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
+# Check if target directory exists and handle reinstallation
|
|
|
+check_existing_installation() {
|
|
|
+ if [[ -d "$TARGET_DIR" ]]; then
|
|
|
+ log_warn "Target directory '$TARGET_DIR' already exists."
|
|
|
+
|
|
|
+ if [[ "$ASSUME_YES" == "true" ]]; then
|
|
|
+ log_info "Removing existing installation (auto-confirmed with -y)..."
|
|
|
+ rm -rf "$TARGET_DIR"
|
|
|
+ return 0
|
|
|
+ fi
|
|
|
+
|
|
|
+ if confirm "Do you want to delete it and reinstall?" "n"; then
|
|
|
+ log_info "Removing existing installation..."
|
|
|
+ rm -rf "$TARGET_DIR"
|
|
|
+ else
|
|
|
+ echo "Installation cancelled."
|
|
|
+ exit 0
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+}
|
|
|
+
|
|
|
# Main installation function
|
|
|
run_installation() {
|
|
|
# Set up temporary directory
|
|
|
@@ -151,6 +172,9 @@ main() {
|
|
|
exit 0
|
|
|
fi
|
|
|
|
|
|
+ # Check if target directory exists and handle reinstallation
|
|
|
+ check_existing_installation
|
|
|
+
|
|
|
# Run the installation
|
|
|
run_installation
|
|
|
}
|