LibrePortal/scripts/database/install_sqlite.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

36 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
installSQLiteDatabase()
{
if [[ $CFG_REQUIREMENT_DATABASE == "true" ]]; then
# Safeguard loading
if [ ! -e "$docker_dir/$db_file" ]; then
if command -v sqlite3 &> /dev/null; then
isHeader "Setup SQLite Database"
# Create SQLite database file
if [ ! -e "$docker_dir/$db_file" ]; then
local result=$(sudo touch $docker_dir/$db_file)
checkSuccess "Creating SQLite $db_file file"
local result=$(sudo chmod 755 $docker_dir/$db_file && sudo chown $sudo_user_name $docker_dir/$db_file)
checkSuccess "Changing permissions for SQLite $db_file file"
fi
databaseCreateTables;
# Get list of table names from database
sql_table_names=$(sqlite3 "$docker_dir/$db_file" ".tables")
# Loop through table names and print the desired text
for sql_table_name in $sql_table_names; do
isSuccessful "Table $sql_table_name found in database."
done
fi
else
# Make sure tables are always setup
databaseCreateTables;
fi
fi
}