mirror of
https://github.com/YunoHost-Apps/pelican_ynh.git
synced 2024-09-03 19:46:35 +02:00
[fix] patch bugs
This commit is contained in:
parent
aeba5e1511
commit
a2f37b8e27
7 changed files with 253 additions and 70 deletions
|
@ -7,8 +7,9 @@
|
||||||
admin="john" (USER)
|
admin="john" (USER)
|
||||||
language="fr"
|
language="fr"
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
password="pass"
|
author="john"
|
||||||
port="666" (PORT)
|
password="pass"
|
||||||
|
port="666" (PORT)
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=1
|
port_already_use=0
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
|
@ -37,4 +38,4 @@
|
||||||
Level 10=0
|
Level 10=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
|
|
|
@ -6,16 +6,16 @@
|
||||||
"en": "Pelican Static Site Generator",
|
"en": "Pelican Static Site Generator",
|
||||||
"fr": "Pelican, un générateur de blog statique"
|
"fr": "Pelican, un générateur de blog statique"
|
||||||
},
|
},
|
||||||
"version": "3.7.1",
|
"version": "1.0",
|
||||||
"url": "https://thegoldenkoala.com",
|
"url": "https://thegoldenkoala.com",
|
||||||
"license": "GPLv3",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Ylies Chahi",
|
"name": "Ylies Chahi",
|
||||||
"email": "ylieschahi@gmail.com",
|
"email": "ylieschahi@gmail.com",
|
||||||
"url": "http://thegoldenkoala.com"
|
"url": "http://thegoldenkoala.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.4"
|
"yunohost": ">= 2.7.2"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -49,7 +49,8 @@
|
||||||
"en": "Choose an author",
|
"en": "Choose an author",
|
||||||
"fr": "Choisissez l'auteur"
|
"fr": "Choisissez l'auteur"
|
||||||
},
|
},
|
||||||
"example": "johndoe"
|
"example": "johndoe",
|
||||||
|
"default": "John Doe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "title",
|
"name": "title",
|
||||||
|
|
|
@ -1,20 +1,56 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat access to unset variables as an error
|
|
||||||
set -eu
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Source YNH helpers
|
# Source YNH helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
||||||
|
|
||||||
# Copy the app source files
|
---------
|
||||||
ynh_backup "/var/www/$app" "www"
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD BACKUP STEPS
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup "$final_path"
|
||||||
|
|
||||||
# Copy the conf files
|
# Copy the conf files
|
||||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
|
@ -1,19 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Source app helpers and functions
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
#=================================================
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=$YNH_APP_ARG_PATH
|
path=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
author=$YNH_APP_ARG_AUTHOR
|
author=$YNH_APP_ARG_AUTHOR
|
||||||
title=$YNH_APP_ARG_TITLE
|
title=$YNH_APP_ARG_TITLE
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#force location to be / or /foo
|
#force location to be / or /foo
|
||||||
location=${path:-/}
|
location=${path:-/}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,77 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -u
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Source app helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# STOP AND REMOVE SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the dedicated systemd config
|
||||||
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE FROM ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if yunohost service status | grep -q $app
|
||||||
|
then
|
||||||
|
echo "Remove $app service"
|
||||||
|
yunohost service remove $app
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the app directory securely
|
||||||
|
ynh_secure_remove "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the dedicated nginx config
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CLOSE A PORT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
|
then
|
||||||
|
echo "Close port $port"
|
||||||
|
yunohost firewall disallow TCP $port 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
# Delete app directory and configurations
|
# Delete app directory and configurations
|
||||||
sudo rm -rf "/var/www/"${app:-preventunsetvariable}
|
#sudo rm -rf "/var/www/"${app:-preventunsetvariable}
|
||||||
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
#[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
sudo service nginx reload || true
|
#sudo service nginx reload || true
|
||||||
|
|
|
@ -1,45 +1,72 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat access to unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Source app helpers and functions
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
||||||
|
|
||||||
# is_public is now a boolean field
|
# is_public is now a boolean field
|
||||||
if [ "$is_public" = "Yes" ];
|
if [ "$is_public" = "Yes" ];
|
||||||
then
|
then
|
||||||
is_public=1
|
is_public=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check domain/path availability
|
#=================================================
|
||||||
sudo yunohost app checkurl $domain$path -a $app \
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|| ynh_die "The path ${domain}${path} is not available for app installation."
|
#=================================================
|
||||||
|
|
||||||
# Check destination directory
|
ynh_webpath_available $domain $path_url \
|
||||||
DESTDIR="/var/www/$app"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
[[ -d $DESTDIR ]] && ynh_die \
|
test ! -d $final_path \
|
||||||
"The destination directory '$DESTDIR' already exists.\
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
You should safely delete it before restoring this app."
|
|
||||||
|
|
||||||
# Check configuration files
|
#=================================================
|
||||||
NGINX_CONF="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
# STANDARD RESTORATION STEPS
|
||||||
[[ -f $NGINX_CONF ]] && ynh_die \
|
#=================================================
|
||||||
"The NGINX configuration already exists at '${NGINX_CONF}'.
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
You should safely delete it before restoring this app."
|
#=================================================
|
||||||
|
|
||||||
# Restore the app files
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
sudo cp -a ./www "$DESTDIR"
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R root: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
yunohost service add $app --log "/var/log/$app/APP.log"
|
||||||
|
|
||||||
# Restore configuration files
|
|
||||||
sudo cp -a ./conf/nginx.conf "$NGINX_CONF"
|
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
[[ $is_public -eq 1 ]] \
|
[[ $is_public -eq 1 ]] \
|
||||||
|
@ -47,5 +74,10 @@ sudo cp -a ./conf/nginx.conf "$NGINX_CONF"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
#=================================================
|
||||||
sudo service nginx reload
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX AND PHP-FPM
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
|
@ -1,25 +1,64 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Source app helpers and functions
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
||||||
author=$(ynh_app_setting_get "$app" author)
|
|
||||||
title=$(ynh_app_setting_get "$app" title)
|
|
||||||
|
|
||||||
# is_public is now a boolean field
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
if [ "$is_public" = "Yes" ];
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
then
|
admin=$(ynh_app_setting_get $app admin)
|
||||||
is_public=1
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
author=$(ynh_app_setting_get $app author)
|
||||||
|
title=$(ynh_app_setting_get $app title)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Fix is_public as a boolean value
|
||||||
|
if [ "$is_public" = "Yes" ]; then
|
||||||
|
ynh_app_setting_set $app is_public 1
|
||||||
|
is_public=1
|
||||||
|
elif [ "$is_public" = "No" ]; then
|
||||||
|
ynh_app_setting_set $app is_public 0
|
||||||
|
is_public=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If final_path doesn't exist, create it
|
||||||
|
if [ -z $final_path ]; then
|
||||||
|
final_path=/var/www/$app
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
#force location to be / or /foo
|
#force location to be / or /foo
|
||||||
location=${path:-/}
|
location=${path:-/}
|
||||||
|
|
||||||
|
@ -51,6 +90,6 @@ sudo chown -hR www-data:www-data $document_root
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
[[ $is_public -eq 1 ]] \
|
[[ $is_public -eq 1 ]] \
|
||||||
&& ynh_app_setting_set "$app" unprotected_uris "/"
|
&& ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
Loading…
Add table
Reference in a new issue