1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/airsonic_ynh.git synced 2024-09-03 18:06:14 +02:00

Do not use psql (broken with the last version)

This commit is contained in:
Kay0u 2019-05-22 23:13:09 +02:00
parent 993e26e48b
commit a2cb2e4111
No known key found for this signature in database
GPG key ID: ABC3F52576D011D3
8 changed files with 37 additions and 73 deletions

View file

@ -7,11 +7,3 @@ LdapSearchFilter=(uid={0})
#LdapManagerPassword= #LdapManagerPassword=
# Automatically create users comming from Yunohost in Airsonic # Automatically create users comming from Yunohost in Airsonic
LdapAutoShadowing=true LdapAutoShadowing=true
DatabaseConfigType=embed
DatabaseConfigEmbedDriver=org.postgresql.Driver
DatabaseConfigEmbedUrl=jdbc:postgresql://127.0.0.1:5432/airsonic?stringtype=unspecified
DatabaseConfigEmbedUsername=__DB_NAME__
DatabaseConfigEmbedPassword=__DB_PASSWORD__
DatabaseUsertableQuote="
DatabaseMysqlMaxlength=512

View file

@ -5,7 +5,7 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="openjdk-8-jre ffmpeg postgresql-9.6 postgresql-client-9.6 libpostgresql-jdbc-java" pkg_dependencies="openjdk-8-jre ffmpeg"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -29,7 +29,6 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
@ -54,13 +53,6 @@ ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE POSTRESQL DATABASE
#=================================================
ynh_script_progression --message="Backing up the PostgreSQL database..." --weight=1
ynh_psql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================

View file

@ -30,11 +30,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
# Add settings here as needed by your application
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================

View file

@ -71,20 +71,6 @@ ynh_script_progression --message="Installing dependencies..." --weight=43
# See https://airsonic.github.io/docs/install/prerequisites/ # See https://airsonic.github.io/docs/install/prerequisites/
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
# Create postgresql database
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
# Initialize database and store postgres password for upgrade
ynh_psql_setup_db --db_name=$db_name --db_user=$db_user
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) # Password created in ynh_psql_setup_db function
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -149,9 +135,6 @@ ynh_add_systemd_config
cp ../conf/airsonic.properties $final_path/airsonic.properties cp ../conf/airsonic.properties $final_path/airsonic.properties
ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$final_path/airsonic.properties"
ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string=$db_pwd --target_file="$final_path/airsonic.properties"
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================

View file

@ -18,10 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -44,14 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE THE POSTRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================

View file

@ -30,8 +30,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -84,13 +82,24 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=43
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE POSTRESQL DATABASE # ENABLE "TRANSCODE"
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) ### For details, see https://airsonic.github.io/docs/transcode/
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql mkdir $final_path/transcode
if [ -x /usr/bin/ffmpeg ]; then # Check if 'ffmpeg' is installed and executable
ln -s /usr/bin/ffmpeg $final_path/transcode
fi
# FIXME Not sure if 'lame' is needed ?
if [ -x /usr/bin/lame ]; then # Check if 'lame' is installed and executable
ln -s /usr/bin/lame $final_path/transcode
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD

View file

@ -21,8 +21,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
@ -45,17 +43,6 @@ elif [ "$is_public" = "No" ]; then
is_public=0 is_public=0
fi fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
# Create postgresql database
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
# Initialize database and store postgres password for upgrade
ynh_psql_setup_db --db_name=$db_name --db_user=$db_user
fi
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
final_path=/opt/yunohost/$app final_path=/opt/yunohost/$app
@ -124,6 +111,26 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#=================================================
# ENABLE "TRANSCODE"
#=================================================
### For details, see https://airsonic.github.io/docs/transcode/
mkdir $final_path/transcode
if [ -x /usr/bin/ffmpeg ]; then # Check if 'ffmpeg' is installed and executable
ln -s /usr/bin/ffmpeg $final_path/transcode
fi
# FIXME Not sure if 'lame' is needed ?
if [ -x /usr/bin/lame ]; then # Check if 'lame' is installed and executable
ln -s /usr/bin/lame $final_path/transcode
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================
@ -132,9 +139,6 @@ ynh_backup_if_checksum_is_different --file="$final_path/airsonic.properties"
cp ../conf/airsonic.properties $final_path/airsonic.properties cp ../conf/airsonic.properties $final_path/airsonic.properties
ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$final_path/airsonic.properties"
ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string=$db_pwd --target_file="$final_path/airsonic.properties"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/airsonic.properties" ynh_store_file_checksum --file="$final_path/airsonic.properties"