From a0dd00af8aad3b3e4e58f95a896e93d983a00e27 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Oct 2023 11:35:19 -0500 Subject: [PATCH] Clean up the CasaOS App Store Edge script --- casaos-appstore-edge/run.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/casaos-appstore-edge/run.sh b/casaos-appstore-edge/run.sh index bf93b99..1b03235 100644 --- a/casaos-appstore-edge/run.sh +++ b/casaos-appstore-edge/run.sh @@ -1,46 +1,43 @@ #!/bin/bash # Function to install Edge Appstore -install_edge_appstore() { +installEdgeAppstore() { # Unregister the Official CasaOS Appstore - echo "Unregistering Official CasaOS Appstore..." casaos-cli app-management unregister app-store 0 # Register the Edge Appstore - echo "Installing CasaOS Edge Appstore..." casaos-cli app-management register app-store https://casaos-appstore.paodayag.dev/edge.zip - echo "CasaOS Edge Appstore installed." } # Function to revert to the Official Appstore -revert_to_official_appstore() { +revertToOfficialAppstore() { + # Get the ID of the Edge Appstore edge_appstore_id=$(casaos-cli app-management list app-stores | grep -i "edge" | awk '{print $1}') + # Check if Edge Appstore ID was found if [ -z "$edge_appstore_id" ]; then echo "Error: Could not find CasaOS Edge Appstore ID." exit 1 fi - echo "Unregistering CasaOS Edge Appstore with ID: $edge_appstore_id..." + # Unregister the Edge Appstore casaos-cli app-management unregister app-store "$edge_appstore_id" - echo "Registering the Official CasaOS Appstore..." + # Register the Official CasaOS Appstore casaos-cli app-management register app-store https://github.com/IceWhaleTech/CasaOS-AppStore/archive/refs/heads/main.zip - echo "Switched back to the Official CasaOS Appstore." } # Check if Edge Appstore is already installed -is_edge_installed=$(casaos-cli app-management list app-stores | grep -i "edge") +isEdgeInstalled=$(casaos-cli app-management list app-stores | grep -i "edge") -if [ -z "$is_edge_installed" ]; then +if [ -z "$isEdgeInstalled" ]; then # Edge Appstore is not installed - install_edge_appstore + installEdgeAppstore else # Edge Appstore is already installed - echo "CasaOS Edge Appstore is already installed." read -p "Do you want to revert to the Official CasaOS Appstore? (y/n): " choice case "$choice" in - y|Y ) revert_to_official_appstore ;; + y|Y ) revertToOfficialAppstore ;; n|N ) echo "Keeping the Edge Appstore." ;; * ) echo "Invalid choice. Exiting." ;; esac