fix user already exists

This commit is contained in:
JMARyA 2024-05-02 13:35:13 +02:00
parent 2cfd3b4f54
commit 222bf160dc
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -1,10 +1,18 @@
#!/bin/bash #!/bin/bash
# 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}" echo "Creating User ${UID:-1000}"
useradd -m -u "${UID:-1000}" hoard || exit 1 useradd -m -u "${UID:-1000}" hoard || exit 1
fi
# Perform other setup tasks
chown -R hoard /download chown -R hoard /download
mkdir /.cache && chown -R hoard /.cache mkdir -p /.cache && chown -R hoard /.cache
chown -R hoard /data chown -R hoard /data
# Start the application as the user
su hoard -c /hoard su hoard -c /hoard