Instantly share code, notes, and snippets.
Last active
August 21, 2024 09:23
-
Star
1
(1)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save Mintedshrimp/ab8682d460d4e3d1fd6993757f3b3df4 to your computer and use it in GitHub Desktop.
Udroid Menu for ease of use (Updated UI)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to install Ubuntu | |
install_ubuntu() { | |
echo "Updating package list and upgrading packages..." | |
apt update && apt upgrade -y | |
apt install git -y | |
git clone https://github.com/RandomCoderOrg/fs-manager-udroid | |
cd fs-manager-udroid || { dialog --msgbox "π« Failed to enter fs-manager-udroid directory." 5 50; return; } | |
# List available Ubuntu distributions | |
dialog --title "π¦ Available Ubuntu Distributions" --msgbox "$(udroid list)" 20 60 | |
# Prompt for the Ubuntu distribution name | |
ubuntu_distro=$(dialog --inputbox "π Enter the name of the Ubuntu distribution you want to install (Press Enter to exit):" 8 50 3>&1 1>&2 2>&3) | |
# Check if the user pressed Enter (empty input) | |
if [ -z "$ubuntu_distro" ]; then | |
dialog --msgbox "β Installation canceled." 5 30 | |
return | |
fi | |
# Execute the installation command | |
udroid install "$ubuntu_distro" | |
dialog --msgbox "β Ubuntu distribution '$ubuntu_distro' has been installed!" 5 50 | |
# List available Ubuntu distributions again | |
dialog --title "π¦ Available Ubuntu Distributions" --msgbox "$(udroid list)" 20 60 | |
} | |
# Function to login to Ubuntu | |
login_ubuntu() { | |
# List available Ubuntu distributions | |
dialog --title "π¦ Available Ubuntu Distributions" --msgbox "$(udroid list)" 20 60 | |
# Prompt for the Ubuntu distribution name | |
ubuntu_distro=$(dialog --inputbox "π Enter the name of the Ubuntu distribution you want to login to (Press Enter to exit):" 8 50 3>&1 1>&2 2>&3) | |
# Check if the user pressed Enter (empty input) | |
if [ -z "$ubuntu_distro" ]; then | |
dialog --msgbox "β Login canceled." 5 30 | |
return | |
fi | |
# Execute the login command | |
udroid login "$ubuntu_distro" | |
dialog --msgbox "π Logged into Ubuntu distribution '$ubuntu_distro'!" 5 50 | |
} | |
# Function to remove Ubuntu | |
remove_ubuntu() { | |
# List available Ubuntu distributions | |
dialog --title "π¦ Available Ubuntu Distributions" --msgbox "$(udroid list)" 20 60 | |
# Prompt for the Ubuntu distribution name | |
ubuntu_distro=$(dialog --inputbox "π Enter the name of the Ubuntu distribution you want to remove (Press Enter to exit):" 8 50 3>&1 1>&2 2>&3) | |
# Check if the user pressed Enter (empty input) | |
if [ -z "$ubuntu_distro" ]; then | |
dialog --msgbox "β Removal canceled." 5 30 | |
return | |
fi | |
# Execute the removal command | |
udroid remove "$ubuntu_distro" | |
dialog --msgbox "ποΈ Ubuntu distribution '$ubuntu_distro' has been removed!" 5 50 | |
} | |
# Function to reinstall Ubuntu | |
reinstall_ubuntu() { | |
# List available Ubuntu distributions | |
dialog --title "π¦ Available Ubuntu Distributions" --msgbox "$(udroid list)" 20 60 | |
# Prompt for the Ubuntu distribution name | |
ubuntu_distro=$(dialog --inputbox "π Enter the name of the Ubuntu distribution you want to reinstall (Press Enter to exit):" 8 50 3>&1 1>&2 2>&3) | |
# Check if the user pressed Enter (empty input) | |
if [ -z "$ubuntu_distro" ]; then | |
dialog --msgbox "β Reinstallation canceled." 5 30 | |
return | |
fi | |
# Execute the reinstall command | |
udroid reinstall "$ubuntu_distro" | |
dialog --msgbox "π Ubuntu distribution '$ubuntu_distro' has been reinstalled!" 5 50 | |
} | |
# Function to upgrade Ubuntu | |
upgrade_ubuntu() { | |
# List available Ubuntu distributions | |
dialog --title "π¦ Available Ubuntu Distributions" --msgbox "$(udroid list)" 20 60 | |
# Prompt for the Ubuntu distribution name | |
ubuntu_distro=$(dialog --inputbox "π Enter the name of the Ubuntu distribution you want to upgrade (Press Enter to exit):" 8 50 3>&1 1>&2 2>&3) | |
# Check if the user pressed Enter (empty input) | |
if [ -z "$ubuntu_distro" ]; then | |
dialog --msgbox "β Upgrade canceled." 5 30 | |
return | |
fi | |
# Execute the upgrade command | |
udroid upgrade "$ubuntu_distro" | |
dialog --msgbox "πΌ Ubuntu distribution '$ubuntu_distro' has been upgraded!" 5 50 | |
} | |
# Function to clear cache | |
clear_cache() { | |
dialog --msgbox "π§Ή Clearing cache..." 5 30 | |
udroid --clear-cache | |
dialog --msgbox "β Cache has been cleared!" 5 30 | |
} | |
# Main menu loop | |
while true; do | |
choice=$(dialog --title "π οΈ Ubuntu Management Menu" --menu "Choose an option:" 15 50 7 \ | |
1 "π¦ Install Ubuntu" \ | |
2 "π Login Ubuntu" \ | |
3 "ποΈ Remove Ubuntu" \ | |
4 "π Reinstall Distro" \ | |
5 "πΌ Upgrade Ubuntu" \ | |
6 "π§Ή Clear Cache" \ | |
7 "β Exit" 3>&1 1>&2 2>&3) | |
case $choice in | |
1) | |
install_ubuntu | |
;; | |
2) | |
login_ubuntu | |
;; | |
3) | |
remove_ubuntu | |
;; | |
4) | |
reinstall_ubuntu | |
;; | |
5) | |
upgrade_ubuntu | |
;; | |
6) | |
clear_cache | |
;; | |
7) | |
dialog --msgbox "β Exiting..." 5 30 | |
break | |
;; | |
*) | |
dialog --msgbox "β οΈ Invalid option. Please try again." 5 30 | |
;; | |
esac | |
done | |
# Clean up | |
clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment