-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.sh
102 lines (85 loc) · 3.18 KB
/
setup.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
#!/usr/bin/env bash
# ---------------------------------
#
# Fedora Silverblue Post Install Script
# Copyright (c) James Aaron Erang <[email protected]> 2024
#
# ---------------------------------
FAIL="\e[1;41m[ FAIL ]\e[0m"
INVALID="\e[1;41m[ INVALID ]\e[0m"
SUCCESS="\e[1;42m[ SUCCESS ]\e[0m"
INFO="\e[1;44m[ INFO ]\e[0m"
__USAGE="
Usage: bash setup.sh [OPTIONS]
Options:
-h, --help Print this help message.
-a, --all Apply all of the recommended modifications on the system.
-f, --flatpak Setup flatpak repository.
-r, --rpmfusion Setup RPMFusion repository.
-c, --codecs Install codecs.
-d, --driver Install appropriate drivers.
-m, --msfonts Install Micro\$oft fonts.
-l, --laptop Apply laptop recommendations.
-o, --optimize Perform suggested system optimizations.
-n, --nvidia Install proprietary NVidia drivers.
"
function setup_fail () {
echo -e "$FAIL Installation failed for some reason."
exit 1
}
function setup_success () {
echo -e "$SUCCESS Installation successfully finished."
exit 0
}
function print_help () {
echo -e "$__USAGE"
exit 0
}
function check_cwd () {
if [[ $(basename $(pwd)) != "silverblue-postinstall_upgrade" ]]; then
echo -e "$INFO Set the current working dir inside of the repository."
setup_fail
fi
}
function install_msfonts () {
fonts_dir="$HOME/.local/share/fonts"
if [[ ! -d $fonts_dir ]]; then
mkdir -p fonts_dir
fi
echo -e "$INFO Installing MS fonts @ "
cp -r ./resources/fonts/* fonts_dir
}
function d_gnomesoftware () {
gnome_software_dir="/etc/xdg/autostart/org.gnome.Software.desktop"
if [[ -f $gnome_software_dir ]]; then
echo -e "$INFO Disabling Gnome Software on startup."
sudo rm /etc/xdg/autostart/org.gnome.Software.desktop
else
echo -e "$INFO Gnome Software already disabled on startup."
fi
}
function d_nmwaitonline () {
unit="NetworkManager-wait-online.service"
if [[ $(systemctl is-enabled $unit) != "disabled" ]]; then
echo -e "$INFO Disabling NetworkManager-wait-online.service."
sudo systemctl disable NetworkManager-wait-online.service
else
echo -e "$INFO NetworkManager-wait-online.service is already disabled."
fi
}
for key in "${!rpmrepo[@]}"; do
echo -e "$key.) ${rpmrepo[$key]}"
done
read -sp "Input the number of the selected choice. " choice
echo -e "\n$INFO Installing ${rpmrepo[$choice]}: "
case "${rpmrepo[$choice]}" in
"Free")
rpm-ostree install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm;;
"NonFree")
rpm-ostree install https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm;;
"Both")
rpm-ostree install https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm;;
\?)
echo -e "$INVALID Option not found.";;
esac
}