-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01a_install_config.sh
executable file
·77 lines (66 loc) · 2.1 KB
/
01a_install_config.sh
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
#!/bin/bash
section_header () {
echo ""
echo "---------------"
echo ""
echo $1
}
section_header_with_output () {
section_header "$1"
echo "---"
}
#// Non-root check
if [[ $EUID == 0 ]]; then
echo "This script must be run as a normal user, not root."
echo "You will be prompted for sudo password during script execution for 'yay'."
exit 1
fi
#// git check
which git &> /dev/null
if [ $? != 0 ]; then
echo "You need to install 'git' first: sudo pacman -S git"
exit 2
fi
#// Parallel pacman downloads notice
grep "#ParallelDownloads" /etc/pacman.conf &> /dev/null
if [ $? == 1 ]; then
echo "Before continuing, you may want to enable parallel downloads in pacman for a faster install experience."
echo "With root privileges, uncomment 'ParallelDownloads' in '/etc/pacman.conf' and increase the value if desired."
echo "This script is paused to give you a chance to do that if you wish."
read -p "Press ENTER to proceed "
fi
#// Get path to user's home directory
USER_HOME=$HOME
#// Make home directories
section_header "Making home directories..."
mkdir -p "$USER_HOME/Downloads"
mkdir -p "$USER_HOME/Games"
mkdir -p "$USER_HOME/Pictures"
mkdir -p "$USER_HOME/Scratch"
mkdir -p "$USER_HOME/Scripts"
mkdir -p "$USER_HOME/Shortcuts"
mkdir -p "$USER_HOME/Software"
#// Install yay, an AUR helper, if not installed.
#// Operate from inside '~/Scratch' from here on
section_header "Installing yay..."
pushd "$USER_HOME/Scratch"
git clone https://aur.archlinux.org/yay-bin.git
chmod a+w yay-bin
pushd yay-bin
makepkg -si --noconfirm
popd
rm -rf "$USER_HOME/Scratch/yay-bin"
popd
#// Install packages from the generic config package list
section_header_with_output "Installing packages..."
#// Install everything else
yay -S --noconfirm --sudoloop --needed - < config_package_list_generic.txt
#// Copy over user config/dot files
section_header_with_output "Copying over config/dot files..."
rsync -av ./files/generic/home/ $USER_HOME/
#// Output at the end
echo ""
echo "---------------"
echo "+ Complete +"
echo "---------------"
echo "Run '01b_install_config_sudo.sh' as root to continue."