From 7e7dbca5768919d3f1e50fc9981b123d6d4a6ece Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Oct 2023 11:18:28 -0500 Subject: [PATCH] Add script to simplify install and uninstall for casaos edge store --- casaos-appstore-edge/README.md | 11 ++++++++ casaos-appstore-edge/run.sh | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 casaos-appstore-edge/README.md create mode 100644 casaos-appstore-edge/run.sh diff --git a/casaos-appstore-edge/README.md b/casaos-appstore-edge/README.md new file mode 100644 index 0000000..abd92e2 --- /dev/null +++ b/casaos-appstore-edge/README.md @@ -0,0 +1,11 @@ +# About + +This script is designed to simplify the installation of the CasaOS AppStore Edge. If the CasaOS AppStore Edge is not currently installed, the script will proceed with the installation. If the CasaOS AppStore Edge is already installed, the script will prompt the user to confirm whether they wish to revert to the official app store. + +[CasaOS AppStore Edge](https://github.com/WisdomSky/CasaOS-AppStore-Edge) + +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/casaos-appstore-edge/run.sh)" +``` diff --git a/casaos-appstore-edge/run.sh b/casaos-appstore-edge/run.sh new file mode 100644 index 0000000..e3f04a9 --- /dev/null +++ b/casaos-appstore-edge/run.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Function to install Edge Appstore +install_edge_appstore() { + # Unregister the Official CasaOS Appstore + echo "Unregistering CasaOS Edge 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() { + edge_appstore_id=$(casaos-cli app-management list app-stores | grep -i "edge" | awk '{print $1}') + + 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..." + casaos-cli app-management unregister app-store "$edge_appstore_id" + + echo "Registering 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") + +if [ -z "$is_edge_installed" ]; then + # Edge Appstore is not installed + install_edge_appstore +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 ;; + n|N ) echo "Keeping the Edge Appstore." ;; + * ) echo "Invalid choice. Exiting." ;; + esac +fi + +echo "Done."