From 710a0048f0966954a9fb2b63ffc1f00f2a5fe84e Mon Sep 17 00:00:00 2001 From: ngn Date: Thu, 22 Feb 2024 22:19:01 +0300 Subject: [PATCH] fix: Add root user checks, auto-remove .git from the iso --- matter-base/main.sh | 4 ++++ matter-iso/main.sh | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/matter-base/main.sh b/matter-base/main.sh index 9a0837c..80ad25a 100644 --- a/matter-base/main.sh +++ b/matter-base/main.sh @@ -51,6 +51,10 @@ check_ret() { ################# ## main script ## ################# +if [ "$EUID" -ne 0 ]; then + error "You should run this script as root" +fi + if [ $# -eq 0 ]; then error "Please specify a name for the archive" fi diff --git a/matter-iso/main.sh b/matter-iso/main.sh index 8e12b5a..c2379ca 100755 --- a/matter-iso/main.sh +++ b/matter-iso/main.sh @@ -99,6 +99,10 @@ check_iso_vars() { ################# ## main script ## ################# +if [ "$EUID" -ne 0 ]; then + error "You should run this script as root" +fi + if [ $# -ne 2 ]; then error "Please specify a release archive and a config directory" fi @@ -146,6 +150,7 @@ set_indent info "Removing $e" rm -rf "$TMPDIR/$e" done + rm -rf "$TMPDIR/.git" unset_indent info "Extracting release archive"