simple-links/start.sh

28 lines
896 B
Bash
Raw Permalink 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/
2023-07-27 02:19:54 +00:00
toDownload=("avatar.webp" "background.jpg" "favicon.ico")
2023-07-12 13:16:41 +00:00
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"
fi
2023-07-12 13:06:48 +00:00
echo "Starting Simple Links..."
npm start