最后活跃于 1736948811

installation.sh 原始文件
1#!/bin/bash
2
3# VARIABLES
4dir_home='/home/{username}'
5dir_backup='/to/dir'
6GREEN='\033[0;32m'
7YELLOW='\033[1;33m'
8BLUE='\033[0;34m'
9NC='\033[0m'
10SLEEP='.5'
11
12# RESTORE FILES
13echo && printf "${YELLOW}Restoring bash files" && printf "${NC}" && echo && echo && sleep .5
14sudo rsync -aP "${dir_backup}"/"${dir_home}"/.bashrc "${dir_home}"/
15sudo rsync -aP "${dir_backup}"/"${dir_home}"/.bash_aliases "${dir_home}"/
16sudo rsync -aP "${dir_backup}"/"${dir_home}"/systembackup.sh "$dir_home"/
17sudo rsync -aP "${dir_backup}"/"${dir_home}"/transferphotos-card.sh "${dir_home}"/
18echo && printf "${GREEN}Done restoring the bash files" && printf "${NC}" && echo && echo && sleep .5
19
20
21
22echo && printf "${YELLOW}Restoring the fstab file" && printf "${NC}" && echo && echo && sleep .5
23if [ ! -f /etc/fstab.bak ]; then
24 echo && printf "${YELLOW}Backing up the file" && printf "${NC}" && echo && echo && sleep .5
25 sudo cp /etc/fstab /etc/fstab.bak
26fi
27
28sudo rsync -aP "${dir_backup}"/etc/fstab /etc/
29echo && printf "${GREEN}Done restoring the fstab file" && printf "${NC}" && echo && echo && sleep .5
30
31
32
33echo && printf "${YELLOW}Sourcing the bash_aliases file" && printf "${NC}" && echo && echo && sleep ${SLEEP}
34source "${dir_home}"/.bash_aliases
35echo && printf "${GREEN}Done" && printf "${NC}" && echo && echo && sleep .5
36
37
38
39# UNINSTALL
40echo && printf "${YELLOW}Uninstalling bloatware" && printf "${NC}" && echo && echo && sleep .5
41which parole | grep -o parole > /dev/null && sudo pacman -Rcns parole || echo '${BLUE}parole is not installed${NC}'
42which firewalld | grep -o firewalld > /dev/null && sudo pacman -Rcns firewalld || echo '${BLUE}firewalld is not installed${NC}'
43which galculator | grep -o galculator > /dev/null && sudo pacman -Rcns galculator || echo '${BLUE}galculator is not installed${NC}'
44which ristretto | grep -o ristretto > /dev/null && sudo pacman -Rcns ristretto || echo '${BLUE}ristretto is not installed${NC}'
45which cmake | grep -o cmake > /dev/null && sudo pacman -Rcns cmake || echo '${BLUE}cmake is not installed${NC}'
46which eos-quickstart | grep -o eos-quickstart > /dev/null && sudo pacman -Rcns eos-quickstart || echo '${BLUE}eos-quickstart is not installed${NC}'
47which eos-apps-info | grep -o eos-apps-info > /dev/null && sudo pacman -Rcns eos-apps-info || echo '${BLUE}eos-apps-info is not installed${NC}'
48which eos-welcome | grep -o eos-welcome > /dev/null && sudo pacman -Rcns eos-welcome || echo '${BLUE}eos-welcome is not installed${NC}'
49which file-roller | grep -o file-roller > /dev/null && sudo pacman -Rcns file-roller || echo '${BLUE}file-roller is not installed${NC}'
50echo && printf "${GREEN}Bloatware uninstalled" && printf "${NC}" && echo && echo && sleep .5
51
52
53
54# UPDATE
55echo && printf "${YELLOW}Updating" && printf "${NC}" && echo && echo && sleep ${SLEEP}
56yay -Syu --noconfirm
57echo && printf "${GREEN}System is now up-to-date" && printf "${NC}" && echo && echo && sleep .5
58
59
60
61# INSTALL
62echo && printf "${YELLOW}Installing softwares" && printf "${NC}" && echo && echo && sleep ${SLEEP}
63echo && printf "${YELLOW}Starting with installing softwares with yay" && printf "${NC}" && echo && echo && sleep .5
64yay -S --noconfirm mullvad-vpn-bin \
65vscodium-bin \
66qimgv-git \
67ttf-victor-mono \
68smartgit \
69blue-recorder-git \
70xfce4-panel-profiles \
71hoptodesk \
72jotta-cli
73
74echo && printf "${YELLOW}And now installing softwares with pacman" && printf "${NC}" && echo && echo && sleep .5
75sudo pacman -S thunderbird \
76darktable \
77gramps \
78steam \
79inter-font \
80mpv \
81obs-studio \
82filezilla \
83mumble \
84speedcrunch \
85virtualbox \
86ufw \
87sshfs \
88python-pip \
89gtk2 \
90ttc-iosevka \
91kcolorchooser \
92skanlite \
93yt-dlp \
94papirus-icon-theme \
95openssh \
96wine \
97qmmp \
98gimp \
99shotcut \
100qbittorrent \
101inkscape \
102lutris \
103krita \
104cifs-utils \
105gajim \
106jellyfin-server \
107jellyfin-web \
108vivaldi \
109syncthing \
110telegram-desktop \
111gparted \
112perl-image-exiftool \
113npm \
114lite-xl \
115archlinux-keyring \
116xarchiver
117
118echo && printf "${GREEN}Softwares installed" && printf "${NC}" && echo && echo && sleep .5
119
120echo && printf "${YELLOW}Installing Joplin" && printf "${NC}" && echo && echo && sleep .5
121wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash
122echo && printf "${GREEN}Joplin installed" && printf "${NC}" && echo && echo && sleep .5
123
124
125
126# CREATE FOLDER
127echo && printf "${YELLOW}Creating missing folders" && printf "${NC}" && sleep ${SLEEP}
128
129if [ ! -d "/mnt/Backup" ]; then
130 echo && printf "${GREEN}Created /mnt/Backup" && printf "${NC}" && sleep .5
131 sudo mkdir /mnt/Backup
132else
133 echo && printf "${BLUE}/mnt/Backup already exists" && printf "${NC}" && sleep .5
134fi
135
136if [ ! -d "/mnt/NAS" ]; then
137 echo && printf "${GREEN}Created /mnt/NAS" && printf "${NC}" && sleep .5
138 sudo mkdir /mnt/NAS
139else
140 echo && printf "${BLUE}/mnt/NAS already exists" && printf "${NC}" && sleep .5
141fi
142
143if [ ! -d "/mnt/Synology" ]; then
144 echo && printf "${GREEN}Created /mnt/Synology" && printf "${NC}" && sleep .5
145 sudo mkdir /mnt/Synology
146else
147 echo && printf "${BLUE}/mnt/Synology already exists" && printf "${NC}" && sleep .5
148fi
149
150echo && printf "${GREEN}Done" && printf "${NC}" && echo && echo && sleep .5
151
152
153
154# INSTALL GRAPHIC DRIVERS
155echo && printf "${YELLOW}Installing graphic card stuff" && printf "${NC}" && echo && echo && sleep ${SLEEP}
156install_no nvidia nvidia-settings nvidia-utils lib32-nvidia-utils lib32-opencl-nvidia opencl-nvidia libvdpau libxnvctrl vulkan-icd-loader lib32-vulkan-icd-loader
157echo && printf "${GREEN}Done installing graphic card stuff" && printf "${NC}" && echo && echo && sleep .5
158
159
160
161# CONFIG
162echo && printf "${YELLOW}Configuring the graphic card" && printf "${NC}" && echo && echo && sleep ${SLEEP}
163sudo nvidia-xconfig
164sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.d/20-nvidia.conf
165echo && printf "${GREEN}Done configurating the graphic card" && printf "${NC}" && echo && echo && sleep .5
166
167
168
169# STORE DATA
170echo && printf "${YELLOW}Restoring backed up files" && printf "${NC}" && echo && echo && sleep ${SLEEP}
171sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/darktable/ "${dir_home}"/.config/darktable/
172sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/mpv/ "${dir_home}"/.config/mpv/
173sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/'Mullvad VPN'/ "${dir_home}"/.config/'Mullvad VPN'/
174sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/qimgv/ "${dir_home}"/.config/qimgv/
175sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/obs-studio/ "${dir_home}"/.config/obs-studio/
176sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/smartgit/ "${dir_home}"/.config/smartgit/
177sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/filezilla/ "${dir_home}"/.config/filezilla/
178sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/GIMP/ "${dir_home}"/.config/GIMP/
179sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/FreeFileSync/ "${dir_home}"/.config/FreeFileSync/
180sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/JOSM/ "${dir_home}"/.config/JOSM/
181sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/Joplin/ "${dir_home}"/.config/Joplin/
182sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/joplin-desktop/ "${dir_home}"/.config/joplin-desktop/
183sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/SpeedCrunch/ "${dir_home}"/.config/SpeedCrunch/
184sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/VSCodium/ "${dir_home}"/.config/VSCodium/
185sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/VirtualBox/ "${dir_home}"/.config/VirtualBox/
186sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/qBittorrent/ "${dir_home}"/.config/qBittorrent/
187sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/lite-xl/ "${dir_home}"/.config/lite-xl/
188sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/qmmp/ "${dir_home}"/.config/qmmp/
189sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/Mumble/ "${dir_home}"/.config/Mumble/
190sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/vivaldi/ "${dir_home}"/.config/vivaldi/
191sudo rsync -aP "${dir_backup}"/"${dir_home}"/.config/hoptodesk/ "${dir_home}"/.config/hoptodesk/
192
193sudo rsync -aP "${dir_backup}"/"${dir_home}"/.local/share/gramps/ "${dir_home}"/.local/share/gramps/
194sudo rsync -aP "${dir_backup}"/"${dir_home}"/.local/share/TelegramDesktop/ "${dir_home}"/.local/share/TelegramDesktop/
195sudo rsync -aP "${dir_backup}"/"${dir_home}"/.local/share/Steam/ "${dir_home}"/.local/share/Steam/
196sudo rsync -aP "${dir_backup}"/"${dir_home}"/.local/share/lutris/ "${dir_home}"/.local/share/lutris/
197sudo rsync -aP "${dir_backup}"/"${dir_home}"/.local/state/syncthing/ "${dir_home}"/.local/state/syncthing/
198
199sudo rsync -aP --delete "${dir_backup}"/"${dir_home}"/.mozilla/firefox/ "${dir_home}"/.mozilla/firefox/
200sudo rsync -aP --delete "${dir_backup}"/"${dir_home}"/.thunderbird/ "${dir_home}"/.thunderbird/
201sudo rsync -aP "${dir_backup}"/"${dir_home}"/.joplin/ "${dir_home}"/.joplin/
202sudo rsync -aP "${dir_backup}"/"${dir_home}"/.vscode-oss/ "${dir_home}"/.vscode-oss/
203
204sudo rsync -aP "${dir_backup}"/"${dir_home}"/Pictures/Wallpapers/ "${dir_home}"/Pictures/Wallpapers/
205sudo rsync -aP "${dir_backup}"/"${dir_home}"/Documents/ "${dir_home}"/Documents/
206echo && printf "${GREEN}Done restoring files" && printf "${NC}" && echo && echo && sleep .5
207
208
209
210# JELLYFIN
211echo && printf "${YELLOW}Configuring Jellyfin" && printf "${NC}" && echo && echo && sleep ${SLEEP}
212sudo rsync -aP "${dir_backup}"/var/lib/jellyfin/ /var/lib/jellyfin/
213sudo chown -R jellyfin:jellyfin /var/lib/jellyfin/
214sudo chmod -R 777 /var/lib/jellyfin/
215sudo systemctl restart jellyfin.service
216echo && printf "${GREEN}Done configuring Jellyfin" && printf "${NC}" && echo && echo && sleep .5
217
218
219
220# APACHE
221echo && printf "${YELLOW}Installing Apache" && printf "${NC}" && echo && echo && sleep ${SLEEP}
222sudo pacman -Sy apache
223echo && printf "${GREEN}Done installing Apache" && printf "${NC}" && echo && echo && sleep .5
224
225
226
227# MYSQL
228echo && printf "${YELLOW}Installing MariaDB" && printf "${NC}" && echo && echo && sleep ${SLEEP}
229sudo pacman -Sy mariadb
230sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
231sudo systemctl start mariadb.service
232sudo mysql_secure_installation
233echo && printf "${GREEN}Done installing MariaDB" && printf "${NC}" && echo && echo && sleep .5
234
235
236
237# PHP
238echo && printf "${YELLOW}Installing PHP" && printf "${NC}" && echo && echo && sleep ${SLEEP}
239sudo pacman -Sy php php-apache php-gd php-fpm php-sqlite
240echo && printf "${GREEN}Done installing PHP" && printf "${NC}" && echo && echo && sleep .5
241
242
243
244# ENABLE BOOT
245echo && printf "${YELLOW}Enabling services for boot" && printf "${NC}" && echo && echo && sleep ${SLEEP}
246sudo systemctl enable mysqld httpd sshd jellyfin syncthing@airikr.service
247echo && printf "${GREEN}Done" && printf "${NC}" && echo && echo && sleep .5
248
249
250
251# START
252echo && printf "${YELLOW}Starting SSH & Syncthing" && printf "${NC}" && echo && echo
253sudo systemctl start sshd syncthing@airikr.service
254echo && printf "${GREEN}Done" && printf "${NC}" && echo && echo && sleep .5
255
256
257
258# COMPOSER
259echo && printf "${YELLOW}Installing Composer" && printf "${NC}" && echo && echo && sleep ${SLEEP}
260php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
261php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
262php composer-setup.php
263php -r "unlink('composer-setup.php');"
264sudo mv composer.phar /usr/local/bin/composer
265echo && printf "${GREEN}Done installing Composer" && printf "${NC}" && echo && echo && sleep .5
266
267
268
269# GEOSPATIAL
270#git clone https://github.com/php-geospatial/geospatial.git
271#cd geospatial
272#phpize
273#./configure --enable-geospatial
274#make
275#sudo make install
276
277
278
279# RESTORE WEB SERVER FILES
280echo && printf "${YELLOW}Restoring configuration files for the web server" && printf "${NC}" && echo && echo && sleep ${SLEEP}
281sudo rsync -aP "${dir_backup}"/etc/httpd/conf/httpd.conf /etc/httpd/conf/
282sudo rsync -aP "${dir_backup}"/etc/httpd/conf/extra/phpmyadmin.conf /etc/httpd/conf/extra/
283sudo rsync -aP "${dir_backup}"/etc/php/php.ini /etc/php/
284echo && printf "${GREEN}Done restoring configuration files for the web server" && printf "${NC}" && echo && echo && sleep .5
285
286echo && printf "${YELLOW}Restoring website projects" && printf "${NC}" && echo && echo && sleep ${SLEEP}
287sudo rsync -aP "${dir_backup}"/srv/http/ /srv/http/
288echo && printf "${GREEN}Done restoring website projects" && printf "${NC}" && echo && echo && sleep .5
289
290
291
292# RESTART
293echo && printf "${YELLOW}Restarting Apache" && printf "${NC}" && echo && echo && sleep ${SLEEP}
294sudo systemctl restart httpd.service
295echo && printf "${GREEN}Done" && printf "${NC}" && echo && echo && sleep .5
296
297
298
299# ADDING USER
300echo && printf "${YELLOW}Adding vboxusers to the user group" && printf "${NC}" && echo && echo && sleep ${SLEEP}
301sudo usermod -a -G vboxusers $USER
302echo && printf "${GREEN}Done. Log out and log back in to enable vboxusers" && printf "${NC}" && echo && echo && sleep .5
303
304
305
306# CONFIGURE JOTTA-CLI
307echo && printf "${YELLOW}Configuring jotta-cli" && printf "${NC}" && echo && echo && sleep ${SLEEP}
308run_jottad
309jotta-cli login
310jotta-cli sync setup --root /mnt/ExtSSD/JottaSync/
311jotta-cli sync start
312jotta-cli sync status
313jotta-cli add '/home/{username}/'
314echo && printf "${YELLOW}Run jotta-cli scan to start the scanning" && printf "${NC}" && echo && echo && sleep .5
315
316echo && printf "${GREEN}All done!" && printf "${NC}"
317
318
319
320# Log out and log back in again to enable vboxusers
321# Download FreeFileSync at https://freefilesync.org/
322
323# Use the following if root's password is wrong
324# sudo mysql
325# ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('password');
326# quit
327
328# Connect to MySQL with the root user
329# /usr/bin/mariadb -u root -p
330
331# To create a new user and grant all privileges
332# CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
333# GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
334
335# To change the username
336# RENAME USER 'user'@'localhost' to 'new-user'@'localhost';
337
338# To change the password
339# ALTER USER 'user'@'localhost' IDENTIFIED BY 'new-password';
340# quit
341
342# sudo nano /etc/X11/xorg.conf.d/20-nvidia.conf
343# If anything, install gamemode and lib32-gamemode
344# Follow the instructions below NVIDIA Improvements at https://steamcommunity.com/sharedfiles/filedetails/?id=1787799592