1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monica_ynh.git synced 2024-09-03 19:46:23 +02:00

Updated to 2.3.1 and added change_url

This commit is contained in:
anmol26s 2018-06-25 12:11:44 +05:30
parent 8e9beb5a14
commit 5346bdf26f
7 changed files with 106 additions and 5 deletions

View file

@ -4,7 +4,7 @@
[![Installer Monica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=monica)
**Shipped version: v2.3.0**
Shipped version: **v2.3.1**
<p align="center"><img src="37693034-5783b3d6-2c93-11e8-80ea-bd78438dcd51.png"></p>
<h1 align="center">Personal Relationship Manager</h1>
@ -36,6 +36,7 @@ Monica is an open-source web application to organize the interactions with your
* [X] Backup and restore script (**Need testing**)
* [X] Multi-instance (**Need testing**)
* [x] make root domain redirect to index.php
* [x] Chang URL (Need testing,backup before trying this)
* [ ] LDAP/SSO support
* [ ] Make monica installable into subdirectory (eg. https://example.com/monica/)
* Currently it is only possible to install monica into the root of a domain (eg. https://example.com/)

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://github.com/monicahq/monica/archive/v2.3.0.zip
SOURCE_SUM=aed382d467aacaa31fde88d4cceae622a78f3e8f6a00f6db27977b41fbad0576
SOURCE_URL=https://github.com/monicahq/monica/archive/v2.3.1.zip
SOURCE_SUM=d18a2ad59937d5a053727336a03402557a774c148060f060cf45f6c686596b90
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=v2.3.0.zip
SOURCE_FILENAME=v2.3.1.zip

View file

@ -7,7 +7,7 @@
},
"url": "https://monica.com",
"license": "GPL-3.0",
"version": "2.3.0",
"version": "2.3.1",
"maintainer": {
"name": "Sebastian Gumprich",
"email": "yunohost@gumpri.ch",

94
scripts/change_url Normal file
View file

@ -0,0 +1,94 @@
#!/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="/"
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# 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"
# Replace locations starting with old_path
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path"
# Replace path in "return" directives
ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path"
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
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
#=================================================
# Run monica update
cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx

View file

@ -176,3 +176,5 @@ fi
#=================================================
systemctl reload php7.1-fpm
systemctl reload nginx
# Set default php to php7.0
update-alternatives --set php /usr/bin/php7.0

View file

@ -115,3 +115,5 @@ ynh_restore_file "/etc/cron.d/$app"
systemctl reload php7.1-fpm
systemctl reload nginx
# Set default php to php7.0
update-alternatives --set php /usr/bin/php7.0

View file

@ -147,3 +147,5 @@ fi
#=================================================
systemctl reload nginx
# Set default php to php7.0
update-alternatives --set php /usr/bin/php7.0