-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevkit.sh
More file actions
86 lines (78 loc) · 2.04 KB
/
devkit.sh
File metadata and controls
86 lines (78 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Check if dialog is installed, and install if necessary
if ! command -v dialog &> /dev/null
then
echo "dialog is not installed. Installing dialog..."
sudo apt update
sudo apt install -y dialog
fi
# List of essential packages
net_tools="net-tools wireless-tools"
developer_essentials="python3 nodejs build-essential g++"
development_kit="apache2 libapache2-mod-php php php-cli"
all_essentials="$net_tools $developer_essentials $development_kit"
# Function to prompt the user for confirmation
confirm_install() {
while true; do
read -p "$1 [y/n]: " choice
case "$choice" in
y|Y ) return 0 ;;
n|N ) return 1 ;;
* ) echo "Please enter y or n." ;;
esac
done
}
# Function to install packages
install_package() {
local package_name=$1
sudo apt update
sudo apt install -y $package_name
echo "$package_name installed."
}
# Create a dialog menu
dialog_menu() {
exec 3>&1
option=$(dialog --clear --title "Ubuntu Performance Setup Menu" \
--menu "Select an option" 15 50 4 \
1 "Install Net Tools" \
2 "Install Developer Essentials" \
3 "Install Development Kit" \
4 "Install All" \
2>&1 1>&3)
exitcode=$?
exec 3>&-
# Handle dialog cancel or exit (exitcode = 1 or 255 means user canceled)
if [ $exitcode -eq 1 ] || [ $exitcode -eq 255 ]; then
echo "Exiting the script."
exit
fi
case $option in
1)
if confirm_install "Do you want to install Net Tools?"; then
install_package "$net_tools"
fi
;;
2)
if confirm_install "Do you want to install Developer Essentials?"; then
install_package "$developer_essentials"
fi
;;
3)
if confirm_install "Do you want to install the Development Kit?"; then
install_package "$development_kit"
fi
;;
4)
if confirm_install "Do you want to install all packages?"; then
install_package "$all_essentials"
fi
;;
*)
echo "Invalid option."
;;
esac
}
# Main loop to keep the menu showing
while true; do
dialog_menu
done