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 vite build
fi fi
if [ -e robots.txt ]; then # Copying the file ($1) to the dist directory, or to subdirectory ($2)
cp robots.txt dist copy() {
else if [ -e "$1" ]; then
echo "robots.txt not found" cp "$1" dist/"$2"
fi else
echo "'$1' not found, skipping"
fi
}
mkdir -p "dist/.well-known" mkdir -p "dist/.well-known"
if [ -e "dist/.well-known" ]; then copy robots.txt
if [ -e security.txt ]; then copy security.txt .well-known
cp security.txt dist/.well-known copy .htaccess
else
echo "security.txt not found"
fi
fi
if [ -e .htaccess ]; then
cp .htaccess dist
else
echo ".htaccess not found"
fi