From cfc7064964d322711a43973840cccae6c0afdb51 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Mon, 20 Nov 2023 17:52:32 +0530 Subject: [PATCH] make sure that $1 is a real user --- create-image.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/create-image.sh b/create-image.sh index 0186ca8..d14a88a 100755 --- a/create-image.sh +++ b/create-image.sh @@ -15,6 +15,13 @@ for COMMAND in "${COMMANDS_TO_CHECK[@]}"; do fi done +if [[ -n "$1" ]]; then + GUSER="^$1" + if ! grep $GUSER /etc/shadow > /dev/null; then + >&2 echo "$0: ERROR: unable to find user '$1'" + fi +fi + function create_new_image { UBOOT_MAX_SIZE='32' IMAGE_SIZE=$(( $(stat -c '%s' "${IMAGE_NAME}") / 1024 / 1024 ))