-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux-phone-mod.sh
More file actions
116 lines (107 loc) · 3.66 KB
/
linux-phone-mod.sh
File metadata and controls
116 lines (107 loc) · 3.66 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
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
#!/bin/bash
# GitHub.com/PiercingXX
# Define colors for whiptail
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Function to cache sudo credentials
cache_sudo_credentials() {
echo "Caching sudo credentials for script execution..."
sudo -v
# Keep sudo credentials fresh for the duration of the script
(while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &)
}
# Checks for active network connection
if [[ -n "$(command -v nmcli)" && "$(nmcli -t -f STATE g)" != connected ]]; then
awk '{print}' <<<"Network connectivity is required to continue."
exit
fi
# Install required tools for TUI
if ! command -v whiptail &> /dev/null; then
echo -e "${YELLOW}Installing whiptail...${NC}"
sudo apt install whiptail -y
fi
username=$(id -u -n 1000)
builddir=$(pwd)
# Cache sudo credentials
cache_sudo_credentials
# Function to display a message box
function msg_box() {
whiptail --msgbox "$1" 0 0 0
}
# Function to display menu
function menu() {
whiptail --backtitle "GitHub.com/PiercingXX" --title "Main Menu" \
--menu "Run Options In Order:" 0 0 0 \
"Install" "Install PiercingXX Mod" \
"Reboot System" "Reboot the system" \
"Exit" "Exit the script" 3>&1 1>&2 2>&3
}
# Main menu loop
while true; do
clear
echo -e "${GREEN}Welcome ${username}${NC}\n"
choice=$(menu)
case $choice in
"Install")
echo -e "${YELLOW}Upgrading System...${NC}"
# Download Piercing Rice
echo -e "${YELLOW}Gitting PiercingXX Dots...${NC}"
rm -rf piercing-dots
git clone --depth 1 https://github.com/Piercingxx/piercing-dots.git
# Replace .bashrc
cp -f piercing-dots/resources/bash/.bashrc /home/"$username"/.bashrc
source ~/.bashrc
echo "Upgraded .bashrc."
# Install Gnome and Dependencies
echo -e "${YELLOW}Installing Dependencies...${NC}"
cd scripts || exit
chmod u+x step-1.sh
sudo ./step-1.sh
wait
cd "$builddir" || exit
echo -e "${GREEN}Step 1 complete!${NC}"
# Install Apps & More Dependencies
echo -e "${YELLOW}Installing Apps & More Dependencies...${NC}"
cd scripts || exit
chmod u+x apps.sh
sudo ./apps.sh
wait
cd "$builddir" || exit
# Bash Stuff
install_bashrc_support
# Install Piercing Rice
cd piercing-dots || exit
chmod u+x install.sh
./install.sh
wait
cd "$builddir" || exit
# Apply Piercing Gnome Customizations as User
cd piercing-dots/scripts || exit
./gnome-customizations.sh
wait
cd "$builddir" || exit
# Clean Up
rm -rf piercing-dots
echo -e "${GREEN}PiercingXX Gnome Customizations Applied successfully!${NC}"
msg_box "System will reboot now."
sudo reboot
;;
"Reboot System")
echo -e "${YELLOW}Rebooting system in 3 seconds...${NC}"
sleep 2
sudo reboot
;;
"Exit")
clear
echo -e "${BLUE}Thank You Handsome!${NC}"
exit 0
;;
esac
# Prompt to continue
while true; do
read -p "Press [Enter] to continue..."
break
done
done