From 90656790f41703008eeb92139a7c3513eac0d3d9 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 21 May 2021 22:59:28 +0200
Subject: [PATCH 12/N] Workaround compressing packages with bsdtar under
 Active Directory account

---
 scripts/makepkg.sh.in  | 4 ++--
 scripts/repo-add.sh.in | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7ad3a0e..1a6acc1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -711,7 +711,7 @@ create_package() {
 	msg2 "$(gettext "Compressing package...")"
 	# TODO: Maybe this can be set globally for robustness
 	shopt -s -o pipefail
-	list_package_files | LANG=C bsdtar --no-fflags --no-xattrs -cnf - --null --files-from - |
+	list_package_files | LANG=C bsdtar --no-fflags --no-xattrs --uid 1 --uname root --gid 1 --gname root -cnf - --null --files-from - |
 		compress_as "$PKGEXT" > "${pkg_file}" || ret=$?
 
 	shopt -u -o pipefail
@@ -806,7 +806,7 @@ create_srcpackage() {
 
 	# TODO: Maybe this can be set globally for robustness
 	shopt -s -o pipefail
-	LANG=C bsdtar --no-fflags -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$?
+	LANG=C bsdtar --no-fflags --uid 1 --uname root --gid 1 --gname root -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$?
 
 	shopt -u -o pipefail
 
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index a231699..8d6d32d 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -531,7 +531,7 @@ create_db() {
 			warning "$(gettext "No packages remain, creating empty database.")"
 			files=(-T /dev/null)
 		fi
-		bsdtar -cf - "${files[@]}" | compress_as "$filename" > "$tempname"
+		bsdtar --uid 1 --uname root --gid 1 --gname root -cf - "${files[@]}" | compress_as "$filename" > "$tempname"
 		popd >/dev/null
 
 		create_signature "$tempname"
-- 
2.33.0

