Skip to content

Instantly share code, notes, and snippets.

@Mintedshrimp
Last active August 21, 2024 09:23
Show Gist options
  • Save Mintedshrimp/ab8682d460d4e3d1fd6993757f3b3df4 to your computer and use it in GitHub Desktop.
Save Mintedshrimp/ab8682d460d4e3d1fd6993757f3b3df4 to your computer and use it in GitHub Desktop.
Udroid Menu for ease of use (Updated UI)
#!/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