This commit is contained in:
Alexandre
2022-02-18 13:48:38 +01:00
parent 06b78d3573
commit 1670c9c431
4 changed files with 26 additions and 19 deletions

View File

@@ -31,14 +31,14 @@ if [ ! -d /config ]; then
fi
chown -R abc:abc /config
if [ ! -d $MEDIADIR ]; then
if [ ! -d "$MEDIADIR" ]; then
echo "Creating $MEDIADIR"
mkdir -p $MEDIADIR
mkdir -p "$MEDIADIR"
fi
chown -R abc:abc $MEDIADIR
chown -R abc:abc "$MEDIADIR"
if [ ! -d $IMPORTDIR ]; then
if [ ! -d "$IMPORTDIR" ]; then
echo "Creating $IMPORTDIR"
mkdir -p $IMPORTDIR
mkdir -p "$IMPORTDIR"
fi
chown -R abc:abc $IMPORTDIR
chown -R abc:abc "$IMPORTDIR"

View File

@@ -42,7 +42,7 @@ mariadb_addon)
bashio::log.warning "Please ensure this is included in your backups"
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
mysql --host=$(bashio::services 'mysql' 'host') --port=$(bashio::services 'mysql' 'port') --user=$PHOTOPRISM_DATABASE_USER --password=$PHOTOPRISM_DATABASE_PASSWORD -e"CREATE DATABASE IF NOT EXISTS $PHOTOPRISM_DATABASE_NAME; CHARACTER SET = utf8mb4; COLLATE = utf8mb4_unicode_ci;" || true
mysql --host="$(bashio::services 'mysql' 'host')" --port="$(bashio::services 'mysql' 'port')" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"CREATE DATABASE IF NOT EXISTS $PHOTOPRISM_DATABASE_NAME; CHARACTER SET = utf8mb4; COLLATE = utf8mb4_unicode_ci;" || true
;;
esac
@@ -51,23 +51,28 @@ esac
##############
# Configure app
export PHOTOPRISM_UPLOAD_NSFW=$(bashio::config 'UPLOAD_NSFW')
export PHOTOPRISM_STORAGE_PATH=$(bashio::config 'STORAGE_PATH')
export PHOTOPRISM_ORIGINALS_PATH=$(bashio::config 'ORIGINALS_PATH')
export PHOTOPRISM_IMPORT_PATH=$(bashio::config 'IMPORT_PATH')
export PHOTOPRISM_BACKUP_PATH=$(bashio::config 'BACKUP_PATH')
PHOTOPRISM_UPLOAD_NSFW=$(bashio::config 'UPLOAD_NSFW')
PHOTOPRISM_STORAGE_PATH=$(bashio::config 'STORAGE_PATH')
PHOTOPRISM_ORIGINALS_PATH=$(bashio::config 'ORIGINALS_PATH')
PHOTOPRISM_IMPORT_PATH=$(bashio::config 'IMPORT_PATH')
PHOTOPRISM_BACKUP_PATH=$(bashio::config 'BACKUP_PATH')
export PHOTOPRISM_UPLOAD_NSFW
export PHOTOPRISM_STORAGE_PATH
export PHOTOPRISM_ORIGINALS_PATH
export PHOTOPRISM_IMPORT_PATH
export PHOTOPRISM_BACKUP_PATH
# Test configs
for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do
# Check if path exists
if bashio::fs.directory_exists $variabletest; then
if bashio::fs.directory_exists "$variabletest"; then
true
else
bashio::log.info "Path $variabletest doesn't exist. Creating it now..."
mkdir -p $variabletest || bashio::log.fatal "Can't create $variabletest path"
mkdir -p "$variabletest" || bashio::log.fatal "Can't create $variabletest path"
fi
# Check if path writable
touch $variabletest/aze && rm $variabletest/aze || bashio::log.fatal "$variable path is not writable"
touch "$variabletest"/aze && rm "$variabletest"/aze || bashio::log.fatal "$variabletest path is not writable"
done
# Start messages

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bashio
# shellcheck shell=bash
# shellcheck disable=SC2155,SC2015
###########
# SCRIPTS #
@@ -35,14 +36,14 @@ fi
# Test configs
for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do
# Check if path exists
if bashio::fs.directory_exists $variabletest; then
if bashio::fs.directory_exists "$variabletest"; then
true
else
bashio::log.info "Path $variabletest doesn't exist. Creating it now..."
mkdir -p $variabletest || bashio::log.fatal "Can't create $variabletest path"
mkdir -p "$variabletest" || bashio::log.fatal "Can't create $variabletest path"
fi
# Check if path writable
touch $variabletest/aze && rm $variabletest/aze || bashio::log.fatal "$variable path is not writable"
touch "$variabletest"/aze && rm "$variabletest"/aze || bashio::log.fatal "$variabletest path is not writable"
done
# Start messages
@@ -50,4 +51,4 @@ bashio::log.info "Please wait 1 or 2 minutes to allow the server to load"
bashio::log.info 'Default username : admin, default password: "please_change_password"'
cd /
./entrypoint.sh photoprism start '"'$CUSTOMOPTIONS'"'
./entrypoint.sh photoprism start '"'"$CUSTOMOPTIONS"'"'

View File

@@ -40,4 +40,5 @@ fi
##################
# CORRECT CONFIG #
##################
# shellcheck disable=SC2015
sed -i 's|E_ALL|""|g' /share/piwigo/config/config.inc.php && echo "config corrected for php error" || true