Piped-Alpine/patcher.sh

37 lines
1,016 B
Bash
Raw Permalink Normal View History

2023-08-03 10:21:36 +03:00
#!/usr/bin/env bash
patch_backend () {
patcher \
build.gradle \
-e "s/implementation 'rocks.kavin:reqwest4j:.*'/implementation files('libs\/reqwest4j.jar')/"
2023-08-03 10:21:36 +03:00
patcher \
src/main/java/me/kavin/piped/Main.java \
-e 's/options\.setDsn\(Constants\.SENTRY_DSN\)/options.setDsn("")/'
}
patch_reqwest4j () {
patcher \
build.gradle \
-e '/rust\(project\(":reqwest-jni"\)\)/d'
patcher \
reqwest-jni/build.gradle.kts \
-e 's/command\.set\("cross"\)/command.set("cargo")/' \
2023-08-09 10:48:12 +03:00
-e ' /command\.set\("cargo"\)/a targets += target("x86_64-unknown-linux-musl", "libreqwest.so")' \
2023-08-03 10:21:36 +03:00
-e ' /targets \+= target\(".*-unknown-linux-gnu", "libreqwest\.so"\)/d' \
2023-08-09 10:48:12 +03:00
-e ' /targets \+= target\(".*-pc-windows-gnu", "libreqwest\.dll"\)/d'
2023-08-03 10:21:36 +03:00
}
patcher () {
if grep '//patched' "$1" >/dev/null
then
echo "$1: already patched"
return
fi
file="$1"
shift
sed -i -E "$@" -e '1i //patched' "$file"
}