Redesign patcher
Remove legacy armv8 patch procedure Add unpatch procedure
This commit is contained in:
parent
a7e60f703b
commit
6c37a0f753
@ -8,7 +8,7 @@ This patcher is designed to simplify the installation steps from this [Gist](htt
|
|||||||
|
|
||||||
## Supported architectures
|
## Supported architectures
|
||||||
([check your NAS architecture here](https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model))
|
([check your NAS architecture here](https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model))
|
||||||
- ARMv8 ⚠️ (DSM 7.0 ready but the wrapper could have performances issues on some NAS models)
|
- ARMv8 ✅ (DSM 7.0 ready)
|
||||||
- Old ARM ✅ (DSM 7.0 ready)
|
- Old ARM ✅ (DSM 7.0 ready)
|
||||||
- x64 ✅ (DSM 7.0 ready)
|
- x64 ✅ (DSM 7.0 ready)
|
||||||
- x86 ✅ (DSM 7.0 ready)
|
- x86 ✅ (DSM 7.0 ready)
|
||||||
@ -27,11 +27,12 @@ This patcher is designed to simplify the installation steps from this [Gist](htt
|
|||||||
- You'll have to re-run the patcher everytime you update VideoStation, Advanced Media Extensions and DSM
|
- You'll have to re-run the patcher everytime you update VideoStation, Advanced Media Extensions and DSM
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Basic command usage:
|
Basic command:
|
||||||
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash`
|
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash`
|
||||||
With options:
|
With options:
|
||||||
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash -s -- <option>`
|
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash -s -- <option>`
|
||||||
|
|
||||||
| Options | Description |
|
| Options | Description |
|
||||||
| ------ | ----------- |
|
| ------ | ----------- |
|
||||||
| -f | Force patcher to install ffmpeg-wrapper (only usefull on ARMv8 architectures if the default procedure doesn't work)
|
| -patch | patch VideoStation and CodecPack |
|
||||||
|
| -unpatch | restore VideoStation and CodecPack to default files
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8
motd.txt
8
motd.txt
@ -1,5 +1,5 @@
|
|||||||
Please let me now of any issue you could get, the more architectures the script is tested on, the more stable it will be.
|
The patcher was redesigned to include an unpatch procedure.
|
||||||
|
|
||||||
Some NAS running on ARMv8 architectures can have troubles with the dedicated patch procedures, if the first attempt fails:
|
I'm aware of an issue with HEVC and I'm working on it.
|
||||||
- uninstall + reinstall both VideoStation (keep library) and Advanced Media Extension
|
|
||||||
- re-run the script using the -f option (curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash -s -- -f)
|
As always, please let me know of any issue you could have.
|
||||||
|
189
patcher.sh
189
patcher.sh
@ -1,136 +1,133 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# LIFECYCLE
|
# VARS
|
||||||
###############################
|
###############################
|
||||||
function welcome_motd() {
|
|
||||||
echo "[INFO] ffmpeg-patcher v1.2"
|
|
||||||
|
|
||||||
motd=$(curl -s -L "https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/motd.txt?raw=true")
|
repo_base_url=https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher
|
||||||
|
vs_bin_path=/var/packages/VideoStation/target/bin
|
||||||
|
cp_bin_path=/var/packages/CodecPack/target/bin
|
||||||
|
ffmpeg_bin_path=/var/packages/ffmpeg/target/bin
|
||||||
|
libsynovte_path=/var/packages/VideoStation/target/lib/libsynovte.so
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# UTILS
|
||||||
|
###############################
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2"
|
||||||
|
}
|
||||||
|
function info() {
|
||||||
|
log "INFO" "$1"
|
||||||
|
}
|
||||||
|
function error() {
|
||||||
|
log "ERROR" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function welcome_motd() {
|
||||||
|
info "ffmpeg-patcher v1.5"
|
||||||
|
|
||||||
|
motd=$(curl -s -L "$repo_base_url/blob/main/motd.txt?raw=true")
|
||||||
if [ "${#motd}" -ge 1 ]; then
|
if [ "${#motd}" -ge 1 ]; then
|
||||||
echo "[INFO] Message of the day:"
|
log "Message of the day"
|
||||||
echo ""
|
echo ""
|
||||||
echo "$motd"
|
echo "$motd"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_and_patch() {
|
function restart_packages() {
|
||||||
cp -n /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.orig
|
if [[ -d $cp_bin_path ]]; then
|
||||||
chown VideoStation:VideoStation /var/packages/VideoStation/target/lib/libsynovte.so.orig
|
log "INFO" "Restarting CodecPack..."
|
||||||
|
|
||||||
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so
|
|
||||||
}
|
|
||||||
|
|
||||||
function restart_videostation() {
|
|
||||||
if [[ -d /var/packages/CodecPack/target/bin ]]; then
|
|
||||||
echo "[INFO] Restarting CodecPack..."
|
|
||||||
synopkg restart CodecPack
|
synopkg restart CodecPack
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[INFO] Restarting VideoStation..."
|
info "Restarting VideoStation..."
|
||||||
synopkg restart VideoStation
|
synopkg restart VideoStation
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_patch() {
|
function check_dependencies() {
|
||||||
echo ""
|
if [[ ! -d $ffmpeg_bin_path ]]; then
|
||||||
echo "[SUCCESS] Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
|
error "Missing SynoCommunity ffmpeg package, please install it and re-run the patcher."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# PATCH PROCEDURES
|
# PATCH PROCEDURES
|
||||||
################################
|
################################
|
||||||
function armv8_procedure() {
|
|
||||||
echo "[INFO] Running ARMv8 procedure"
|
|
||||||
echo "[INFO] Saving current ffmpeg as ffmpeg.orig"
|
|
||||||
mv -n /var/packages/VideoStation/target/lib/ffmpeg /var/packages/VideoStation/target/lib/ffmpeg.orig
|
|
||||||
|
|
||||||
echo "[INFO] Downloading patched ffmpeg files to /var/packages/VideoStation/target/lib"
|
function patch() {
|
||||||
echo ""
|
info "====== Patching procedure ======"
|
||||||
|
|
||||||
declare -a ffmpegfiles=(
|
info "Saving current ffmpeg as ffmpeg.orig"
|
||||||
"libavcodec.so.56"
|
mv -n "$vs_bin_path/ffmpeg" "$vs_bin_path/ffmpeg.orig"
|
||||||
"libavdevice.so.56"
|
|
||||||
"libavfilter.so.5"
|
|
||||||
"libavformat.so.56"
|
|
||||||
"libavutil.so.54"
|
|
||||||
"libpostproc.so.53"
|
|
||||||
"libswresample.so.1"
|
|
||||||
"libswscale.so.3"
|
|
||||||
);
|
|
||||||
|
|
||||||
if [[ ! -d /var/packages/VideoStation/target/lib/ffmpeg ]]; then
|
info "Downloading ffmpeg's wrapper..."
|
||||||
echo "[INFO] Creating ffmpeg directory"
|
wget -q -O - "$repo_base_url/blob/main/ffmpeg-wrapper.sh?raw=true" > "$vs_bin_path/ffmpeg"
|
||||||
mkdir /var/packages/VideoStation/target/lib/ffmpeg
|
chown root:VideoStation "$vs_bin_path/ffmpeg"
|
||||||
fi
|
chmod 750 "$vs_bin_path/ffmpeg"
|
||||||
|
chmod u+s "$vs_bin_path/ffmpeg"
|
||||||
|
|
||||||
for file in "${ffmpegfiles[@]}"
|
if [[ -d $cp_bin_path ]]; then
|
||||||
do
|
find $cp_bin_path -type f -name "ffmpeg*" | grep -v ".orig" | while read filename
|
||||||
echo "[INFO] Downloading $file ..."
|
|
||||||
wget -q -O "/var/packages/VideoStation/target/lib/ffmpeg/$file" "https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/ffmpeg/$file?raw=true"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -d /var/packages/CodecPack/target/lib/ffmpeg27 ]]; then
|
|
||||||
echo "[INFO] Creating symbolic link from CodecPack ffmpeg directory"
|
|
||||||
mv /var/packages/CodecPack/target/lib/ffmpeg27 /var/packages/CodecPack/target/lib/ffmpeg27.orig
|
|
||||||
ln -s /var/packages/VideoStation/target/lib/ffmpeg /var/packages/CodecPack/target/lib/ffmpeg27
|
|
||||||
fi
|
|
||||||
|
|
||||||
save_and_patch
|
|
||||||
restart_videostation
|
|
||||||
end_patch
|
|
||||||
}
|
|
||||||
|
|
||||||
function wrapper_procedure() {
|
|
||||||
echo "[INFO] Running wrapping procedure"
|
|
||||||
echo "[INFO] Saving current ffmpeg as ffmpeg.orig"
|
|
||||||
mv -n /var/packages/VideoStation/target/bin/ffmpeg /var/packages/VideoStation/target/bin/ffmpeg.orig
|
|
||||||
|
|
||||||
echo "[INFO] Downloading ffmpeg-wrapper for VideoStation"
|
|
||||||
wget -q -O - https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/ffmpeg-wrapper.sh?raw=true > /var/packages/VideoStation/target/bin/ffmpeg
|
|
||||||
|
|
||||||
chown root:VideoStation /var/packages/VideoStation/target/bin/ffmpeg
|
|
||||||
chmod 750 /var/packages/VideoStation/target/bin/ffmpeg
|
|
||||||
chmod u+s /var/packages/VideoStation/target/bin/ffmpeg
|
|
||||||
|
|
||||||
if [[ -d /var/packages/CodecPack/target/bin ]]; then
|
|
||||||
find /var/packages/CodecPack/target/bin/ -type f -name "ffmpeg*" | grep -v ".orig" | while read filename
|
|
||||||
do
|
do
|
||||||
echo "[INFO] Patching CodecPack's $filename..."
|
info "Patching CodecPack's $filename"
|
||||||
if [[ ! -f "$filename.orig" ]]; then
|
|
||||||
mv "$filename" "$filename.orig"
|
mv -n $filename "$filename.orig"
|
||||||
fi
|
ln -s -f "$vs_bin_path/ffmpeg" $filename
|
||||||
if [[ ! -f "$filename" ]]; then
|
|
||||||
ln -s /var/packages/VideoStation/target/bin/ffmpeg "$filename"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
save_and_patch
|
info "Saving current libsynovte.so as libsynovte.so.orig"
|
||||||
restart_videostation
|
cp -n "$libsynovte_path" "$libsynovte_path.orig"
|
||||||
end_patch
|
chown VideoStation:VideoStation "$libsynovte_path.orig"
|
||||||
|
|
||||||
|
info "Enabling eac3, dts and truehd"
|
||||||
|
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' "$libsynovte_path"
|
||||||
|
|
||||||
|
restart_packages
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
info "Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unpatch() {
|
||||||
|
info "====== Unpatch procedure ======"
|
||||||
|
|
||||||
|
info "Restoring libsynovte.so"
|
||||||
|
mv -f "$libsynovte_path.orig" "$libsynovte_path"
|
||||||
|
|
||||||
|
info "Restoring VideoStation's ffmpeg"
|
||||||
|
mv -f "$vs_bin_path/ffmpeg.orig" "$vs_bin_path/ffmpeg"
|
||||||
|
|
||||||
|
if [[ -d $cp_bin_path ]]; then
|
||||||
|
find $cp_bin_path -type f -name "ffmpeg*.orig" | while read filename
|
||||||
|
do
|
||||||
|
info "Restoring CodecPack's $filename"
|
||||||
|
mv -T -f "$filename" "${filename::-5}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
restart_packages
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
info "unpatch complete"
|
||||||
|
}
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# ENTRYPOINT
|
# ENTRYPOINT
|
||||||
################################
|
################################
|
||||||
welcome_motd
|
welcome_motd
|
||||||
|
arg1=${1:--patch}
|
||||||
|
|
||||||
forcewrapper=false
|
check_dependencies
|
||||||
|
|
||||||
while getopts "f" option
|
case "$arg1" in
|
||||||
do
|
-unpatch)
|
||||||
case $option in
|
unpatch
|
||||||
f)
|
;;
|
||||||
forcewrapper=true
|
-patch)
|
||||||
;;
|
patch
|
||||||
esac
|
;;
|
||||||
done
|
esac
|
||||||
|
|
||||||
if [[ $(cat /proc/cpuinfo | grep 'model name' | uniq) =~ "ARMv8" && $forcewrapper == false ]]; then
|
|
||||||
armv8_procedure
|
|
||||||
else
|
|
||||||
wrapper_procedure
|
|
||||||
fi
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user