diff options
author | Erich Eckner <git@eckner.net> | 2024-07-09 14:35:49 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2024-07-09 14:35:49 +0200 |
commit | aefd1dd647fea16a418497e8370dffdf5a2c71ef (patch) | |
tree | 1309cce97a4be0409ce5fe7785747acd877df547 | |
parent | 1ce958e91ea06e47e907c9770cc04ebb40806cb9 (diff) | |
download | archlinuxewe-aefd1dd647fea16a418497e8370dffdf5a2c71ef.tar.xz |
addPkgbuildPatch: can now also remove patches
-rwxr-xr-x | addPkgbuildPatch | 28 | ||||
-rwxr-xr-x | archPackagesUpdate | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/addPkgbuildPatch b/addPkgbuildPatch index 247879398..07c4fce74 100755 --- a/addPkgbuildPatch +++ b/addPkgbuildPatch @@ -2,7 +2,23 @@ tmpDir=$(dirname "$(readlink -e "$0")") -if ! grep -qwF _patch_PKGBUILD PKGBUILD; then +usage() { + >&2 printf 'usage:\n' + >&2 printf ' %s add|del\n' "$0" + >&2 printf 'To be called next to the to be patched PKGBUILD.\n' + exit 1 +} + +if [ $# -ne 1 ] || [ ! -f 'PKGBUILD' ]; then + usage +fi + +if [ "$1" != 'add' ] && [ "$1" != 'del' ]; then + usage +fi + +if [ "$1" = 'add' ] \ +&& ! grep -qwF _patch_PKGBUILD PKGBUILD; then # add PKGBUILD-patches to the PKGBUILD if grep -q '^\s*pkgbase=' PKGBUILD; then @@ -39,3 +55,13 @@ if ! grep -qwF _patch_PKGBUILD PKGBUILD; then } \ >> PKGBUILD fi + +if [ "$1" = 'del' ] \ +&& grep -qwF _patch_PKGBUILD PKGBUILD; then + + # del PKGBUILD-patches from the PKGBUILD + sed -i ' + /^_patch_PKGBUILD$/d + /^_patch_PKGBUILD() {$/,/^}/d + ' PKGBUILD +fi diff --git a/archPackagesUpdate b/archPackagesUpdate index fc1596ebe..13f674946 100755 --- a/archPackagesUpdate +++ b/archPackagesUpdate @@ -533,7 +533,7 @@ for ((i=0; i<${#pakete[@]}; i++)); do cd "${tmpDir}/${paket}" rm -rf --one-file-system src pkg - ../addPkgbuildPatch + ../addPkgbuildPatch add case "${arch}" in 'any'|'i486'|'i686'|'pentium4'|'x86_64'|"${myArch}") |