Reformated script to use function

This commit is contained in:
Martin Berg Alstad 2022-12-24 11:33:41 +01:00
parent 5eea23a5f1
commit d1d6adc81a

View File

@ -5,24 +5,17 @@ if [ ! -e dist ]; then
vite build
fi
if [ -e robots.txt ]; then
cp robots.txt dist
else
echo "robots.txt not found"
fi
# Copying the file ($1) to the dist directory, or to subdirectory ($2)
copy() {
if [ -e "$1" ]; then
cp "$1" dist/"$2"
else
echo "'$1' not found, skipping"
fi
}
mkdir -p "dist/.well-known"
if [ -e "dist/.well-known" ]; then
if [ -e security.txt ]; then
cp security.txt dist/.well-known
else
echo "security.txt not found"
fi
fi
if [ -e .htaccess ]; then
cp .htaccess dist
else
echo ".htaccess not found"
fi
copy robots.txt
copy security.txt .well-known
copy .htaccess