From 46a05eb76dae3c466a3ea4bd2fd98e8511bc8f9e Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 21 Feb 2025 15:14:15 -0500 Subject: [PATCH] fix: chown correctly (#1185) ## Summary by CodeRabbit - **Chores** - Updated the approach to managing directory ownership for improved consistency across various environments. - Enhanced error handling in directory permission and ownership commands. --- plugin/scripts/build-plugin-and-txz.ts | 9 --------- plugin/scripts/makepkg | 7 +++++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/plugin/scripts/build-plugin-and-txz.ts b/plugin/scripts/build-plugin-and-txz.ts index f0a20b326..7f12bb0f2 100644 --- a/plugin/scripts/build-plugin-and-txz.ts +++ b/plugin/scripts/build-plugin-and-txz.ts @@ -150,15 +150,6 @@ const buildTxz = async ( .digest("hex"); console.log(`TXZ SHA256: ${sha256}`); - if (validatedEnv.SKIP_VALIDATION !== "true") { - try { - await $`${join(startingDir, "scripts/explodepkg")} "${txzPath}"`; - } catch (err) { - console.error(`Error: invalid txz package created: ${txzPath}`); - process.exit(1); - } - } - return { txzSha256: sha256, txzName }; }; diff --git a/plugin/scripts/makepkg b/plugin/scripts/makepkg index fe02e3f7e..d8b301182 100755 --- a/plugin/scripts/makepkg +++ b/plugin/scripts/makepkg @@ -379,8 +379,11 @@ else echo fi if [ "$CHOWN" = "y" ]; then - find . -type d -exec chmod -v 755 {} \; - find . -type d -exec chown -v root:root {} \; + # Set strict mode and fail if commands fail + set -e + find . -type d -exec sudo chmod 755 {} + || exit 1 + find . -type d -exec sudo chown 0:0 {} + || exit 1 + set +e fi # Ensure that the 'root' of the package is chmod 755 because