@@ -107,13 +107,12 @@ function root_check() {
107
107
function welcome_motd() {
108
108
info " ffmpeg-patcher v$version "
109
109
110
- motd=$( curl -s -L " $repo_base_url /$branch /motd.txt" )
111
- if [ " ${# motd} " -ge 1 ]; then
112
- log " Message of the day"
113
- echo " "
114
- echo " $motd "
115
- echo " "
116
- fi
110
+ download " $repo_base_url /$branch /motd.txt" /tmp/tmp.wget
111
+
112
+ log " Message of the day"
113
+ echo " "
114
+ cat /tmp/tmp.wget
115
+ echo " "
117
116
}
118
117
119
118
function restart_packages() {
@@ -151,6 +150,22 @@ function check_dependencies() {
151
150
fi
152
151
}
153
152
153
+ function download() {
154
+ wget -q -O - " $1 " > /tmp/temp.wget
155
+ downloadStatus=$?
156
+
157
+ if [[ $downloadStatus == 0 ]]; then
158
+ mv -f /tmp/temp.wget " $2 "
159
+ else
160
+ error " An error occurred while downloading $1 . Rolling back changes..."
161
+ unpatch
162
+
163
+ error " An error occurred while downloading $1 , every changes were rolled back."
164
+ error " Please check your internet connection / GithubStatus. If you think this is an error, please file an issue to the repository."
165
+ exit 1
166
+ fi
167
+ }
168
+
154
169
# ###############################
155
170
# PATCH PROCEDURES
156
171
# ###############################
@@ -164,7 +179,7 @@ function patch() {
164
179
mv -n " $vs_path /bin/$filename " " $vs_path /bin/$filename .orig"
165
180
166
181
info " Downloading and installing $filename 's wrapper..."
167
- wget -q -O - " $repo_base_url /$branch /wrappers/$filename .sh" > " $vs_path /bin/$filename "
182
+ download " $repo_base_url /$branch /wrappers/$filename .sh" " $vs_path /bin/$filename "
168
183
chown root:VideoStation " $vs_path /bin/$filename "
169
184
chmod 750 " $vs_path /bin/$filename "
170
185
chmod u+s " $vs_path /bin/$filename "
@@ -191,9 +206,7 @@ function patch() {
191
206
192
207
for plugin in " ${gstreamer_plugins[@]} " ; do
193
208
info " Downloading $plugin to gstreamer directory..."
194
-
195
- wget -q -O - " $repo_base_url /$branch /plugins/$plugin .so" \
196
- > " $vs_path /lib/gstreamer/gstreamer-1.0/$plugin .so"
209
+ download " $repo_base_url /$branch /plugins/$plugin .so" " $vs_path /lib/gstreamer/gstreamer-1.0/$plugin .so"
197
210
done
198
211
199
212
mkdir -p " $vs_path /lib/gstreamer/dri"
@@ -202,9 +215,7 @@ function patch() {
202
215
203
216
for lib in " ${gstreamer_libs[@]} " ; do
204
217
info " Downloading $lib to gstreamer directory..."
205
-
206
- wget -q -O - " $repo_base_url /$branch /libs/$lib " \
207
- > " $vs_path /lib/gstreamer/$lib "
218
+ download " $repo_base_url /$branch /libs/$lib " " $vs_path /lib/gstreamer/$lib "
208
219
done
209
220
210
221
info " Saving current GSTOmx configuration..."
0 commit comments