diff options
| author | crt <crt@teleco.ch> | 2025-12-13 22:21:21 +0100 |
|---|---|---|
| committer | crt <crt@teleco.ch> | 2025-12-13 22:21:21 +0100 |
| commit | a3ed430f2545906b89a366f31c73e4c22c49558c (patch) | |
| tree | 4b9a11313db2f649e75ea8eca455f0c1a09846e6 /beepzone-helper.sh | |
| parent | 37e83815f006488504157844338b1e8428434808 (diff) | |
slight goofy update
Diffstat (limited to 'beepzone-helper.sh')
| -rwxr-xr-x | beepzone-helper.sh | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/beepzone-helper.sh b/beepzone-helper.sh index 38735c4..f8d1e59 100755 --- a/beepzone-helper.sh +++ b/beepzone-helper.sh @@ -104,13 +104,14 @@ ask_main_menu() { while true; do $DIALOG --clear \ --title "BeepZone Setup" \ - --menu "Choose an action" 16 76 6 \ + --menu "Choose an action" 17 76 7 \ 1 "Configure & run MariaDB (podman)" \ 2 "Import DB schema & data" \ 3 "Manage users & roles" \ 4 "Configure & setup SeckelAPI" \ 5 "Build desktop client" \ - 6 "Quit" 2>"$CHOICE_FILE" + 6 "Clean sources" \ + 7 "Quit" 2>"$CHOICE_FILE" choice=$(<"$CHOICE_FILE") case $choice in @@ -119,7 +120,8 @@ ask_main_menu() { 3) manage_users_and_roles ;; 4) setup_seckelapi ;; 5) build_desktop_client ;; - 6) exit 0 ;; + 6) clean_sources ;; + 7) exit 0 ;; esac done } @@ -688,6 +690,54 @@ setup_seckelapi() { fi } +clean_sources() { + $DIALOG --yesno "This will delete all sources directories including hidden files:\n\n- backend/seckelapi/sources\n- frontend/desktop-client/sources\n\nAre you sure?" 12 70 || return + + local seckelapi_sources="$WORK_DIR/backend/seckelapi/sources" + local client_sources="$WORK_DIR/frontend/desktop-client/sources" + + # Clean SeckelAPI sources + if [[ -d "$seckelapi_sources" ]]; then + find "$seckelapi_sources" -mindepth 1 -delete 2>>"$LOG_FILE" + if [[ $? -eq 0 ]]; then + echo "SeckelAPI sources contents removed" >>"$LOG_FILE" + fi + fi + + # Clean desktop client sources + if [[ -d "$client_sources" ]]; then + find "$client_sources" -mindepth 1 -delete 2>>"$LOG_FILE" + if [[ $? -eq 0 ]]; then + echo "Desktop client sources contents removed" >>"$LOG_FILE" + fi + fi + + $DIALOG --msgbox "All sources cleaned!" 7 50 + + # Ask to re-clone + if $DIALOG --yesno "Do you want to pull fresh sources now?" 7 50; then + # Clone SeckelAPI + mkdir -p "$(dirname "$seckelapi_sources")" + if clone_if_missing "$SECKELAPI_REPO" "$seckelapi_sources"; then + $DIALOG --msgbox "SeckelAPI sources cloned successfully!" 7 50 + else + $DIALOG --msgbox "Failed to clone SeckelAPI sources. Check log." 7 50 + return 1 + fi + + # Clone desktop client + mkdir -p "$(dirname "$client_sources")" + if clone_if_missing "$CLIENT_REPO" "$client_sources"; then + $DIALOG --msgbox "Desktop client sources cloned successfully!" 7 50 + else + $DIALOG --msgbox "Failed to clone desktop client sources. Check log." 7 50 + return 1 + fi + + $DIALOG --msgbox "All sources pulled fresh!" 7 50 + fi +} + build_desktop_client() { local sources_dir="$WORK_DIR/frontend/desktop-client/sources" |
