Correct check for missing resources in Docker

This commit is contained in:
Grzegorz Gidel
2023-04-30 16:22:00 +02:00
parent 7159f946f2
commit a772cf5aee

View File

@@ -1,26 +1,26 @@
#!/bin/sh #!/bin/sh
# Check if the "characters" directory is empty # Check if the "characters" directory is empty
if [ -z "$(ls -A /home/node/app/config/characters)" ]; then if [ ! -e "/home/node/app/config/characters" ]; then
echo "Characters directory is empty. Copying default characters." echo "Characters directory not found. Copying default characters."
mv /home/node/app/public/characters.default /home/node/app/config/characters mv /home/node/app/public/characters.default /home/node/app/config/characters
fi fi
# Check if the "chats" directory is empty # Check if the "chats" directory is empty
if [ -z "$(ls -A /home/node/app/config/chats)" ]; then if [ ! -e "/home/node/app/config/chats" ]; then
echo "Chats directory is empty. Copying default chats." echo "Chats directory not found. Copying default chats."
mv /home/node/app/public/chats.default /home/node/app/config/chats/ mv /home/node/app/public/chats.default /home/node/app/config/chats/
fi fi
# Check if the "User Avatars" directory is empty # Check if the "User Avatars" directory is empty
if [ -z "$(ls -A '/home/node/app/config/User Avatars')" ]; then if [ ! -e "/home/node/app/config/User Avatars" ]; then
echo "User Avatars directory is empty. Copying default user avatars." echo "User Avatars directory not found. Copying default user avatars."
mv /home/node/app/public/User\ Avatars.default /home/node/app/config/User\ Avatars/ mv /home/node/app/public/User\ Avatars.default /home/node/app/config/User\ Avatars/
fi fi
# Check if the "settings.json" file is not empty # Check if the "settings.json" file is not empty
if [ ! -s "/home/node/app/config/settings.json" ]; then if [ ! -e "/home/node/app/config/settings.json" ]; then
echo "Settings file does not exist. Copying default settings." echo "Settings file not found. Copying default settings."
mv /home/node/app/public/settings.json.default /home/node/app/config/settings.json mv /home/node/app/public/settings.json.default /home/node/app/config/settings.json
fi fi