diff --git a/check_process b/check_process index cc4dd1e..a75b382 100644 --- a/check_process +++ b/check_process @@ -22,7 +22,7 @@ Level 1=auto Level 2=auto Level 3=auto - Level 4=auto + Level 4=1 Level 5=auto Level 6=auto Level 7=auto diff --git a/manifest.json b/manifest.json index 7c90b4c..7676a98 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "version": "1.0", "url": "http://ampache.org", "packaging_format": 1, - "license": "free", + "license": "AGPL-3.0", "maintainer": { "name": "aymhce", "email": "aymhce@gmail.com" diff --git a/scripts/_common.sh b/scripts/_common.sh index 72d52a6..f5e2ec1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -21,14 +21,14 @@ ampache_ynh_prepareconfig () { # Ampache installation ampache_ynh_install () { - ORIPATH=$(pwd) - cd $final_path - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php composer.phar install --prefer-source --no-interaction - # Set permissions to ampache directory - chown -R www-data: $final_path - cd $ORIPATH + ( + cd $final_path + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + php composer-setup.php + php composer.phar install --prefer-source --no-interaction + # Set permissions to ampache directory + chown -R www-data: $final_path + ) } # Regenerate SSOwat conf diff --git a/scripts/backup b/scripts/backup index 45acfa8..6c2ac8d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ set -eu # IMPORT GENERIC HELPERS #================================================= -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE diff --git a/scripts/install b/scripts/install index abaae6d..cf95a50 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -set -eu - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= @@ -17,8 +15,8 @@ admin_ampache=$YNH_APP_ARG_ADMIN #================================================= # Source helpers -. /usr/share/yunohost/helpers -. _common.sh +source _common.sh +source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE @@ -53,12 +51,9 @@ cp ../conf/admin.sql /tmp/ # CREATE A MYSQL DATABASE #================================================= -# Generate random password -db_pwd=$(ynh_string_random 24) - # Initialize database and store mysql password for upgrade -ynh_app_setting_set $app mysqlpwd $db_pwd -ynh_mysql_setup_db "$app" "$app" "$db_pwd" +ynh_mysql_setup_db "$app" "$app" +db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql" #================================================= @@ -69,8 +64,7 @@ ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql" ampache_ynh_prepareconfig ynh_replace_string "yunoadmin" "$admin_ampache" /tmp/admin.sql -random_key=db_pwd=$(ynh_string_random 24) -ynh_replace_string "RANDOMKEYTOCHANGE" "$random_key" $final_path/config/ampache.cfg.php +ynh_replace_string "RANDOMKEYTOCHANGE" $(ynh_string_random 24) $final_path/config/ampache.cfg.php #================================================= # NGINX CONFIGURATION @@ -112,5 +106,4 @@ ynh_mysql_connect_as "$app" "$db_pwd" "$app" < /tmp/admin.sql #================================================= # Clean install -ynh_secure_remove ../ampache-$version ynh_secure_remove /tmp/admin.sql diff --git a/scripts/remove b/scripts/remove index fecd4f6..b4578a9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,12 +1,10 @@ #!/bin/bash -set -u - #================================================= # IMPORT GENERIC HELPERS #================================================= -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS diff --git a/scripts/restore b/scripts/restore index 898357a..0162a1c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,12 +6,7 @@ set -eu # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -. _common.sh -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE @@ -38,6 +33,16 @@ final_path=/var/www/$app test ! -d $final_path \ || ynh_die "There is already a directory: $final_path" +#================================================= +# IMPORT GENERIC HELPERS AFTER YNH_DIE FOR LINTER +#================================================= + +if [ ! -e _common.sh ]; then + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh +fi +source _common.sh + #================================================= # CHECK THE PATH #================================================= @@ -71,4 +76,3 @@ systemctl reload nginx db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $app $app $db_pwd ynh_mysql_connect_as $app $db_pwd $app < ./db.sql - diff --git a/scripts/upgrade b/scripts/upgrade index 549b666..4c064b3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,13 +1,11 @@ #!/bin/bash -set -eu - #================================================= # IMPORT GENERIC HELPERS #================================================= -. /usr/share/yunohost/helpers -. _common.sh +source _common.sh +source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE