From 9a48af81e81771293b6001c79410d059656f0b46 Mon Sep 17 00:00:00 2001 From: Yalh Date: Sat, 26 Jan 2019 03:31:02 +0100 Subject: [PATCH] remove not needed files --- conf/app.src | 6 +++ conf/logrotate | 31 ------------ conf/systemd.service | 13 +++++ conf/z-push-deps.control | 16 ------ scripts/_common.sh | 13 +++++ scripts/change_url | 102 +++++++++++++++++++++++++++++++++++++++ sources/source_file | 1 - sources/source_md5 | 1 - sources/source_url | 1 - 9 files changed, 134 insertions(+), 50 deletions(-) create mode 100644 conf/app.src delete mode 100644 conf/logrotate create mode 100644 conf/systemd.service delete mode 100644 conf/z-push-deps.control create mode 100644 scripts/_common.sh create mode 100644 scripts/change_url delete mode 100644 sources/source_file delete mode 100644 sources/source_md5 delete mode 100644 sources/source_url diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..506e928 --- /dev/null +++ b/conf/app.src @@ -0,0 +1,6 @@ +SOURCE_URL=http://download.z-push.org/final/2.3/z-push-2.3.6.tar.gz +SOURCE_SUM=9f86e4f6d822558bffdf05bebce4f1157ed7d8784b52d488935ef6d02efc27d7 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= diff --git a/conf/logrotate b/conf/logrotate deleted file mode 100644 index 97da905..0000000 --- a/conf/logrotate +++ /dev/null @@ -1,31 +0,0 @@ - -LOGTOCHANGE/*.log { - -# Rotate if the logfile exceeds 100Mo - size 10M - -# From https://stash.z-hub.io/projects/ZP/repos/z-push/browse/config/z-push.lr - create www-data www-data - -# Keep 12 old log maximum - rotate 10 - -# Compress the logs with gzip - compress - -# Compress the log at the next cycle. So keep always 2 non compressed logs - delaycompress - -# Copy and truncate the log to allow to continue write on it. Instead of move the log. - copytruncate - -# Do not do an error if the log is missing - missingok - -# Not rotate if the log is empty - notifempty - -# Keep old logs in the same dir - noolddir - -} diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..76cdf64 --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Small description of the service +After=network.target + +[Service] +Type=simple +User=__APP__ +Group=__APP__ +WorkingDirectory=__FINALPATH__/ +ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 + +[Install] +WantedBy=multi-user.target diff --git a/conf/z-push-deps.control b/conf/z-push-deps.control deleted file mode 100644 index af76e6a..0000000 --- a/conf/z-push-deps.control +++ /dev/null @@ -1,16 +0,0 @@ -Section: misc -Priority: optional -Homepage: http://z-push.org/ -Standards-Version: 2.3.4 - -Package: z-push-deps -Version: 1.2-1 -Depends: php-soap, php5-imap, libawl-php, php5-xsl -Architecture: all -Description: meta package for z-push dependencies - Z-Push is an open-source application to synchronize - ActiveSync compatible devices such as mobile phones, - tablets and Outlook 2013 and above. - . - . - This meta-package is only responsible of installing its dependencies. diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..bb04a03 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# ============= FUTURE YUNOHOST HELPER ============= +# Delete a file checksum from the app settings +# +# $app should be defined when calling this helper +# +# usage: ynh_remove_file_checksum file +# | arg: file - The file for which the checksum will be deleted +ynh_delete_file_checksum () { + local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' + ynh_app_setting_delete $app $checksum_setting_name +} \ No newline at end of file diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..f71fc77 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,102 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get $app final_path) + +# Add settings here as needed by your application +#db_name=$(ynh_app_setting_get "$app" db_name) +#db_pwd=$(ynh_app_setting_get $app db_pwd) + +#================================================= +# CHECK THE SYNTAX OF THE PATHS +#================================================= + +test -n "$old_path" || old_path="/" +test -n "$new_path" || new_path="/" +new_path=$(ynh_normalize_url_path $new_path) +old_path=$(ynh_normalize_url_path $old_path) + +#================================================= +# CHECK WHICH PARTS SHOULD BE CHANGED +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the nginx config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different "$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + ynh_add_nginx_config +fi + +# Change the domain for nginx +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum "$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +# ... +#================================================= + +#================================================= +# GENERIC FINALISATION +#================================================= +# RELOAD NGINX +#================================================= + +systemctl reload nginx diff --git a/sources/source_file b/sources/source_file deleted file mode 100644 index fd8699c..0000000 --- a/sources/source_file +++ /dev/null @@ -1 +0,0 @@ -z-push-2.3.6 diff --git a/sources/source_md5 b/sources/source_md5 deleted file mode 100644 index 3e223bb..0000000 --- a/sources/source_md5 +++ /dev/null @@ -1 +0,0 @@ -36673351affcc83d1e98de8f8d606feb z-push-2.3.6.tar.gz diff --git a/sources/source_url b/sources/source_url deleted file mode 100644 index 9ff56e2..0000000 --- a/sources/source_url +++ /dev/null @@ -1 +0,0 @@ -http://download.z-push.org/final/2.3/z-push-2.3.6.tar.gz