simple-links/start.sh

27 lines
826 B
Bash
Raw Normal View History

2023-07-12 13:16:41 +00:00
workDir=/usr/src/app
baseUrl=https://git.fascinated.cc/Fascinated/simple-links/raw/branch/master/public/
toDownload=("avatar.webp" "background.jpg")
2023-07-12 13:06:48 +00:00
echo "Checking if files need to be downloaded"
2023-07-12 13:16:41 +00:00
if [ -z "$(ls -A $workDir/public)" ]; then
echo "Some files are missing, downloading them"
if [ ! -w "$workDir" ]; then
echo "The directory \"$workDir\" is not writeable, unable to download files. Please check your docker compose for :ro and set it to :rw"
2023-07-12 13:20:53 +00:00
fi
2023-07-12 13:16:41 +00:00
for item in "${toDownload[@]}"
do
dir=$workDir/public/$item
2023-07-12 13:17:06 +00:00
if [ ! -e "$dir" ]; then
2023-07-12 13:16:41 +00:00
echo "Downloading $item to directory $dir"
wget -P $dir $baseUrl$item
echo "Done"
fi
done
echo "Finished downloading files!"
else
echo "All files are already present, no need to download"
fi
2023-07-12 13:06:48 +00:00
echo "Starting Simple Links..."
npm start