Continue new patcher

This commit is contained in:
AlexPresso 2022-06-02 18:19:49 +02:00
parent 87da46d3cd
commit 57feaec5aa
2 changed files with 24 additions and 16 deletions

View File

@ -5,14 +5,20 @@
###############################
dsm_version=$(cat /etc.defaults/VERSION | grep productversion | sed 's/productversion=//' | tr -d '"')
repo_base_url=https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher
repo_base_url="https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher"
action="patch"
branch="main"
dependencies=("ffmpeg")
wrappers=("ffmpeg" "gst-launch-1.0")
vs_path=/var/packages/VideoStation/target
libsynovte_path="$vs_path/lib/libsynovte.so"
cp_bin_path=/var/packages/CodecPack/target/bin
cp_to_patch=("ffmpeg41" "ffmpeg27")
cp_to_patch=(
"ffmpeg41:ffmpeg"
"ffmpeg27:ffmpeg"
"gst-launch-1.0:gst-launch-1.0"
)
###############################
# UTILS
@ -66,29 +72,31 @@ function check_dependencies() {
function patch() {
info "====== Patching procedure (branch: $branch) ======"
info "Saving current ffmpeg as ffmpeg.orig"
mv -n "$vs_path/bin/ffmpeg" "$vs_path/bin/ffmpeg.orig"
for filename in "${wrappers[@]}"; do
if [[ -f "$vs_path/bin/$filename" ]]; then
info "Saving current $filename as $filename.orig"
mv -n "$vs_path/bin/$filename" "$vs_path/bin/$filename.orig"
info "Downloading ffmpeg's wrapper..."
wget -q -O - "$repo_base_url/blob/$branch/ffmpeg-wrapper.sh?raw=true" > "$vs_path/bin/ffmpeg"
chown root:VideoStation "$vs_path/bin/ffmpeg"
chmod 750 "$vs_path/bin/ffmpeg"
chmod u+s "$vs_path/bin/ffmpeg"
info "Downloading and installing $filename's wrapper..."
wget -q -O - "$repo_base_url/blob/$branch/$filename-wrapper.sh?raw=true" > "$vs_path/bin/$filename"
chown root:VideoStation "$vs_path/bin/$filename"
chmod 750 "$vs_path/bin/$filename"
chmod u+s "$vs_path/bin/ffmpeg"
fi
done
if [[ -d $cp_bin_path ]]; then
for filename in "${cp_to_patch[@]}"; do
for file in "${cp_to_patch[@]}"; do
filename="${file%%:*}"
target="${file##*:}"
if [[ -f "$cp_bin_path/$filename" ]]; then
info "Patching CodecPack's $filename"
mv -n "$cp_bin_path/$filename" "$cp_bin_path/$filename.orig"
ln -s -f "$vs_path/bin/ffmpeg" "$cp_bin_path/$filename"
ln -s -f "$vs_path/bin/$target" "$cp_bin_path/$filename"
fi
done
info "Patching CodecPack's gst-launch-1.0"
mv -n "$cp_bin_path/gst-launch-1.0" "$cp_bin_path/gst-launch-1.0.orig"
wget -q -O - "$repo_base_url/blob/$branch/gst-wrapper.sh?raw=true" > "$cp_bin_path/gst-launch-1.0"
chmod a+xr "$cp_bin_path/gst-launch-1.0"
fi
info "Saving current libsynovte.so as libsynovte.so.orig"