-
Notifications
You must be signed in to change notification settings - Fork 3
/
manager
executable file
·176 lines (151 loc) · 4.61 KB
/
manager
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/usr/bin/env bash
# Define some color variables
PURPLE='\033[1m\033[35m'
PEACH='\e[1;38;2;255;204;153m'
GREEN='\033[1m\033[38;2;0;255;0m'
RED='\033[1m\033[38;5;196m'
AQUA='\e[1;38;2;0;255;255m'
NC='\033[0m' # No Color
# Define a function to exit the script
exit_script() {
clear
cd ~ # Change directory to home
# Get the name of the current shell
shell_name=$(basename "$SHELL")
# Run the exec command according to the shell
case $shell_name in
bash) exec bash ;;
zsh) exec zsh ;;
ksh) exec ksh ;;
csh) exec csh ;;
tcsh) exec tcsh ;;
fish) exec fish ;;
*) echo "Unknown shell: $shell_name" ;;
esac
}
# Set a trap to call the function when SIGTSTP(ctrl + z) & SIGINT(ctrl + c) is received
trap exit_script SIGTSTP
trap exit_script SIGINT
# Show heading in middle
clear
echo ""
COLUMNS=$(tput cols)
t1="===================="
t2="Linux Apps Manager"
printf "${PURPLE}%*s\n${NC}" $(((${#t1} + $COLUMNS) / 2)) "$t1"
printf "${PURPLE}%*s\n${NC}" $(((${#t2} + $COLUMNS) / 2)) "$t2"
printf "${PURPLE}%*s\n${NC}" $(((${#t1} + $COLUMNS) / 2)) "$t1"
echo ""
# Ask user what option they want to choose
echo -e "${PEACH}Select Your Choice:${NC}"
echo " 1. APT App Manager"
echo " 2. Pacman App Manager"
echo " 3. DNF App Manager"
echo " 4. DEB App Manager"
echo " 5. RPM App Manager"
echo " 6. Snap App Manager"
echo " 7. Flatpak App Manager"
echo " 8. Firmware Manager"
echo " 9. NVIDIA Driver Manager"
echo "10. Tuned Power Profile Manager"
echo "11. Update All Packages In Your System"
echo "12. Run Setup"
echo "13. Update Linux Apps Manager"
echo "14. Exit Program"
echo ""
read -p "Enter your choice: " choice
if [ $choice -eq 1 ]; then
chmod +x apt && ./apt
elif [ $choice -eq 2 ]; then
chmod +x pacman && ./pacman
elif [ $choice -eq 3 ]; then
chmod +x dnf && ./dnf
elif [ $choice -eq 4 ]; then
chmod +x deb && ./deb
elif [ $choice -eq 5 ]; then
chmod +x rpm && ./rpm
elif [ $choice -eq 6 ]; then
chmod +x snap && ./snap
elif [ $choice -eq 7 ]; then
chmod +x flatpak && ./flatpak
elif [ $choice -eq 8 ]; then
chmod +x firmware && ./firmware
elif [ $choice -eq 9 ]; then
chmod +x nvidia && ./nvidia
elif [ $choice -eq 10 ]; then
chmod +x tuned && ./tuned
elif [ $choice -eq 11 ]; then
echo ""
# Check if apt is available and update it
if command -v apt &>/dev/null; then
echo -e "${GREEN}apt is available, updating packages...${NC}"
sudo apt update && sudo apt upgrade -y
echo ""
else
echo -e "${RED}apt is not available, skipping...${NC}"
echo ""
fi
# Check if pacman is available and update it
if command -v pacman &>/dev/null; then
echo -e "${GREEN}pacman is available, updating packages...${NC}"
sudo pacman -Syu --noconfirm
echo ""
else
echo -e "${RED}pacman is not available, skipping...${NC}"
echo ""
fi
# Check if dnf is available and update it
if command -v dnf &>/dev/null; then
echo -e "${GREEN}dnf is available, updating packages...${NC}"
sudo dnf upgrade --refresh
echo ""
else
echo -e "${RED}dnf is not available, skipping...${NC}"
echo ""
fi
# Check if snap is installed and update it
if command -v snap &>/dev/null; then
echo -e "${GREEN}snap is installed, updating packages...${NC}"
sudo snap refresh
echo ""
else
echo -e "${RED}snap is not installed, skipping...${NC}"
echo ""
fi
# Check if flatpak is installed and update it
if command -v flatpak &>/dev/null; then
echo -e "${GREEN}flatpak is installed, updating packages...${NC}"
flatpak update -y
echo ""
else
echo -e "${RED}flatpak is not installed, skipping...${NC}"
echo ""
fi
echo -e "${AQUA}All done!${NC}"
read -rp "Press Enter to continue..."
chmod +x manager && ./manager
elif [ $choice -eq 12 ]; then
chmod +x setup && ./setup
elif [ $choice -eq 13 ]; then
echo ""
echo -e "${GREEN}Downloading updates if available...${NC}"
sleep 1
echo ""
git pull
if [ $? -ne 0 ]; then
echo ""
echo -e "${RED}Checking for update failed! Possible reasons are:${NC}"
echo "• You have made some changes with LAM."
echo "• You do not have an internet connection."
echo "• The remote GitHub repository is not accessible."
fi
read -rp "Press Enter to continue..."
chmod +x manager && ./manager
elif [ $choice -eq 14 ]; then
exit_script
else
echo ""
echo -e "${RED}Invalid choice. Please try again.${NC}"
sleep 3
chmod +x manager && ./manager
fi