1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/immich_ynh.git synced 2024-09-03 20:36:24 +02:00

Merge pull request #96 from YunoHost-Apps/master-promotion
Some checks are pending
YunoHost apps package linter / test (push) Waiting to run
Create master promotion pull request / masterPromotion (push) Waiting to run

Upgrade master from testing
This commit is contained in:
ewilly 2024-08-28 19:16:36 +02:00 committed by GitHub
commit 98e722370e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 5 deletions

View file

@ -66,7 +66,7 @@ myynh_install_python() {
if $(dpkg --compare-versions $py_apt_version ge $python) if $(dpkg --compare-versions $py_apt_version ge $python)
then then
# APT >= Required # APT >= Required
ynh_print_info --message="Using provided python3..." ynh_print_info --message="Using OS provided python3..."
py_app_version="python3" py_app_version="python3"
@ -75,13 +75,13 @@ myynh_install_python() {
if $(dpkg --compare-versions $py_built_version ge $python) if $(dpkg --compare-versions $py_built_version ge $python)
then then
# Built >= Required # Built >= Required
ynh_print_info --message="Using already used python3 built version..."
py_app_version="/usr/local/bin/python${py_built_version%.*}" py_app_version="/usr/local/bin/python${py_built_version%.*}"
ynh_print_info --message="Using already python3 built version: $py_app_version"
else else
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin # APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
ynh_print_info --message="Building python (may take a while)..." ynh_print_info --message="Building python3 : $python (may take a while)..."
# Store current direcotry # Store current direcotry
local MY_DIR=$(pwd) local MY_DIR=$(pwd)
@ -115,6 +115,10 @@ myynh_install_python() {
fi fi
# Save python version in settings # Save python version in settings
ynh_app_setting_set --app=$app --key=python --value="$python" ynh_app_setting_set --app=$app --key=python --value="$python"
# Print some version information
ynh_print_info --message="Python version: $($py_app_version -VV)"
ynh_print_info --message="Pip version: $($py_app_version -m pip -V)"
} }
# Install immich # Install immich
@ -249,7 +253,8 @@ myynh_execute_psql_as_root() {
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
database="${database:-}" database="${database:-}"
if [ -n "$database" ]; then if [ -n "$database" ]
then
database="--dbname=$database" database="--dbname=$database"
fi fi
@ -265,6 +270,19 @@ myynh_create_psql_db() {
myynh_execute_psql_as_root --sql="ALTER USER $app WITH SUPERUSER;" --database="$app" myynh_execute_psql_as_root --sql="ALTER USER $app WITH SUPERUSER;" --database="$app"
} }
# Update the database
myynh_update_psql_db() {
for db in postgres "$app"
do
if ynh_exec_warn_less myynh_execute_psql_as_root --sql=";" --database="$db" \
| grep -q "collation version mismatch"
then
ynh_exec_warn_less myynh_execute_psql_as_root --sql="REINDEX DATABASE $db;" --database="$db"
myynh_execute_psql_as_root --sql="ALTER DATABASE $db REFRESH COLLATION VERSION;" --database="$db"
fi
done
}
# Remove the database # Remove the database
myynh_drop_psql_db() { myynh_drop_psql_db() {
myynh_execute_psql_as_root --sql="REVOKE CONNECT ON DATABASE $app FROM public;" myynh_execute_psql_as_root --sql="REVOKE CONNECT ON DATABASE $app FROM public;"

View file

@ -49,6 +49,13 @@ ynh_script_progression --message="Installing nodejs..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
#=================================================
# UPDATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Udpating a PostgreSQL database..." --weight=1
myynh_update_psql_db
#================================================= #=================================================
# MAKE INSTALL # MAKE INSTALL
#================================================= #=================================================