git: 881ef1a077b2 - main - devel/github-backup-utils: Convert REINPLACE_CMD to patch file

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sat, 23 Mar 2024 14:58:07 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=881ef1a077b2fe77b8d94b5668f98afb10c6209c

commit 881ef1a077b2fe77b8d94b5668f98afb10c6209c
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-03-23 14:18:12 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-03-23 14:30:40 +0000

    devel/github-backup-utils: Convert REINPLACE_CMD to patch file
---
 devel/github-backup-utils/Makefile                 |  2 +-
 ...tch-share-github-backup-utils-ghe-backup-config | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/devel/github-backup-utils/Makefile b/devel/github-backup-utils/Makefile
index 23d149e33121..d94133d70b2a 100644
--- a/devel/github-backup-utils/Makefile
+++ b/devel/github-backup-utils/Makefile
@@ -25,7 +25,7 @@ SUB_FILES=	pkg-message
 SHEBANG_FILES=	bin/* share/github-backup-utils/*
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|/etc/github-backup-utils/backup.config|${PREFIX}/etc/github.backup.config|g' ${WRKSRC}/share/github-backup-utils/ghe-backup-config
+	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKSRC}/share/github-backup-utils/ghe-backup-config
 
 do-install:
 	cd ${WRKSRC}/bin && ${COPYTREE_BIN} . ${STAGEDIR}${PREFIX}/bin
diff --git a/devel/github-backup-utils/files/patch-share-github-backup-utils-ghe-backup-config b/devel/github-backup-utils/files/patch-share-github-backup-utils-ghe-backup-config
new file mode 100644
index 000000000000..52111dc37e92
--- /dev/null
+++ b/devel/github-backup-utils/files/patch-share-github-backup-utils-ghe-backup-config
@@ -0,0 +1,22 @@
+% sed -i '' 's|/etc/github-backup-utils/backup.config|%%PREFIX%%/etc/github.backup.config|g' share/github-backup-utils/ghe-backup-config
+
+--- share/github-backup-utils/ghe-backup-config.orig	2024-02-15 22:08:04 UTC
++++ share/github-backup-utils/ghe-backup-config
+@@ -59,7 +59,7 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup
+ # first and then fall back to the backup-utils root, home directory and system.
+ config_found=false
+ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \
+-  "$HOME/.github-backup-utils/backup.config" "/etc/github-backup-utils/backup.config"; do
++  "$HOME/.github-backup-utils/backup.config" "%%PREFIX%%/etc/github.backup.config"; do
+   if [ -f "$f" ]; then
+     GHE_BACKUP_CONFIG="$f"
+     # shellcheck disable=SC1090 # This is a user-supplied value that can't be predicted
+@@ -259,7 +259,7 @@ if ! $config_found; then
+   [ -n "$GHE_BACKUP_CONFIG" ] && echo " - $GHE_BACKUP_CONFIG" 1>&2
+   echo " - $GHE_BACKUP_ROOT/backup.config" 1>&2
+   echo " - $HOME/.github-backup-utils/backup.config" 1>&2
+-  echo " - /etc/github-backup-utils/backup.config" 1>&2
++  echo " - %%PREFIX%%/etc/github.backup.config" 1>&2
+   exit 2
+ fi
+