Clean up the CasaOS App Store Edge script

This commit is contained in:
Christopher
2023-10-26 11:35:19 -05:00
parent c6c502d891
commit a0dd00af8a

View File

@@ -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