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
|
2023-07-12 13:42:14 +00:00
|
|
|
# TODO: fix this. it doesn't seem to be working?
|
2023-07-12 13:16:41 +00:00
|
|
|
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"
|
2023-07-12 13:38:42 +00:00
|
|
|
wget -q -P $dir $baseUrl$item
|
2023-07-12 13:16:41 +00:00
|
|
|
echo "Done"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "Finished downloading files!"
|
|
|
|
else
|
|
|
|
echo "All files are already present, no need to download"
|
2023-07-12 13:02:33 +00:00
|
|
|
fi
|
|
|
|
|
2023-07-12 13:06:48 +00:00
|
|
|
echo "Starting Simple Links..."
|
|
|
|
npm start
|