forked from TheAMM/mpv_thumbnail_script
-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
update_osc.sh
executable file
·38 lines (30 loc) · 882 Bytes
/
update_osc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
# Update the OSC to the specified mpv version
if [[ $1 == "" ]]; then
echo "Usage: $0 <mpv tag>"
exit 1
fi
pushd src || exit 1
# Download the new one
echo "Downloading the new osc.lua"
wget "https://raw.githubusercontent.com/mpv-player/mpv/$1/player/lua/osc.lua" || exit 1
# Apply the patch
echo "Patching"
patch --backup osc.lua osc.patch
# Exit if something was rejected
[[ -e osc.lua.rej ]] && exit 1
# Generate the patch
# This handles changes in the patch context which may cause problems in the future
echo "Generating a new patch"
mv osc.lua patched_osc.lua
mv osc.lua.orig osc.lua
diff --unified osc.lua patched_osc.lua > osc.patch
# Exit if diff failed
[[ $? == 2 ]] && exit 1
# Cleanup
echo "Cleaning up temp files"
rm osc.lua
popd || exit 1
# Commit the changes
git add src/osc.patch src/patched_osc.lua
git commit -m "Update osc to mpv $1"