-
Notifications
You must be signed in to change notification settings - Fork 0
/
rice.sh
executable file
·115 lines (96 loc) · 3.05 KB
/
rice.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
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
#!/bin/bash
#
# NOTE: This script hasn't been tested
# TODO: Test this script
#
#Color definitions
green=$'\e[0;92m'
red=$'\e[0;91m'
blue=$'\e[1;34m'
reset=$'\e[0m'
# All pacman packages to install
packages_pacman=(neofetch htop flameshot mpd rofi ranger wget curl redshift\
base-devel go synaptics pulseaudio pavucontrol lazygit\
ttf-joypixels ttf-iosevka-nerd ttf-jetbrains-mono libnotify\
socat openvpn dunst libcanberra bluez bluez-utils lm_sensors\
meson ninja brightnessctl cmake kitty\
)
# All yay packages to install
packages_yay=(nerd-fonts-complete ttf-iosevka)
# Directory containing all source files
base_dir=$(realpath $(dirname "$0"))
src_dir="$base_dir/src"
dest_dir="/usr/local/bin"
configureConservationMode(){
# Conservation mode toggler------------------------------------------------------------
echo "${blue}Configuring Conservation Mode${reset}"
sudo g++ $src_dir/toggleConservation.cpp -o $dest_dir/toggleConservationMode
sudo chown root $dest_dir/toggleConservationMode
sudo chmod u+s $dest_dir/toggleConservationMode
# Initiate conservation mode
toggleConservationMode
}
configureDotfiles(){
echo "${blue}[+] Configuring dotfiles${reset}"
sudo mkdir /home/$SUDO_USER/.config
cp -r .config/* /home/$SUDO_USER/.config/
chown -R $SUDO_USER:$SUDO_USER .config/
echo "${blue}Placing Files${reset}"
dotfiles=( .bash_profile .vimrc )
for i in ${dotfiles[@]};do
sudo ln -sf $base_dir/$i /home/$SUDO_USER
done
sudo cp .bashrc /root/
}
configureAurHelper(){
echo "${blue}[+] Configuring YAY(Aur Helper)${reset}"
git clone https://aur.archlinux.org/yay-git.git
cd yay-git
sudo makepkg -si
cd ../
rm -rf yay-git/
}
configureSystemdUnits(){
services=(iwd dhcpcd bluetooth)
# Enable all services
systemctl enable ${services[@]}
}
configureHyprlock(){
git clone https://github.com/hyprwm/hyprlock/
cd hyprlock
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
cmake --build ./build --config Release --target hyprlock -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
sudo cmake --install build
cd ..
rm -rf hyprlock
}
# Program Entry
#Check for root user
if [ $UID != 0 ];then
echo "${red}Run it as root${reset}"
exit 1
fi
# Install all dependencies
pacman -Syyu ${packages_pacman[@]} --noconfirm
configureAurHelper
echo "${packages_yay[@]}"
read -p "${green}Do you want to install above packages from AUR?${reset}" ch
if [[ $ch == "y" || $ch == "Y" ]];then
echo "${blue}[+] Installing aur packages${reset}"
sudo -u $SUDO_USER yay -S ${packages_yay[@]} --cleanafter --removemake --noredownload
else
echo "${red}[-] Skipping AUR packages${red}"
fi
#######################
# Running Functions #
#######################
configureConservationMode
installSt
configureDotfiles
configureSystemdUnits
configureHyprlock
# Reboot for changes to properly take effect
read -p "${green}Reboot machine to render proper changes. Reboot Now? (Y/N): ${reset}" reb
if [[ $reb == "y" || $reb == "Y" ]];then
reboot
fi