Browse Source

Change owner of created archive to $SUDO_UID:$SUDO_GID if set

Jakub Jirutka 7 years ago
parent
commit
d4d26c54fe
1 changed files with 5 additions and 0 deletions
  1. 5 0
      alpine-make-rootfs

+ 5 - 0
alpine-make-rootfs

@@ -406,5 +406,10 @@ if [ "$tar_opts" ]; then
 	einfo 'Creating rootfs archive'
 
 	tar -C "$rootfs" $tar_opts --numeric-owner -f "$ROOTFS_DEST" .
+
+	if [ -f "$ROOTFS_DEST" ] && [ "${SUDO_UID:-}" ] && [ "${SUDO_GID:-}" ]; then
+		chown "$SUDO_UID:$SUDO_GID" "$ROOTFS_DEST"
+	fi
+
 	ls -la "$ROOTFS_DEST" >&2
 fi