diff mbox series

[4/4] bringup_guestfs: ensure pool correct permissions

Message ID 20250206-small-fixes-v1-4-4834edb167a3@samsung.com (mailing list archive)
State New
Headers show
Series kdevops: small fixes | expand

Commit Message

Daniel Gomez Feb. 6, 2025, 9:55 p.m. UTC
From: Daniel Gomez <da.gomez@samsung.com>

Ensure correct permissions for the storage pool path top directory.
Otherwise, this directory ends with root permissions when
LIBVIRT_URI_SYSTEM is used (default).

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 scripts/bringup_guestfs.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index 74eeceace9040f6ec716234f8d80ebfe7940dac7..3180b30e5e2d72147c382056f9ee474cce157722 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -14,7 +14,8 @@  IMG_FMT="qcow2"
 if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
 	IMG_FMT="raw"
 fi
-STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
+STORAGETOPDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}"
+STORAGEDIR="${STORAGETOPDIR}/kdevops/guestfs"
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
 OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
@@ -274,9 +275,9 @@  $USE_SUDO mkdir -p $BASE_IMAGE_DIR
 
 
 if [[ "$CONFIG_LIBVIRT_URI_SYSTEM" == "y" ]]; then
-	sudo chgrp -R $QEMU_GROUP $STORAGEDIR
-	sudo chmod -R g+rw $STORAGEDIR
-	sudo chmod -R g+s $STORAGEDIR
+	sudo chown -R $(whoami):$QEMU_GROUP $STORAGETOPDIR
+	sudo chmod -R g+rw $STORAGETOPDIR
+	sudo chmod -R g+s $STORAGETOPDIR
 fi
 
 cmdfile=$(mktemp)