@@ -20,7 +20,6 @@ wrappers=(
2020vs_base_path=/var/packages/VideoStation
2121vs_path=" $vs_base_path /target"
2222libsynovte_path=" $vs_path /lib/libsynovte.so"
23- vs_scripts=(" preuninst" )
2423cp_base_path=/var/packages/CodecPack
2524cp_path=" $cp_base_path /target"
2625cp_bin_path=" $cp_path /bin"
@@ -197,21 +196,6 @@ patch() {
197196 exit 1
198197 fi
199198
200- for filename in " ${vs_scripts[@]} " ; do
201- if [[ -f " $vs_base_path /scripts/$filename " ]]; then
202- info " Saving current $filename script as $filename .orig"
203- mv -n " $vs_base_path /scripts/$filename " " $vs_base_path /scripts/$filename .orig"
204-
205- download " $filename .sh" " $repo_base_url /$branch /scripts/$filename .sh" " $vs_base_path /scripts/$filename "
206-
207- info " Injecting script variables..."
208- repo_full_url=" $repo_base_url /$branch "
209- sed -i -e " s|@repo_full_url@|$repo_full_url |" " $vs_base_path /scripts/$filename "
210-
211- chmod 755 " $vs_base_path /scripts/$filename "
212- fi
213- done
214-
215199 for filename in " ${wrappers[@]} " ; do
216200 if [[ -f " $vs_path /bin/$filename " ]]; then
217201 info " Saving current $filename as $filename .orig"
@@ -221,6 +205,8 @@ patch() {
221205 chown root:VideoStation " $vs_path /bin/$filename "
222206 chmod 750 " $vs_path /bin/$filename "
223207 chmod u+s " $vs_path /bin/$filename "
208+
209+ sed -i -e " s/@package_name@/VideoStation/" " $vs_path /bin/$filename "
224210 fi
225211 done
226212
@@ -233,24 +219,61 @@ patch() {
233219 info " Patching CodecPack's $filename "
234220
235221 mv -n " $cp_bin_path /$filename " " $cp_bin_path /$filename .orig"
236- ln -s -f " $vs_path /bin/$target " " $cp_bin_path /$filename "
222+ download " $filename .sh" " $repo_base_url /$branch /wrappers/$target .sh" " $cp_bin_path /$filename "
223+ chmod 750 " $cp_bin_path /$filename "
224+ chmod u+s " $cp_bin_path /$filename "
225+
226+ sed -i -e " s/@package_name@/CodecPack/" " $cp_bin_path /$filename "
237227 fi
238228 done
229+
230+ if [[ -d " $cp_path /lib/gstreamer" ]]; then
231+ gst_lib_path=" $cp_path /lib/gstreamer/patch"
232+ gst_plugin_path=" $cp_path /lib/gstreamer/gstreamer-1.0/patch"
233+
234+ info " Downloading CodecPack's gstreamer plugins..."
235+
236+ mkdir " $gst_plugin_path "
237+ for plugin in " ${gstreamer_plugins[@]} " ; do
238+ download " Gstreamer plugin: $plugin " " $repo_base_url /$branch /plugins/$plugin .so" " $gst_plugin_path /$plugin .so"
239+ done
240+
241+ mkdir " $gst_lib_path "
242+ mkdir -p " $gst_lib_path /dri"
243+ mkdir -p " $gst_lib_path /x264-10bit"
244+ mkdir -p " $gst_lib_path /x265-10bit"
245+
246+ for lib in " ${gstreamer_libs[@]} " ; do
247+ download " Gstreamer library: $lib " " $repo_base_url /$branch /libs/$lib " " $gst_lib_path /$lib "
248+ done
249+ fi
250+
251+ mkdir " $cp_base_path /patch"
252+ download " CodecPack's patch_config.sh" " $repo_base_url /$branch /utils/patch_config.sh" " $cp_base_path /patch/patch_config.sh"
253+ download " CodecPack's patch_utils.sh" " $repo_base_url /$branch /utils/patch_utils.sh" " $cp_base_path /patch/patch_utils.sh"
254+
255+ info " Setting CodecPack's ffmpeg version to: ffmpeg$ffmpegversion "
256+ sed -i -e " s/@ffmpeg_version@/ffmpeg$ffmpegversion /" " $cp_base_path /patch/patch_config.sh"
239257 fi
240258
241259 if [[ -f " $vs_path /bin/gst-launch-1.0" ]]; then
260+ gst_lib_path=" $vs_path /lib/gstreamer/patch"
261+ gst_plugin_path=" $vs_path /lib/gstreamer/gstreamer-1.0/patch"
262+
242263 info " Downloading gstreamer plugins..."
243264
265+ mkdir " $gst_plugin_path "
244266 for plugin in " ${gstreamer_plugins[@]} " ; do
245- download " Gstreamer plugin: $plugin " " $repo_base_url /$branch /plugins/$plugin .so" " $vs_path /lib/gstreamer/gstreamer-1.0 /$plugin .so"
267+ download " Gstreamer plugin: $plugin " " $repo_base_url /$branch /plugins/$plugin .so" " $gst_plugin_path /$plugin .so"
246268 done
247269
248- mkdir -p " $vs_path /lib/gstreamer/dri"
249- mkdir -p " $vs_path /lib/gstreamer/x264-10bit"
250- mkdir -p " $vs_path /lib/gstreamer/x265-10bit"
270+ mkdir " $gst_lib_path "
271+ mkdir -p " $gst_lib_path /dri"
272+ mkdir -p " $gst_lib_path /x264-10bit"
273+ mkdir -p " $gst_lib_path /x265-10bit"
251274
252275 for lib in " ${gstreamer_libs[@]} " ; do
253- download " Gstreamer library: $lib " " $repo_base_url /$branch /libs/$lib " " $vs_path /lib/gstreamer /$lib "
276+ download " Gstreamer library: $lib " " $repo_base_url /$branch /libs/$lib " " $gst_lib_path /$lib "
254277 done
255278
256279 info " Saving current GSTOmx configuration..."
@@ -260,10 +283,12 @@ patch() {
260283 cp -n " $cp_path /etc/gstomx.conf" " $vs_path /etc/gstomx.conf"
261284 fi
262285
263- download " patch_config.sh" " $repo_base_url /$branch /patch_config.sh" " $vs_base_path /patch_config.sh"
286+ mkdir " $vs_base_path /patch"
287+ download " VideoStation's patch_config.sh" " $repo_base_url /$branch /utils/patch_config.sh" " $vs_base_path /patch/patch_config.sh"
288+ download " VideoStation's patch_utils.sh" " $repo_base_url /$branch /utils/patch_utils.sh" " $vs_base_path /patch/patch_utils.sh"
264289
265290 info " Setting ffmpeg version to: ffmpeg$ffmpegversion "
266- sed -i -e " s/@ffmpeg_version@/ffmpeg$ffmpegversion /" " $vs_base_path /patch_config.sh"
291+ sed -i -e " s/@ffmpeg_version@/ffmpeg$ffmpegversion /" " $vs_base_path /patch/ patch_config.sh"
267292
268293 info " Saving current libsynovte.so as libsynovte.so.orig"
269294 cp -n " $libsynovte_path " " $libsynovte_path .orig"
@@ -293,32 +318,33 @@ unpatch() {
293318 mv -T -f " $filename " " ${filename::- 5} "
294319 done
295320
296- find " $vs_base_path /scripts" -type f -name " *.orig" | while read -r filename; do
297- info " Restoring VideoStation's $filename script"
298- mv -T -f " $filename " " ${filename::- 5} "
299- done
300-
301321 if [[ -d $cp_bin_path ]]; then
302322 for file in " ${cp_to_patch[@]} " ; do
303323 filename=" ${file%%:* } "
324+ target=" ${file##*: } "
325+
326+ rm -f " $cp_bin_path /$target "
304327
305328 if [[ -f " $cp_bin_path /$filename .orig" ]]; then
306329 info " Restoring CodecPack's $filename "
307330 mv -T -f " $cp_bin_path /$filename .orig" " $cp_bin_path /$filename "
308331 fi
309332 done
333+
334+ if [[ -d " $cp_path /lib/gstreamer" ]]; then
335+ info " Removing CodecPack gstreamer's patched libraries and plugins"
336+ rm -rf " $cp_path /lib/gstreamer/patch"
337+ rm -rf " $cp_path /lib/gstreamer/gstreamer-1.0/patch"
338+ fi
339+
340+ info " Remove CodecPack's patch directory"
341+ rm -rf " $cp_base_path /patch"
310342 fi
311343
312344 if [[ -f " $vs_path /bin/gst-launch-1.0" ]]; then
313- for plugin in " ${gstreamer_plugins[@]} " ; do
314- info " Removing gstreamer's $plugin plugin"
315- rm -f " $vs_path /lib/gstreamer/gstreamer-1.0/$plugin .so"
316- done
317-
318- for lib in " ${gstreamer_libs[@]} " ; do
319- info " Removing gstreamer's $lib library"
320- rm -f " $vs_path /lib/gstreamer/$lib "
321- done
345+ info " Removing VideoStation gstreamer's patched libraries and plugins"
346+ rm -rf " $vs_path /lib/gstreamer/patch"
347+ rm -rf " $vs_path /lib/gstreamer/gstreamer-1.0/patch"
322348
323349 if [[ -f " $vs_path /etc/gstomx.conf.orig" ]]; then
324350 info " Restoring GSTOmx configuration..."
@@ -328,8 +354,8 @@ unpatch() {
328354 fi
329355 fi
330356
331- info " Remove patch config ."
332- rm -f " $vs_base_path /patch_config.sh "
357+ info " Remove VideoStation's patch directory ."
358+ rm -rf " $vs_base_path /patch "
333359
334360 restart_packages
335361 clean
0 commit comments