-
Notifications
You must be signed in to change notification settings - Fork 1
/
fedora
193 lines (169 loc) · 8.05 KB
/
fedora
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
#!/bin/bash
# set -x # Enables printing of all commands
echo "Do you want to have everything run automatically? (Yes/No)"
read master_answer
# Change hostname
echo "Before we begin, do you want to change your hostname? (Y/N)"
read download_package
if [[ ${download_package,,} == "y" ]]; then
echo "Please enter your desired hostname:"
read desired_hostname
echo "Changing hostname to $desired_hostname"
sudo hostnamectl set-hostname "$desired_hostname" || echo "Failed to change hostname"
fi
if [[ ${master_answer,,} = "yes" ]]; then
auto_confirm=true
echo "starting automatic setup"
elif [[ ${master_answer,,} = "no" ]]; then
echo "starting manual setup" ||
auto_confirm=false
fi
# edits dnf config file for parallel downloads
if [[ ${master_answer,,} = "yes" ]]; then
echo "Configuring DNF parallel downloads"
sudo cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf.bak || { echo "Failed to locate DNF file directory"; exit 1; }
sudo sed -i '/max_parallel_downloads/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo "Failed to eonfigure DNF parallel downloads"
elif [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to configure DNF parallel downloads? (Y/N)"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
echo "Configuring DNF parallel downloads"
sudo cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf.bak || { echo "Failed to locate DNF file directory"; exit 1; }
sudo sed -i '/max_parallel_downloads/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo "Failed to eonfigure DNF parallel downloads"
elif [[ ${download_answer,,} = "n" ]]; then
echo "Download cancelled"
else
echo "Invalid input. Please enter a valid input"
fi
fi
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to install the RPM Fusion Repository? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "Downloading RPM Fusion Repository"
#enabling RPM Fusion Repository
echo "Enabling RPM Fusion Repository"
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm || { echo "Failed to download RPM Fusion Repository (free)"; exit 1;}
sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm || echo "Failed to download RPM Fusion Repository (nonfree)"
echo "All packages downloaded successfully"
else
echo "Skipping the RPM Fusion Repository"
fi
fi
# List of packages
packages=("dnf5" "fastfetch" "pip" "pnpm" "vboot-utils" "--repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' --setopt='terra.gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc' terra-release" "gnome-tweaks" "gnome-extensions-app" "gparted" "filezilla" "nano" "discord" "git" "gimp" "thunderbird" "code" "vlc")
# downloads all the packages
for package in "${packages[@]}"
do
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to download $package? (Y/N)"
read download_package
if [[ ${download_package,,} == "n" ]]; then
echo "Skipping $package"
continue
fi
fi
if [[ $package = "code" ]]; then
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
sudo dnf install code
else
echo "Downloading $package..."
sudo dnf install -y $package || echo "Failed to download $package"
fi
done
# upgrades packages. Opera needs packages updated before installing
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to update all packages (note - reccomended for Opera install)? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "Upgrading packages"
echo "Upgrading all packages"
sudo dnf upgrade -y || echo "Failed to update $package"
echo "All packages upgraded successfully"
fi
fi
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to install and configure Opera? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "Installing Opera"
sudo dnf install -y dnf-plugins-core || echo "Failed to install dnf-plugins-core"
echo "configuring Opera"
sudo dnf config-manager --add-repo https://rpm.opera.com/rpm || echo "Failed to add Opera Repo"
sudo rpm --import https://rpm.opera.com/rpmrepo.key || echo "Failed to import Opera gpg-key"
sudo dnf install -y opera-stable || echo "Failed to download Opera"
echo "Opera successfully installed"
fi
fi
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to install Multimedia Codecs? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "Installing Multimedia Codecs"
# Multimedia codecs
echo "Installing multimedia codecs"
sudo dnf install -y gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel || echo "Failed to install a codec"
sudo dnf install -y lame\* --exclude=lame-devel || { echo "Failed to install a codec"; exit 1; }
echo "Upgrading multimedia codecs"
sudo dnf group upgrade --with-optional Multimedia || echo "Failed to update codec(s)"
echo "Multimedia Codecs successfully installed"
fi
fi
# Adds minimize and maximize buttons
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to add the minimize/maximize buttons onto your windows (GNOME only)? (Y/N)"
read download_package
fi
if [[ ${download_package,,} != "n" ]]; then
echo "Adding minimize, maximize, and close buttons"
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close" || echo "Failed to add minimize/maximize buttons"
echo "adding dock"
gnome-extensions enable [email protected] || echo "Failed to add dock"
echo "Minimize and maximize buttons added"
fi
# Adds doc on GNOME
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to add a dock (GNOME only)? (Y/N)"
read download_package
fi
if [[ ${download_package,,} != "n" ]]; then
echo "Adding dock"
sudo dnf install -y gnome-shell-extension-dash-to-dock
echo "adding dock"
fi
# turns night light on
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to turn on night light (night shift) (GNOME only)? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "turning on night light"
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true || echo "Failed to turn night light on"
fi
fi
# turns auto reporting off
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to turn off automatic reporting? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "disabling automatic reporting"
sudo systemctl stop abrt-journal-core.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl disable abrt-journal-core.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl stop abrt-oops.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl disable abrt-oops.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl stop abrt-xorg.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl disable abrt-xorg.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl stop abrtd.service || { echo "Failed to turn off automatic reporting"; exit 1; }
sudo systemctl disable abrtd.service || { echo "Failed to turn off automatic reporting"; exit 1; }
fi
echo "Automatic reporting disabled"
fi
# Reboots to set in changes
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to reboot to apply/view changes? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "Rebooting"
reboot || echo "Failed to reboot"
fi
fi