mirror of
https://github.com/YunoHost-Apps/grav_ynh.git
synced 2024-09-03 19:16:01 +02:00
Merge pull request #64 from YunoHost-Apps/testing
Fix linter warnings and upgrade
This commit is contained in:
commit
2fc7ba721d
4 changed files with 33 additions and 83 deletions
|
@ -27,7 +27,7 @@
|
||||||
"email": "lithrel@randomdomainname.net"
|
"email": "lithrel@randomdomainname.net"
|
||||||
}],
|
}],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.0.7"
|
"yunohost": ">= 4.1.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -38,38 +38,22 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain name for Grav",
|
|
||||||
"fr": "Choisissez un nom de domaine pour Grav"
|
|
||||||
},
|
|
||||||
"example": "example.org"
|
"example": "example.org"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for Grav",
|
|
||||||
"fr": "Choisissez un chemin pour Grav"
|
|
||||||
},
|
|
||||||
"example": "/grav",
|
"example": "/grav",
|
||||||
"default": "/grav"
|
"default": "/grav"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
|
||||||
"en": "Choose the Grav administrator (must be an existing YunoHost user)",
|
|
||||||
"fr": "Administrateur du site (doit être un utilisateur YunoHost existant)"
|
|
||||||
},
|
|
||||||
"example": "johndoe"
|
"example": "johndoe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
|
||||||
"en": "Is it a public Grav site?",
|
|
||||||
"fr": "Est-ce un site public ?"
|
|
||||||
},
|
|
||||||
"help": {
|
"help": {
|
||||||
"en": "Will anyone be able to access the website?",
|
"en": "Will anyone be able to access the website?",
|
||||||
"fr": "Est-ce que quiconque pourra accéder au site ?"
|
"fr": "Est-ce que quiconque pourra accéder au site ?"
|
||||||
|
@ -79,10 +63,6 @@
|
||||||
{
|
{
|
||||||
"name": "language",
|
"name": "language",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
|
||||||
"en": "Choose the application language",
|
|
||||||
"fr": "Choisissez la langue de l'application"
|
|
||||||
},
|
|
||||||
"choices": ["en_EN", "fr_FR"],
|
"choices": ["en_EN", "fr_FR"],
|
||||||
"default": "fr_FR"
|
"default": "fr_FR"
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,28 +95,24 @@ ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_depen
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chown -R $app:www-data $final_path
|
chown -R $app:www-data "$final_path"
|
||||||
find $final_path -type f -exec chmod 664 {} \;
|
find "$final_path" -type f -exec chmod 640 {} \;
|
||||||
find $final_path/bin -type f -exec chmod 775 {} \;
|
find "$final_path/bin" -type f -exec chmod 750 {} \;
|
||||||
find $final_path -type d -exec chmod 775 {} \;
|
find "$final_path" -type d -exec chmod 750 {} \;
|
||||||
find $final_path -type d -exec chmod +s {} \;
|
find "$final_path" -type d -exec chmod +s {} \;
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL LDAP PLUGIN
|
# INSTALL LDAP PLUGIN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing and configuring LDAP plugin..." --weight=1
|
ynh_script_progression --message="Installing and configuring LDAP plugin..." --weight=1
|
||||||
|
|
||||||
pushd "$final_path"
|
exec_as $app php${YNH_PHP_VERSION} "$final_path/bin/gpm" install login-ldap --all-yes --no-interaction
|
||||||
exec_as $app php${YNH_PHP_VERSION} bin/gpm install login-ldap --all-yes --no-interaction
|
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
|
||||||
exec_as $app mkdir -p user/config/plugins/login-ldap
|
exec_as $app touch "$final_path/user/accounts/admin.yaml"
|
||||||
exec_as $app touch user/accounts/admin.yaml
|
|
||||||
popd
|
|
||||||
|
|
||||||
ynh_secure_remove "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
exec_as $app cp ../conf/login-ldap.yaml "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
chown $app:$app "$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
chmod 640 "$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
ynh_replace_string "__APP__" "$app" "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
|
||||||
exec_as $app cp "$final_path/user/plugins/login-ldap/login-ldap.yaml" "$final_path/user/config/plugins/login-ldap.yaml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A CRON TASK
|
# CREATE A CRON TASK
|
||||||
|
|
|
@ -73,11 +73,11 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chown -R $app:www-data $final_path
|
chown -R $app:www-data "$final_path"
|
||||||
find $final_path -type f -exec chmod 664 {} \;
|
find "$final_path" -type f -exec chmod 640 {} \;
|
||||||
find $final_path/bin -type f -exec chmod 775 {} \;
|
find "$final_path/bin" -type f -exec chmod 750 {} \;
|
||||||
find $final_path -type d -exec chmod 775 {} \;
|
find "$final_path" -type d -exec chmod 750 {} \;
|
||||||
find $final_path -type d -exec chmod +s {} \;
|
find "$final_path" -type d -exec chmod +s {} \;
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE CRON
|
# RESTORE THE CRON
|
||||||
|
|
|
@ -49,29 +49,9 @@ if [ -z "$final_path" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
if ynh_legacy_permissions_exists; then
|
||||||
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
if [ -n "$is_public" ]; then
|
|
||||||
# Removing skipped/unprotected_uris under certain conditions, remove the visitors group added during the migration process of 3.7
|
|
||||||
# Remove skipped_uris. If the app was public, add visitors again to the main permission
|
|
||||||
if ynh_permission_has_user --permission=main --user=visitors
|
|
||||||
then
|
|
||||||
# Remove unprotected_uris
|
|
||||||
ynh_app_setting_delete --app=$app --key=unprotected_uris
|
|
||||||
# Remove protected_uris
|
|
||||||
ynh_app_setting_delete --app=$app --key=protected_uris
|
|
||||||
# Remove skipped_uris
|
|
||||||
ynh_app_setting_delete --app=$app --key=skipped_uris
|
|
||||||
# Give visitors main permission
|
|
||||||
ynh_permission_update --permission "main" --add "visitors"
|
|
||||||
else
|
|
||||||
# Remove unprotected_uris
|
|
||||||
ynh_app_setting_delete --app=$app --key=unprotected_uris
|
|
||||||
# Remove protected_uris
|
|
||||||
ynh_app_setting_delete --app=$app --key=protected_uris
|
|
||||||
# Remove skipped_uris
|
|
||||||
ynh_app_setting_delete --app=$app --key=skipped_uris
|
|
||||||
fi
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -144,44 +124,38 @@ if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
||||||
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chown -R $app:www-data $final_path
|
chown -R $app:www-data "$final_path"
|
||||||
find $final_path -type f -exec chmod 664 {} \;
|
find "$final_path" -type f -exec chmod 640 {} \;
|
||||||
find $final_path/bin -type f -exec chmod 775 {} \;
|
find "$final_path/bin" -type f -exec chmod 750 {} \;
|
||||||
find $final_path -type d -exec chmod 775 {} \;
|
find "$final_path" -type d -exec chmod 750 {} \;
|
||||||
find $final_path -type d -exec chmod +s {} \;
|
find "$final_path" -type d -exec chmod +s {} \;
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE PLUGINS
|
# UPGRADE PLUGINS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating all plugins..." --weight=1
|
ynh_script_progression --message="Updating all plugins..." --weight=1
|
||||||
|
|
||||||
pushd "$final_path"
|
yes N | ynh_exec_warn_less exec_as $app php${YNH_PHP_VERSION} $final_path/bin/gpm update --all-yes --no-interaction
|
||||||
exec_as $app yes N | exec_as $app php${YNH_PHP_VERSION} bin/gpm update --all-yes --no-interaction
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL LDAP PLUGIN
|
# INSTALL LDAP PLUGIN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing and configuring LDAP plugin..." --weight=3
|
ynh_script_progression --message="Installing and configuring LDAP plugin..." --weight=3
|
||||||
|
|
||||||
pushd "$final_path"
|
exec_as $app php${YNH_PHP_VERSION} "$final_path/bin/gpm" install login-ldap --all-yes --no-interaction
|
||||||
exec_as $app php${YNH_PHP_VERSION} bin/gpm install login-ldap --all-yes --no-interaction
|
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
|
||||||
exec_as $app mkdir -p user/config/plugins/login-ldap
|
exec_as $app touch "$final_path/user/accounts/admin.yaml"
|
||||||
exec_as $app touch user/accounts/admin.yaml
|
|
||||||
popd
|
|
||||||
|
|
||||||
ynh_secure_remove "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
exec_as $app cp ../conf/login-ldap.yaml "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
chown $app:$app "$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
chmod 640 "$final_path/user/config/plugins/login-ldap.yaml"
|
||||||
ynh_replace_string "__APP__" "$app" "$final_path/user/plugins/login-ldap/login-ldap.yaml"
|
|
||||||
exec_as $app cp "$final_path/user/plugins/login-ldap/login-ldap.yaml" "$final_path/user/config/plugins/login-ldap.yaml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A CRON TASK
|
# CREATE A CRON TASK
|
||||||
|
|
Loading…
Reference in a new issue