-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·189 lines (160 loc) · 4.4 KB
/
setup.sh
File metadata and controls
executable file
·189 lines (160 loc) · 4.4 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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
# Ensure the script runs as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Get the username and password
echo "Input the main user's data"
read -p "Username: " USER_NAME
while true; do
read -sp "Password: " USER_PASS
echo ""
read -sp "Confirm password: " USER_PASS_CONFIRM
echo ""
if [[ "$USER_PASS" == "$USER_PASS_CONFIRM" ]]; then
break
else
echo "Passwords do not match. Please try again."
fi
done
# Create new user
echo "Creating new user..."
useradd -m -s /bin/bash "$USER_NAME"
echo "$USER_NAME:$USER_PASS" | chpasswd
usermod -aG wheel "$USER_NAME"
echo "User $USER_NAME has been created and added to the wheel group."
# Allow users in wheel to have sudo
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# Temporarily allow new user to execute yay without password
SUDOERS_FILE="/etc/sudoers.d/99-yay-tmp"
echo "$USER_NAME ALL=(ALL) NOPASSWD: /usr/bin/yay" | sudo tee "$SUDOERS_FILE" > /dev/null
chmod 0440 "$SUDOERS_FILE"
# Get the fastest package mirrors
echo "Getting package mirrors..."
pacman -S --needed --noconfirm reflector
reflector --latest 10 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
# Update system
echo "Updating system..."
pacman -Syu --noconfirm
# Install base tools
echo "Installing base tools..."
pacman -S --needed --noconfirm base-devel git nvim networkmanager iwd
# Setup NetworkManager with iwd backend
echo "Configuring NetworkManager..."
mkdir -p /etc/NetworkManager/conf.d/
echo -e "[device]\nwifi.backend=iwd" > /etc/NetworkManager/conf.d/wifi_backend.conf
systemctl enable --now NetworkManager
systemctl enable --now iwd
# Setup audio
echo "Configuring audio..."
pacman -S --needed --noconfirm pipewire pipewire-pulse pipewire-alsa pipewire-jack wireplumber pavucontrol pamixer
systemctl --user enable --now pipewire
systemctl --user enable --now pipewire-pulse
systemctl --user enable --now wireplumber
# Setup yay
echo "Installing yay..."
sudo -u "$USER_NAME" bash <<EOF
git clone https://aur.archlinux.org/yay.git /tmp/yay
cd /tmp/yay
makepkg -si --noconfirm
cd ~
rm -rf /tmp/yay
EOF
# Install yay packages
echo "Installing yay packages..."
YAY_APPS=(
visual-studio-code-bin
cava
wlogout
hyprmon-bin
rose-pine-cursor
xwaylandvideobridge
)
sudo -u "$USER_NAME" yay -S --needed --noconfirm "${YAY_APPS[@]}"
# Install additional packages
echo "Installing additional packages..."
APPS=(
stow
firefox
fastfetch
htop
network-manager-applet
git
discord
telegram-desktop
swaync
matugen
swww
rofi
kitty
nwg-look
papirus-icon-theme
brightnessctl
yazi
zathura
zathura-pdf-poppler
tlp
blueman
imagemagick
7zip
jq
grim
slurp
wl-clipboard
xdg-desktop-portal-hyprland
adw-gtk-theme
man
pcmanfm
)
pacman -S --needed --noconfirm "${APPS[@]}"
systemctl enable --now tlp
systemctl enable --now bluetooth
# Prevent bluetooth from autoenabling on bootup
BT_CONFIG="/etc/bluetooth/main.conf"
if [ -f "$BT_CONFIG" ]; then
echo "Setting AutoEnable=false in $BT_CONFIG..."
sed -i 's/^#AutoEnable=true/AutoEnable=false/' $BT_CONFIG
sed -i 's/^AutoEnable=true/AutoEnable=false/' $BT_CONFIG
fi
# Install fonts
echo "Installing fonts..."
FONTS=(
ttf-jetbrains-mono-nerd
noto-fonts-cjk
ttf-dejavu
otf-font-awesome
noto-fonts-emoji
)
pacman -S --needed --noconfirm "${FONTS[@]}"
# Install wayland & hyprland
echo "Installing wayland & hyprland..."
pacman -S --needed --noconfirm hyprland xorg-xwayland waybar hyprlock hypridle hyprsunset
# Setup display manager
echo "Installing and configuring ly..."
pacman -S --needed --noconfirm ly
systemctl enable [email protected]
systemctl disable [email protected]
# Get dotfiles
echo "Copying dotfiles..."
DOTFILES_DIR="/home/$USER_NAME/Dotfiles"
mkdir -p "$DOTFILES_DIR"
cp -r . "$DOTFILES_DIR/"
chown -R "$USER_NAME:$USER_NAME" "$DOTFILES_DIR"
sudo -u "$USER_NAME" mkdir -p "/home/$USER_NAME/Pictures"
sudo -u "$USER_NAME" ln -s "$DOTFILES_DIR/wallpapers" "/home/$USER_NAME/Pictures/wallpapers"
# Symlink dotfiles with stow
echo "Symlinking dotfiles with stow..."
sudo -u "$USER_NAME" bash <<EOF
cd "$DOTFILES_DIR"
rm -f ~/.bashrc
stow -vt ~ .
EOF
# Add execute permission to scripts
echo "Adding execute permissions to scripts..."
find "$DOTFILES_DIR" -name "*.sh" -exec chmod +x {} \;
# Cleanup
echo "Cleaning up..."
rm "$SUDOERS_FILE"
echo "Setup complete! OwO"
echo "Please reboot uwu"