Files
simple-links/start.sh

27 lines
829 B
Bash
Raw Normal View History

2023-07-12 14:16:41 +01: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 14:06:48 +01:00
echo "Checking if files need to be downloaded"
2023-07-12 14:16:41 +01: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 14:20:53 +01:00
fi
2023-07-12 14:16:41 +01:00
for item in "${toDownload[@]}"
do
dir=$workDir/public/$item
2023-07-12 14:17:06 +01:00
if [ ! -e "$dir" ]; then
2023-07-12 14:16:41 +01:00
echo "Downloading $item to directory $dir"
2023-07-12 14:38:42 +01:00
wget -q -P $dir $baseUrl$item
2023-07-12 14:16:41 +01:00
echo "Done"
fi
done
echo "Finished downloading files!"
else
echo "All files are already present, no need to download"
fi
2023-07-12 14:06:48 +01:00
echo "Starting Simple Links..."
npm start