-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSetup-Slackware-Current.sh
313 lines (268 loc) · 8.4 KB
/
Setup-Slackware-Current.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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#!/bin/bash
# Check if script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run the script using sudo."
exit
fi
# Check if the script is run from the root account
if [ "$SUDO_USER" = "" ]; then
echo "Please do not run this script from the root account. Use sudo instead."
exit
fi
# Get the current username
username=$SUDO_USER
# Review Hostname
nano /etc/HOSTNAME
nano /etc/hosts
# Install sbopkg (for sbotools)
wget https://github.com/sbopkg/sbopkg/releases/download/0.38.2/sbopkg-0.38.2-noarch-1_wsr.tgz
installpkg sbopkg-0.38.2-noarch-1_wsr.tgz
rm sbopkg-0.38.2-noarch-1_wsr.tgz
# Point sbopkg to current repo & sync
sed -i "s/REPO_BRANCH=\${REPO_BRANCH:-15.0}/REPO_BRANCH=\${REPO_BRANCH:-current}/g" /etc/sbopkg/sbopkg.conf
sed -i "s/REPO_NAME=\${REPO_NAME:-SBo}/REPO_NAME=\${REPO_NAME:-SBo-git}/g" /etc/sbopkg/sbopkg.conf
# Sync repo
sbopkg -r
# Install sbotools (for slpkg)
sbopkg -i sbotools
sboconfig -r https://github.com/Ponce/slackbuilds.git
# Sync repo
sbosnap fetch
# Update MAKEFLAGS in /etc/sbotools/sbotools.conf to match CPU cores
sboconfig -j $(nproc)
# Replace blacklist and slackpkgplus.conf for csb and gfs
# Define the URL and local path pairs in an associative array
declare -A files=(
["https://raw.githubusercontent.com/SpreadiesInSpace/cinnamon-dotfiles/main/etc/slackpkg/blacklist"]="/etc/slackpkg/blacklist"
)
for url in "${!files[@]}"; do
local_path="${files[$url]}"
# Backup the existing local file
cp "$local_path" "${local_path}.old"
# Download the new file
curl -o "$local_path" "$url"
# Verify the download was successful
if [ $? -eq 0 ]; then
echo "File $local_path updated successfully."
else
echo "Failed to update the file $local_path."
mv "${local_path}.old" "$local_path"
fi
done
<<neovim
# Install Neovim AppImage
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage --appimage-extract
./squashfs-root/AppRun --version
mv squashfs-root /
ln -s /squashfs-root/AppRun /usr/bin/nvim
rm nvim.appimage
neovim
# Install rmlint
# git clone https://github.com/sahib/rmlint.git
# cd rmlint/
# scons --prefix=/usr install
# cd ..
# rm -rf rmlint/
# For pcsc-lite dependency that gets called in
groupadd -g 257 pcscd
useradd -u 257 -g pcscd -d /var/run/pcscd -s /bin/false pcscd
# For Virt-Manager & accessing samba shares
# slackpkg install dnsmasq samba
cp /etc/samba/smb.conf-sample /etc/samba/smb.conf
sh /etc/rc.d/rc.samba start
# Install slpkg & replace configs
sboinstall slpkg
# Define the URL and local path pairs in an associative array
declare -A files=(
["https://raw.githubusercontent.com/SpreadiesInSpace/cinnamon-dotfiles/main/etc/slpkg/repositories.toml"]="/etc/slpkg/repositories.toml"
["https://raw.githubusercontent.com/SpreadiesInSpace/cinnamon-dotfiles/main/etc/slpkg/slpkg.toml"]="/etc/slpkg/slpkg.toml"
["https://raw.githubusercontent.com/SpreadiesInSpace/cinnamon-dotfiles/main/etc/slpkg/blacklist.toml"]="/etc/slpkg/blacklist.toml"
)
for url in "${!files[@]}"; do
local_path="${files[$url]}"
# Backup the existing local file
cp "$local_path" "${local_path}.old"
# Download the new file
curl -o "$local_path" "$url"
# Verify the download was successful
if [ $? -eq 0 ]; then
echo "File $local_path updated successfully."
else
echo "Failed to update the file $local_path."
mv "${local_path}.old" "$local_path"
fi
done
# Update MAKEFLAGS in /etc/slpkg/slpkg.toml to match CPU cores
cores=$(nproc)
# Backup the current slpkg.toml file
cp /etc/slpkg/slpkg.toml /etc/slpkg/slpkg.toml.bak
# Edit slpkg.toml to set MAKEFLAGS
sed -i "s/^MAKEFLAGS = \"-j[0-9]*\"/MAKEFLAGS = \"-j$cores\"/" /etc/slpkg/slpkg.toml
echo "Updated MAKEFLAGS in /etc/slpkg/slpkg.toml to -j$cores based on the number of CPU cores."
# Sync slpkg
slpkg -uy
# Update Slackware Packages
touch /var/log/slpkg/deps.log
slpkg -Uy -o "slack"
slpkg -Uy -o "slack_extra"
# Update Grub
grub-mkconfig -o /boot/grub/grub.cfg
# Blacklist alien & conraid packages
if ! grep -q "^\[0-9\]+alien$" /etc/slackpkg/blacklist; then
echo '[0-9]+alien' | tee -a /etc/slackpkg/blacklist
fi
if ! grep -q "^\[0-9\]+cf$" /etc/slackpkg/blacklist; then
echo '[0-9]+cf' | tee -a /etc/slackpkg/blacklist
fi
# Install Bash Completion for csb
slpkg install -y bash-completion -o "slack_extra"
# Alien packages
alien_packages=(
"libreoffice"
"qbittorrent"
"flatpak"
)
# Install packages from Alien over SBo to reduce compile times
slpkg install -y "${alien_packages[@]}" --repository=alien
# All packages
packages=(
# System utilities
#"gparted"
#"neofetch"
#"unzip"
#"xkill"
#"xrandr"
# Network utilities
"filezilla"
#"gvfs"
#"kdeconnect"
#"samba"
# Desktop environment and related packages
#"cinnamon"
"qt5ct"
# Applications
"bleachbit"
#"noto-fonts"
#"rmlint" # compiling via SBo fails on Slackware Current
"ufw"
"xclip"
# For NvChad
#"gcc"
#"make"
"neovim"
# Virtualization tools
"libslirp"
"libcacard"
"spice"
"usbredir"
"virglrenderer"
"libnfs"
"snappy"
"device-tree-compiler"
"vde2"
"qemu" # TARGETS=x86_64-softmmu
"spice-gtk"
"gtk-vnc"
"libosinfo"
"edk2-ovmf-bin"
#"dnsmasq"
#"bridge-utils"
#"iptables"
#"dmidecode"
"spice-vdagent"
"libvirt"
"libvirt-glib"
"libvirt-python"
"virt-manager"
)
# Install packages from Conraid over SBo to reduce compile times
slpkg install -y "${packages[@]}" --repository=conraid
# GFS packages
gnome_packages=(
"font-noto-emoji"
"gpaste"
"rhythmbox"
)
# Install packages from GFS over SBo to reduce compile times
slpkg install -y "${gnome_packages[@]}" --repository=gnome
# SBo packages
sbo_packages=(
"file-roller"
"ncdu"
"timeshift"
"libgedit-amtk" # for gedit
"libgedit-gtksourceview" # for gedit
"libpeas" # for gedit
"tepl" # for gedit
"gnome-calculator"
"gnome-screenshot"
"gnome-system-monitor"
"kvantum-qt5"
"haruna"
"qt6ct"
# "ufw"
"libuchardet" # for rhythmbox
"totem-pl-parser" # for rhythmbox
"libpeas" # for rhythmbox
"bottom"
"brave-browser"
"ripgrep"
"libiscsi"
# "spice-vdagent"
"glusterfs"
# "libvirt"
# "libvirt-glib"
# "libvirt-python"
# "virt-manager"
)
# Update system and install packages
slpkg install -y "${sbo_packages[@]}"
# Install Noto Fonts
# sudo rm -rf /usr/share/fonts/noto/
# sudo git clone --depth=1 https://github.com/SpreadiesInSpace/noto /usr/share/fonts/noto
# sudo rm -rf /usr/share/fonts/noto/.git
# Install Additional gnome packages
slpkg install -y eog evince gedit -o gnome
slpkg install -y gnome-terminal -o gnome -O
slpkg install -y gedit-plugins
# Install Cinnamon
slpkg install -y "*" --repository=csb
xwmconfig
# Enable Flathub
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Start spice-vdagent service (it already autostarts by default)
/etc/rc.d/rc.spice-vdagent start
# Check if the block for libvirt already exists
if ! grep -q '# Start libvirt' /etc/rc.d/rc.local; then
# Add libvirt startup to rc.local if not already present
echo '' >> /etc/rc.d/rc.local
echo '# Start libvirt' >> /etc/rc.d/rc.local
echo 'if [ -x /etc/rc.d/rc.libvirt ]; then' >> /etc/rc.d/rc.local
echo ' /etc/rc.d/rc.libvirt start' >> /etc/rc.d/rc.local
echo 'fi' >> /etc/rc.d/rc.local
fi
# Make sure rc.libvirt is executable
chmod +x /etc/rc.d/rc.libvirt
# Start libvirtd service
/etc/rc.d/rc.libvirt start
# Start and autostart the default network
virsh net-start default
virsh net-autostart default
# Add the current user to the necessary groups
groups=(libvirt libvirt-qemu kvm input disk video audio users)
for group in "${groups[@]}"; do
usermod -aG "$group" "$username"
done
# Enable Autologin
# sed -i "/\[Autologin\]/,/User=/ s/User=.*/User=$username/" /etc/sddm.conf
# sed -i "/\[Autologin\]/,/Session=/ s/Session=.*/Session=cinnamon/" /etc/sddm.conf
# echo "xrandr --output Virtual-1 --mode 1920x1080 --rate 60" >> /usr/share/sddm/scripts/Xsetup
# Run the setup script
# cd home/
# chmod +x Setup-Slackware-Current-Theme.sh
# ./Setup-Slackware-Current-Theme.sh
# cd ..
# Reboot for the changes to take effect
echo "Installation complete! Please reboot for the changes to take effect. Then run Setup-Slackware-Current-Theme.sh in cinnamon/home for theming."