2022-08-13 16:28:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
init () {
|
2022-08-13 23:36:10 +02:00
|
|
|
mkdir -p "instance"
|
2022-08-16 18:58:34 +02:00
|
|
|
mkdir -p "partitioncloud/partitions"
|
|
|
|
mkdir -p "partitioncloud/static/thumbnails"
|
2022-08-13 23:36:10 +02:00
|
|
|
if [ ! -x instance/partitioncloud.sqlite ]; then
|
2022-08-13 16:28:57 +02:00
|
|
|
printf "Souhaitez vous supprimer la base de données existante ? [y/n] "
|
|
|
|
read -r CONFIRMATION
|
|
|
|
fi
|
|
|
|
[[ $CONFIRMATION == y ]] || exit 1
|
2022-08-13 23:36:10 +02:00
|
|
|
sqlite3 "instance/partitioncloud.sqlite" '.read partitioncloud/schema.sql'
|
2022-08-13 16:28:57 +02:00
|
|
|
echo "Base de données initialisée"
|
|
|
|
}
|
|
|
|
|
|
|
|
start () {
|
|
|
|
flask run
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
usage () {
|
|
|
|
echo "Usage:"
|
|
|
|
echo -e "\t$0 init"
|
|
|
|
echo -e "\t$0 start"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ $1 && $(type "$1") = *"is a"*"function"* || $(type "$1") == *"est une fonction"* ]]; then
|
|
|
|
$1 ${*:2} # Call the function
|
|
|
|
else
|
|
|
|
usage
|
|
|
|
echo $(type "$1")
|
|
|
|
exit 1
|
2022-08-13 23:36:10 +02:00
|
|
|
fi
|