mirror of
https://github.com/YunoHost-Apps/dotclear2_ynh.git
synced 2024-09-03 18:26:29 +02:00
Put in _common.sh the setup_source trick
This commit is contained in:
parent
6a67686e13
commit
29e67a6cbb
3 changed files with 25 additions and 24 deletions
|
@ -8,6 +8,18 @@
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
_dotclear2_setup_source() {
|
||||||
|
# In case of a new version, the url change from http://download.dotclear.org/latest/dotclear-X.X.X.tar.gz to http://download.dotclear.org/attic/dotclear-X.X.X.tar.gz
|
||||||
|
|
||||||
|
src_url=$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq '.resources.sources.latest.url' -r)
|
||||||
|
|
||||||
|
if curl --output /dev/null --silent --head --fail "$src_url"; then
|
||||||
|
ynh_setup_source --dest_dir="$install_dir" --source_id="latest"
|
||||||
|
else
|
||||||
|
ynh_setup_source --dest_dir="$install_dir" --source_id="attic"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -14,13 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||||
|
|
||||||
# In case of a new version, the url change from http://download.dotclear.org/latest/dotclear-X.X.X.tar.gz to http://download.dotclear.org/attic/dotclear-X.X.X.tar.gz
|
_dotclear2_setup_source
|
||||||
src_url=$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq '.resources.sources.latest.url' -r)
|
|
||||||
if ! curl --output /dev/null --silent --head --fail "$src_url"; then
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --source_id="attic"
|
|
||||||
else
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --source_id="latest"
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
|
@ -134,7 +128,9 @@ ynh_local_curl $installUrl "u_email=$email" "u_firstname=$firstname" "u_name=$la
|
||||||
ynh_script_progression --message="Configuring Fail2Ban..."
|
ynh_script_progression --message="Configuring Fail2Ban..."
|
||||||
|
|
||||||
# Create a dedicated Fail2Ban config
|
# Create a dedicated Fail2Ban config
|
||||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Invalid credentials in $install_dir/inc/class.auth.ldap.php .* client: <HOST>, .*https://$domain${path%/}/admin/auth.php"
|
ynh_add_fail2ban_config \
|
||||||
|
--logpath="/var/log/nginx/${domain}-error.log" \
|
||||||
|
--failregex="Invalid credentials in $install_dir/inc/class.auth.ldap.php .* client: <HOST>, .*https://$domain${path%/}/admin/auth.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -23,14 +23,14 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
if [ -z "${blog_admin:-}" ] ||
|
if [ -z "${blog_admin:-}" ] ||
|
||||||
[ -z "$blog_contentadmin" ] ||
|
[ -z "$blog_contentadmin" ] ||
|
||||||
[ -z "$blog_usage" ] ||
|
[ -z "$blog_usage" ] ||
|
||||||
[ -z "$blog_publish" ] ||
|
[ -z "$blog_publish" ] ||
|
||||||
[ -z "$blog_delete" ] ||
|
[ -z "$blog_delete" ] ||
|
||||||
[ -z "$blog_categories" ] ||
|
[ -z "$blog_categories" ] ||
|
||||||
[ -z "$blog_media_admin" ] ||
|
[ -z "$blog_media_admin" ] ||
|
||||||
[ -z "$blog_media" ] ||
|
[ -z "$blog_media" ] ||
|
||||||
[ -z "$blog_pages" ] ||
|
[ -z "$blog_pages" ] ||
|
||||||
[ -z "$blog_blogroll" ]; then
|
[ -z "$blog_blogroll" ]; then
|
||||||
blog_admin="false"
|
blog_admin="false"
|
||||||
blog_contentadmin="false"
|
blog_contentadmin="false"
|
||||||
|
@ -62,14 +62,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
_dotclear2_setup_source
|
||||||
# In case of a new version, the url change from http://download.dotclear.org/latest/dotclear-X.X.X.tar.gz to http://download.dotclear.org/attic/dotclear-X.X.X.tar.gz
|
|
||||||
src_url=$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq '.resources.sources.latest.url' -r)
|
|
||||||
if ! curl --output /dev/null --silent --head --fail "$src_url"; then
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --source_id="attic"
|
|
||||||
else
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --source_id="latest"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
|
|
Loading…
Add table
Reference in a new issue