Automatically add new user (root:root) on init

This commit is contained in:
augustin64 2023-03-04 19:49:15 +01:00
parent 46684a0f7e
commit 037756b323
2 changed files with 10 additions and 3 deletions

View File

@ -6,13 +6,16 @@ init () {
mkdir -p "partitioncloud/search-partitions"
mkdir -p "partitioncloud/static/thumbnails"
mkdir -p "partitioncloud/static/search-thumbnails"
if [ ! -x instance/partitioncloud.sqlite ]; then
if test -f "instance/partitioncloud.sqlite"; then
printf "Souhaitez vous supprimer la base de données existante ? [y/n] "
read -r CONFIRMATION
[[ $CONFIRMATION == y ]] || exit 1
fi
[[ $CONFIRMATION == y ]] || exit 1
sqlite3 "instance/partitioncloud.sqlite" '.read partitioncloud/schema.sql'
echo "Base de données initialisée"
echo "Base de données créé"
sqlite3 "instance/partitioncloud.sqlite" '.read partitioncloud/init.sql'
echo "Utilisateur root:root ajouté"
}
start () {

4
partitioncloud/init.sql Normal file
View File

@ -0,0 +1,4 @@
-- SQLite
-- Users
INSERT INTO user (username, password, access_level)
VALUES ('root', 'pbkdf2:sha256:260000$DzMbmkbgVJ0JoQa3$4b42c5a5135668ae5e5754fa4f0ac136ece8f59e8d751008bd533b6c9426c9ff', 1);