mirror of
https://github.com/YunoHost-Apps/shaarli_ynh.git
synced 2024-09-03 20:26:10 +02:00
Added dependencies and updated change_url
This commit is contained in:
parent
01cce20693
commit
cb6c6a1232
6 changed files with 48 additions and 28 deletions
|
@ -27,7 +27,8 @@
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
# Level 4:
|
# Level 4:
|
||||||
Level 4=0
|
# Not implimented by upstream
|
||||||
|
Level 4=na
|
||||||
# Level 5:
|
# Level 5:
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
Level 6=auto
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"url": "https://github.com/shaarli/Shaarli",
|
"url": "https://github.com/shaarli/Shaarli",
|
||||||
"license": "free",
|
"license": "free",
|
||||||
"version": "0.10.2",
|
"version": "0.10.2",
|
||||||
"multi_instance": "true",
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm"
|
"php5-fpm"
|
||||||
|
|
|
@ -21,6 +21,17 @@ new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
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
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -30,6 +41,7 @@ test -n "$new_path" || new_path="/"
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
new_path=$(ynh_normalize_url_path $new_path)
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
old_path=$(ynh_normalize_url_path $old_path)
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -59,13 +71,11 @@ if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original nginx config file if modified
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
||||||
# Replace locations starting with old_path
|
# Set global variables for nginx helper
|
||||||
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
|
domain="$old_domain"
|
||||||
ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path"
|
path_url="$new_path"
|
||||||
# Replace path in "return" directives
|
# Create a dedicated nginx config
|
||||||
ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path"
|
ynh_add_nginx_config
|
||||||
# Calculate and store the nginx config file checksum
|
|
||||||
ynh_store_file_checksum "$nginx_conf_path"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
|
@ -78,5 +88,16 @@ then
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# ...
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
|
@ -13,9 +13,14 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,9 +47,11 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
||||||
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
@ -57,14 +64,6 @@ ynh_webpath_available $domain $path_url
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check that the options are compatible
|
|
||||||
if [ $is_public = "Yes" ]; then
|
|
||||||
if [ $privateinstance = "Yes" ] ; then
|
|
||||||
ynh_die "Incompatible options: the instance cannot be both public and private" 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,7 +74,7 @@ ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
ynh_install_app_dependencies php-cli
|
ynh_install_app_dependencies 'php5-cli|php-cli' php-gettext 'php5-curl|php-curl' 'php-intl|php5-intl' php-gd 'php-mbstring|base-files(<<9.0)' openssl
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -83,7 +83,7 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies php-cli
|
ynh_install_app_dependencies 'php5-cli|php-cli' php-gettext 'php5-curl|php-curl' 'php-intl|php5-intl' php-gd 'php-mbstring|base-files(<<9.0)' openssl
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
@ -105,7 +105,6 @@ systemctl restart fail2ban
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload php5-fpm
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ sudo rm -Rf "$tmpdir"
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
ynh_install_app_dependencies php-cli
|
ynh_install_app_dependencies 'php5-cli|php-cli' php-gettext 'php5-curl|php-curl' 'php-intl|php5-intl' php-gd 'php-mbstring|base-files(<<9.0)' openssl
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
|
Loading…
Add table
Reference in a new issue