-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
60 lines (51 loc) · 1.83 KB
/
install.sh
File metadata and controls
60 lines (51 loc) · 1.83 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
#!/bin/bash
# Prevent system from sleeping or locking during installation
gsettings set org.gnome.desktop.screensaver lock-enabled false
gsettings set org.gnome.desktop.session idle-delay 0
# Prompt for sudo password and validate
while true; do
PASSWD=$(zenity --password --title="Password Required" --text="Enter your password to continue.")
echo "$PASSWD" | sudo -v -S 2>/dev/null
if [ $? -eq 0 ]; then
break
else
zenity --error --title="Invalid Password" --text="The password you entered is incorrect. Please try again."
fi
done
# Update system and install Git
echo "Updating system and installing Git..."
sudo apt update && sudo apt install -y git
# Clone or update the repository
REPO_DIR="$HOME/.local/share/dev-setup"
if [ ! -d "$REPO_DIR" ]; then
echo "Cloning dev-setup repository..."
git clone https://github.com/dsakuma/dev-setup.git "$REPO_DIR"
git -C "$REPO_DIR" remote set-url origin "git@github.com:dsakuma/dev-setup.git"
else
echo "Repository already exists. Pulling latest changes..."
git -C "$REPO_DIR" pull
fi
# Directories containing scripts to run
directories=(
"01-pre-install"
"02-install-cli-apps"
"03-install-gui-apps"
"04-config"
"05-post-install"
)
# Run all scripts in each directory
for directory in "${directories[@]}"; do
echo "Running scripts in $directory..."
for script in "$REPO_DIR/$directory"/*.sh; do
echo Running "$script"...
echo "$PASSWD" | sudo -v -S 2> /dev/null
if ! source "$script"; then
echo "Error: $script failed to execute."
return 1
fi
done
done
# Restore system idle and lock settings
gsettings reset org.gnome.desktop.screensaver lock-enabled
gsettings reset org.gnome.desktop.session idle-delay
echo "Finished! You may need to restart your computer for changes to take effect."