mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
Update Extensions install script
This commit is contained in:
parent
486298d659
commit
2708a37b6d
27 changed files with 65 additions and 41 deletions
|
@ -15,3 +15,23 @@ location __PATH__/ {
|
|||
|
||||
more_set_headers "Content-Security-Policy: frame-ancestors 'self' __ACCESS_DOMAIN__";
|
||||
}
|
||||
|
||||
location = __PATH__/extensions {
|
||||
return 301 https://$server_name__PATH__/extensions/repo.json;
|
||||
}
|
||||
|
||||
location = __PATH__/extensions/ {
|
||||
|
||||
return 301 https://$server_name__PATH__/extensions/repo.json;
|
||||
}
|
||||
|
||||
location __PATH__/extensions/ {
|
||||
alias __FINAL_PATH_EXTENSIONS__/;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
more_set_headers "Content-Security-Policy: frame-ancestors 'self' __ACCESS_DOMAIN__";
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,10 @@ mail="$app@$domain"
|
|||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
final_path=/opt/yunohost/$app
|
||||
final_path_www=/var/www/$app
|
||||
final_path_extensions="$final_path_www/extensions"
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
test ! -e "$final_path_www" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
@ -124,6 +127,25 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
# Extensions
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path_www
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path_extensions
|
||||
mkdir -p "$final_path_extensions"
|
||||
|
||||
if test -e "$YNH_APP_BASEDIR/sources/extra_files/extensions"; then
|
||||
cp --archive "$YNH_APP_BASEDIR/sources/extra_files/extensions/." "$final_path_extensions"
|
||||
fi
|
||||
|
||||
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||
do
|
||||
basename=$(basename -as .src $file)
|
||||
ynh_setup_source --dest_dir="$final_path_extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||
done
|
||||
|
||||
chmod 750 "$final_path_www"
|
||||
chmod -R o-rwx "$final_path_www"
|
||||
chown -R "www-data":"www-data" "$final_path_www"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -207,29 +229,24 @@ popd
|
|||
#=================================================
|
||||
# INSTALLING Standard Notes - Extensions
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
||||
#
|
||||
#
|
||||
#if [ $path_url = "/" ]
|
||||
#then
|
||||
# path=""
|
||||
#else
|
||||
# path=$path_url
|
||||
#fi
|
||||
#
|
||||
#ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
|
||||
#
|
||||
#find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
#do
|
||||
# ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
||||
#done
|
||||
#
|
||||
#find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||
#do
|
||||
#basename=$(basename -as .src $file)
|
||||
# ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||
#done
|
||||
#
|
||||
ynh_script_progression --message="Setup Standard Notes - Extensions..." --weight=1
|
||||
|
||||
|
||||
if [ $path_url = "/" ]
|
||||
then
|
||||
path=""
|
||||
else
|
||||
path=$path_url
|
||||
fi
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path_extensions/repo.json"
|
||||
|
||||
find "$final_path_extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
do
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
||||
done
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
@ -258,29 +275,14 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Securing files and directories..." --weight=1
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
#mkdir -p "$final_path/live/log"
|
||||
#chown -R $app: "$final_path/live/log/"
|
||||
#mkdir -p "$final_path/live/tmp"
|
||||
#chown -R $app: "$final_path/live/tmp/"
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app: "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R "$app": "/var/log/$app"
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
#ynh_use_logrotate --logfile="$final_path/live/log/production.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/syncing-server.log"
|
||||
|
|
|
@ -27,6 +27,7 @@ port_api_gateway=$(ynh_app_setting_get --app=$app --key=port_api_gateway)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_extensions)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -83,6 +84,7 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
|
|||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="$final_path_extensions"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
|
|
Loading…
Add table
Reference in a new issue