'local result=$(cmd)' resets $? to 0 (the local builtin's own exit), so the
following checkSuccess always saw success regardless of cmd's real exit — the
mechanism that masked the de-sudo write failures. Split declaration from
assignment ('local result; result=$(cmd)') across all 235 active-code sites
(84 files) so the command's exit reaches checkSuccess. No behaviour change
beyond $? now being accurate (no set -e in runtime code; multi-line
assignments transform safely).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
36 lines
1.2 KiB
Bash
Executable File
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; result=$(runInstallOp touch $docker_dir/$db_file)
|
|
checkSuccess "Creating SQLite $db_file file"
|
|
|
|
local result; result=$(runInstallOp chmod 755 $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
|
|
}
|