diff --git a/scripts/backup b/scripts/backup index f237759..4693a0b 100755 --- a/scripts/backup +++ b/scripts/backup @@ -43,7 +43,7 @@ ynh_backup --src_path="/etc/sudoers.d/$app" # BACKUP THE IMPORTER PLUGIN POST APP INSTALL HOOK #================================================= -ynh_backup --src_path="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh" +ynh_backup --src_path="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 95e2405..4d93d24 100755 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,7 @@ ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chown -R $app:www-data $install_dir +chown -R ${app}:www-data $install_dir chmod -R u=rwX,g=rX,o-rwx $install_dir #================================================= @@ -92,6 +92,8 @@ ynh_setup_source --dest_dir="$install_dir/tools/yunohost" --source_id="yunohostp # Add config at the end of wakka.config.php ynh_replace_string --match_string=");" --replace_string=" 'dataSources' => [\n'yunohost-cli' => [\n'formId' => '5', // form id used in local bazar\n'lang' => 'fr',\n'importer' => 'YunohostCLIApp', // importer class name (without Importer suffix)\n],\n],\n);" --target_file="$install_dir/wakka.config.php" +SSO_DOMAIN=$(yunohost domain main-domain | sed -e 's/.*: //') +ynh_replace_string --match_string=");" --replace_string=" 'yunohost_sso_domain' => '${SSO_DOMAIN}',\n);" --target_file="$install_dir/wakka.config.php" # Ensure that scripts are executable chmod +x $install_dir/tools/yunohost/private/scripts/*.sh @@ -101,9 +103,10 @@ ynh_add_config --template="sudoers" --destination="/etc/sudoers.d/$app" chown root:root /etc/sudoers.d/$app # Add a post app install hook to sync the app importer -ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh" -chown root:root /etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh -chmod +x /etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh +mkdir -p /etc/yunohost/hooks.d/post_app_install +ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +chown root:root /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh +chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh # At last, run the YunoHost app importer ynh_script_progression --message="Import YunoHost apps in bazar" --weight=2 @@ -144,7 +147,7 @@ fi # SECURE FILES AND DIRECTORIES #================================================= -chown -R $app:www-data $install_dir +chown -R ${app}:www-data $install_dir chmod -R u=rwX,g=rX,o-rwx $install_dir chmod g-rwx $install_dir/wakka.config.php diff --git a/scripts/remove b/scripts/remove index dce13b4..db4d6eb 100755 --- a/scripts/remove +++ b/scripts/remove @@ -24,7 +24,7 @@ ynh_remove_fpm_config ynh_secure_remove --file="/etc/sudoers/$app" # Remove post app install hook -ynh_secure_remove --file="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh" +ynh_secure_remove --file="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 87d2b2d..d50e58d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -47,7 +47,7 @@ ynh_restore_file --origin_path="/etc/sudoers.d/$app" #================================================= ynh_script_progression --message="Restoring the app importer post app install hook..." -ynh_restore_file --origin_path="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh" +ynh_restore_file --origin_path="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" #================================================= # RESTORE THE MYSQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 6c1a048..9ff7715 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,7 +35,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R ${app}:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION @@ -81,9 +81,10 @@ ynh_add_config --template="sudoers" --destination="/etc/sudoers.d/$app" chown root:root /etc/sudoers.d/$app # Add a post app install hook to sync the app importer -ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh" -chown root:root /etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh -chmod +x /etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh +mkdir -p /etc/yunohost/hooks.d/post_app_install +ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +chown root:root /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh +chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh # ToDo : Add importer config in wakka.config.php if it is not already there ? # if [ ??? ]; then @@ -100,7 +101,7 @@ popd # SECURE FILES AND DIRECTORIES #================================================= -chown -R $app:www-data $install_dir +chown -R ${app}:www-data $install_dir chmod -R u=rwX,g=rX,o-rwx $install_dir chmod g-rwx $install_dir/wakka.config.php