Improvements and Fix wrapping procedure on non ARMv8 (#10)

* Improvements and Fix wrapping procedure on non ARMv8

* Add informational messages

* Display improvements

* Fix options

* Improve readme
This commit is contained in:
AlexPresso 2021-08-08 17:37:23 +02:00 committed by GitHub
parent ad36b76ffc
commit ca9b214f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 28 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/.idea

View File

@ -12,10 +12,10 @@ I'm working hard to fix it but in the mean time, please do not update to DSM 7.0
## 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 ⚠️ (fails on DSM 7.0) - ARMv8 ⚠️ (partial support)
- Old ARM ⚠️ (sometimes fails on DSM 7.0) - Old ARM ⚠️ (partial support)
- x64 ⚠️ (sometimes fails on DSM 7.0) - x64
- x86 ⚠️ (sometimes fails on DSM 7.0) - x86
## Dependencies ## Dependencies
- DSM 6.2.2-24922 Update 4 (and above) - DSM 6.2.2-24922 Update 4 (and above)
@ -27,7 +27,15 @@ I'm working hard to fix it but in the mean time, please do not update to DSM 7.0
- Install SynoCommunity ffmpeg ([help](https://synocommunity.com/#easy-install)) - Install SynoCommunity ffmpeg ([help](https://synocommunity.com/#easy-install))
- Connect to your NAS using SSH (admin user required) ([help](https://www.synology.com/en-global/knowledgebase/DSM/tutorial/General_Setup/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet)) - Connect to your NAS using SSH (admin user required) ([help](https://www.synology.com/en-global/knowledgebase/DSM/tutorial/General_Setup/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet))
- Use the command `sudo -i` to switch to root user - Use the command `sudo -i` to switch to root user
- Use the folowing command to execute the patch: - Use the [folowing](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#usage) command to execute the patch
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash`
- VideoStation will have to be repatched everytime you update it (and when you update DSM) - VideoStation will have to be repatched everytime you update it (and when you update DSM)
## Usage
Basic command usage:
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash`
With options:
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash -s -- <option>`
| Option | Description |
| ------ | ----------- |
| -f | Force patcher to install ffmpeg-wrapper (only usefull on ARMv8 architectures if the default procedure doesn't work)

6
motd.txt Normal file
View File

@ -0,0 +1,6 @@
There are currently some issues with DSM 7.0 (see repository readme).
Please let me now of any issue you could get, the more architectures the script is tested on, the more stable it will be.
ARMv8 architectures are having troubles with the dedicated patch procedures, if the first attempt fails:
- uninstall + reinstall bot 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)

View File

@ -1,5 +1,27 @@
#!/bin/bash #!/bin/bash
###############################
# LIFECYCLE
###############################
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")
if [ "${#motd}" -ge 1 ]; then
echo "[INFO] Message of the day:"
echo ""
echo "$motd"
echo ""
fi
}
function save_and_patch() {
cp -n /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.orig
chown VideoStation:VideoStation /var/packages/VideoStation/target/lib/libsynovte.so.orig
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so
}
function restart_videostation() { function restart_videostation() {
if [[ -d /var/packages/CodecPack/target/bin ]]; then if [[ -d /var/packages/CodecPack/target/bin ]]; then
echo "[INFO] Restarting CodecPack..." echo "[INFO] Restarting CodecPack..."
@ -10,14 +32,17 @@ function restart_videostation() {
synopkg restart VideoStation synopkg restart VideoStation
} }
function save_and_patch() { function end_patch() {
cp -n /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.orig echo ""
chown VideoStation:VideoStation /var/packages/VideoStation/target/lib/libsynovte.so.orig echo "[SUCCESS] Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so
} }
################################
# PATCH PROCEDURES
################################
function armv8_procedure() { function armv8_procedure() {
echo "[INFO] Running ARMv8 procedure"
echo "[INFO] Saving current ffmpeg as ffmpeg.orig" echo "[INFO] Saving current ffmpeg as ffmpeg.orig"
mv -n /var/packages/VideoStation/target/lib/ffmpeg /var/packages/VideoStation/target/lib/ffmpeg.orig mv -n /var/packages/VideoStation/target/lib/ffmpeg /var/packages/VideoStation/target/lib/ffmpeg.orig
@ -54,12 +79,11 @@ function armv8_procedure() {
save_and_patch save_and_patch
restart_videostation restart_videostation
end_patch
echo ""
echo "[SUCCESS] Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
} }
function others_procedure() { function wrapper_procedure() {
echo "[INFO] Running wrapping procedure"
echo "[INFO] Saving current ffmpeg as ffmpeg.orig" echo "[INFO] Saving current ffmpeg as ffmpeg.orig"
mv -n /var/packages/VideoStation/target/bin/ffmpeg /var/packages/VideoStation/target/bin/ffmpeg.orig mv -n /var/packages/VideoStation/target/bin/ffmpeg /var/packages/VideoStation/target/bin/ffmpeg.orig
@ -71,27 +95,41 @@ function others_procedure() {
chmod u+s /var/packages/VideoStation/target/bin/ffmpeg chmod u+s /var/packages/VideoStation/target/bin/ffmpeg
if [[ -d /var/packages/CodecPack/target/bin ]]; then if [[ -d /var/packages/CodecPack/target/bin ]]; then
echo "[INFO] Detected Advanced Media Extensions" cpackfiles=($(ls /var/packages/CodecPack/target/bin | grep ffmpeg))
echo "[INFO] Saving current Advanced Media Extensions ffmpeg33 as ffmpeg33.orig" for file in "${cpackfiles[@]}"
mv /var/packages/CodecPack/target/bin/ffmpeg33 /var/packages/CodecPack/target/bin/ffmpeg33.orig do
echo "[INFO] Patching CodecPack's $file..."
echo "[INFO] Copying VideoStation's ffmpeg to CodecPack ffmpeg33" mv "/var/packages/CodecPack/target/bin/$file" "/var/packages/CodecPack/target/bin/$file.orig"
cp /var/packages/VideoStation/target/bin/ffmpeg /var/packages/CodecPack/target/bin/ffmpeg33 cp /var/packages/VideoStation/target/bin/ffmpeg "/var/packages/CodecPack/target/bin/$file"
chmod 755 /var/packages/CodecPack/target/bin/ffmpeg33 chmod 755 "/var/packages/CodecPack/target/bin/$file"
done
fi fi
save_and_patch save_and_patch
restart_videostation restart_videostation
end_patch
echo ""
echo "[SUCCESS] Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
} }
if [[ $(cat /proc/cpuinfo | grep 'model name' | uniq) =~ "ARMv8" ]]; then
################################
# ENTRYPOINT
################################
forcewrapper=false
while getopts "f" option
do
case $option in
f)
forcewrapper=true
;;
esac
done
if [[ $(cat /proc/cpuinfo | grep 'model name' | uniq) =~ "ARMv8" && $forcewrapper == false ]]; then
armv8_procedure armv8_procedure
else else
others_procedure wrapper_procedure
fi fi