From 222bf160dc4d3a583d1c2355b3393c35545d6644 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Thu, 2 May 2024 13:35:13 +0200 Subject: [PATCH] fix user already exists --- entrypoint.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3e4d65c..98a9558 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,10 +1,18 @@ #!/bin/bash -echo "Creating User ${UID:-1000}" -useradd -m -u "${UID:-1000}" hoard || exit 1 +# Check if the user already exists +if id hoard &>/dev/null; then + echo "User hoard already exists." +else + # Create the user + echo "Creating User ${UID:-1000}" + useradd -m -u "${UID:-1000}" hoard || exit 1 +fi +# Perform other setup tasks chown -R hoard /download -mkdir /.cache && chown -R hoard /.cache +mkdir -p /.cache && chown -R hoard /.cache chown -R hoard /data -su hoard -c /hoard +# Start the application as the user +su hoard -c /hoard \ No newline at end of file