mirror of
https://github.com/YunoHost-Apps/jappix_ynh.git
synced 2024-09-03 19:26:19 +02:00
Fix
This commit is contained in:
parent
87d74410aa
commit
fb6df4167c
4 changed files with 30 additions and 69 deletions
|
@ -1,2 +1,7 @@
|
||||||
SOURCE_URL=https://github.com/jappix/jappix/archive/1.1.7.tar.gz
|
SOURCE_URL=https://jappix.org/jappix-1-2.zip
|
||||||
SOURCE_SUM=515b8079b42f280da9b624d8f9825109
|
SOURCE_SUM=0f47ee4c08360e1ff0830a7eda1deec07f60dba719df5ab599c974ca3d763bd5
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=zip
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
location PATHTOCHANGE {
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
alias ALIASTOCHANGE ;
|
location __PATH__/ {
|
||||||
|
|
||||||
|
# Path to source
|
||||||
|
alias __FINALPATH__/ ;
|
||||||
|
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
|
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
@ -19,10 +26,11 @@ location PATHTOCHANGE {
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
location PATHTOCHANGE/http-bind {
|
location __PATH__/http-bind {
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:5290/http-bind;
|
proxy_pass http://127.0.0.1:5290/http-bind;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
|
|
|
@ -1,58 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECKING
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
|
|
||||||
if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un /
|
|
||||||
path="/$path" # Ajoute un / en début de path
|
|
||||||
fi
|
|
||||||
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas le seul caractère.
|
|
||||||
path="${path:0:${#path}-1}" # Supprime le dernier caractère
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
|
|
||||||
sudo yunohost app checkurl $domain$path -a $app
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP
|
# SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_path
|
|
||||||
src_url=$(cat ../conf/app.src | grep SOURCE_URL | cut -d= -f2)
|
|
||||||
src_checksum=$(cat ../conf/app.src | grep SOURCE_SUM | cut -d= -f2)
|
|
||||||
# Download sources from the upstream
|
|
||||||
wget -nv -O source.tar.gz $src_url
|
|
||||||
# Vérifie la somme de contrôle de la source téléchargée.
|
|
||||||
echo "$src_checksum source.tar.gz" | md5sum -c --status || ynh_die "Corrupt source"
|
|
||||||
# Extract source into the app dir
|
|
||||||
sudo mkdir -p $final_path
|
|
||||||
sudo tar -x -f source.tar.gz -C $final_path --strip-components 1
|
|
||||||
# Copie les fichiers additionnels ou modifiés.
|
|
||||||
if test -e "../sources/ajouts"; then
|
|
||||||
sudo cp -a ../sources/ajouts/. "$final_path"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTUR YNH HELPERS
|
# FUTUR YNH HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script.
|
|
||||||
#
|
|
||||||
# Stop immediatly the execution if an error occured or if a empty variable is used.
|
|
||||||
# The execution of the script is derivate to ynh_exit_properly function before exit.
|
|
||||||
#
|
|
||||||
# Usage: ynh_check_error
|
|
||||||
ynh_check_error () {
|
|
||||||
set -eu # Exit if a command fail, and if a variable is used unset.
|
|
||||||
trap ynh_exit_properly EXIT # Capturing exit signals on shell script
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,14 +26,6 @@ language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Check domain/path availability
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
|
||||||
CHECK_DOMAINPATH
|
|
||||||
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -44,10 +36,13 @@ ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Copy files to the right place
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
|
||||||
mkdir -p "${final_path}/store/conf"
|
mkdir -p "${final_path}/store/conf"
|
||||||
cp ../conf/*.xml "${final_path}/store/conf/"
|
cp ../conf/*.xml "${final_path}/store/conf/"
|
||||||
|
@ -59,12 +54,14 @@ cp ../conf/*.xml "${final_path}/store/conf/"
|
||||||
chown -R www-data: "$final_path"
|
chown -R www-data: "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Set and copy NGINX configuraion
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring nginx web server..." --weight=1
|
||||||
|
|
||||||
sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
|
|
||||||
cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Validate language
|
# Validate language
|
||||||
|
@ -94,4 +91,3 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue