Skip to content

Commit c5c9b05

Browse files
committed
Update setup script
1 parent 09c42c4 commit c5c9b05

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

setup.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ then
4545
echo -e "DB_DSN=mysql:host=localhost;dbname=$dataname\nDB_USERNAME=$username\nDB_PASSWORD=$password" > .env
4646
elif [ $database == "2" ]
4747
then
48-
echo -e "DB_DSN=sqlite:$path/$dataname.sqlite\nDB_USERNAME=$username\nDB_PASSWORD=$password" > .env
49-
touch $dataname.sqlite
50-
echo "Needing sudo password to chown database file"
51-
sudo chown www-data:www-data $dataname.sqlite
48+
mkdir -p db
49+
echo -e "DB_DSN=sqlite:$path/db/$dataname.sqlite\nDB_USERNAME=$username\nDB_PASSWORD=$password" > .env
50+
if [ -f db/$dataname.sqlite ]; then
51+
echo "Database file already exists at $dataname.sqlite, if this is unexpected you might have to delete it manually and run this script again"
52+
else
53+
touch db/$dataname.sqlite
54+
fi
55+
echo "Needing sudo password to chown database files"
56+
sudo chown -R www-data:www-data db
5257
fi
5358

5459
# Run php script
@@ -57,5 +62,5 @@ echo "Running migration script"
5762
php bin/migrate
5863

5964
echo ""
60-
echo "Creating admin user"
65+
echo "Creating admin user, please fill the following data with the administrator credentials"
6166
php bin/adduser

0 commit comments

Comments
 (0)