diff --git a/conf/hash_password.php b/conf/hash_password.php deleted file mode 100644 index 5f47f69..0000000 --- a/conf/hash_password.php +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/manifest.toml b/manifest.toml index ee6f050..e3b3252 100644 --- a/manifest.toml +++ b/manifest.toml @@ -48,6 +48,9 @@ ram.runtime = "50M" [install.admin] type = "user" + [install.password] + type = "password" + [resources] [resources.sources] [resources.sources.ldap_plugin] diff --git a/scripts/install b/scripts/install index 790cf50..167b831 100644 --- a/scripts/install +++ b/scripts/install @@ -74,9 +74,6 @@ ynh_script_progression --message="Setuping application with CURL..." --weight=5 ynh_systemd_action --service_name=nginx --action=reload # Generate random password for admin -adm_pwd=$(ynh_string_random --length=24) -ynh_app_setting_set --app=$app --key=admin_pwd --value="$adm_pwd" - if [ "$language" = "fr" ]; then applanguage="fr_FR" else @@ -87,7 +84,7 @@ fi mail="$(ynh_user_get_info --username=$admin --key=mail)" # Installation with cURL -ynh_local_curl "/install.php?language=$applanguage" "install=true" "dbhost=127.0.0.1" "dbuser=$db_user" "dbpasswd=$db_pwd" "dbname=$db_name" "prefix=" "admin_name=$admin" "admin_pass1=$adm_pwd" "admin_pass2=$adm_pwd" "admin_mail=$mail" +ynh_local_curl "/install.php?language=$applanguage" "install=true" "dbhost=127.0.0.1" "dbuser=$db_user" "dbpasswd=$db_pwd" "dbname=$db_name" "prefix=" "admin_name=$admin" "admin_pass1=$password" "admin_pass2=$password" "admin_mail=$mail" #================================================= # CONFIGURE PIWIGO @@ -112,7 +109,7 @@ ynh_script_progression --message="Configuring LDAP plugin..." # Activate the LDAP plugin using the WS API # Login with admin account -ynh_local_curl "/ws.php?format=json" "method=pwg.session.login" "username=$admin" "password=$adm_pwd" +ynh_local_curl "/ws.php?format=json" "method=pwg.session.login" "username=$admin" "password=$password" # Get session token status=$(ynh_local_curl "/ws.php?format=json" "method=pwg.session.getStatus") pwg_token=$(jq --raw-output .result.pwg_token <<< $status) diff --git a/scripts/upgrade b/scripts/upgrade index b67ecd8..d009963 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,40 +15,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -# If fpm_footprint doesn't exist, create it -if [ -z "$fpm_footprint" ]; then - fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -fi - -# If fpm_free_footprint doesn't exist, create it -if [ -z "$fpm_free_footprint" ]; then - fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -fi - -# If fpm_usage doesn't exist, create it -if [ -z "$fpm_usage" ]; then - fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage -fi - -# Compatibility with previous version; password was not set -if [ -z "$admin_pwd" ] ; then - # Generate a new password - admin_pwd=$(ynh_string_random --length=24) - - # Compute password hash with the Piwigo function - cp ../conf/hash_password.php $install_dir - hashed_password=$(cd $install_dir ; php hash_password.php $admin_pwd) - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -127,7 +93,8 @@ else fi # Upgrade Piwigo via cURL -ynh_local_curl "/upgrade.php?language=$applanguage&now=true" "language=$applanguage" "username=$admin" "password=$admin_pwd" +# FIXME : Why Curl ... Why can't we trigger the migration from the command line somehow ... +#ynh_local_curl "/upgrade.php?language=$applanguage&now=true" "language=$applanguage" "username=$admin" "password=$admin_pwd" #================================================= # CONFIGURE PIWIGO @@ -155,7 +122,9 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< # Activate the LDAP plugin using the WS API # Login with admin account -ynh_local_curl "/ws.php?format=json" "method=pwg.session.login" "username=$admin" "password=$admin_pwd" + +# FIXME: Is this stuff really needed ... isn't there a way to enable the damn LDAP login plugin from the command line or something ... +#ynh_local_curl "/ws.php?format=json" "method=pwg.session.login" "username=$admin" "password=$admin_pwd" # Get session token status=$(ynh_local_curl "/ws.php?format=json" "method=pwg.session.getStatus") pwg_token=$(jq --raw-output .result.pwg_token <<< $status)