Initial commit

The website is done in English.
There are some placeholder things for nl and fr as well, but the language header on the en page is commented out
There are no links in the README.md to the actual repo, only mentions to it

I wanted everything set up and done before changing those things
This commit is contained in:
ilja
2020-02-28 08:15:58 +01:00
commit d4e96a4c0b
12 changed files with 514 additions and 0 deletions

2
scripts/_common.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/bash

87
scripts/install Normal file
View File

@@ -0,0 +1,87 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
source _common.sh
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH_URL
app=$YNH_APP_INSTANCE_NAME
app_user=$app
#==================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#==================================================
www_path=/var/www/$app
if [[ -e $www_path ]]
then
ynh_die "The path $www_path already contains a folder"
fi
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Trim trailing slashes
path_url=$(sed 's@*/$@@' <<< $path_url)
# Check web path availability
if ! ynh_webpath_available $domain $path_url
then
ynh_die "$domain$path_url is not available"
fi
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS
#=================================================
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path_url $path_url
ynh_app_setting_set $app app_user $app_user
ynh_app_setting_set $app www_path $www_path
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Creating app's user…"
mkdir -p $www_path
ynh_system_user_create $app_user $www_path
#=================================================
# INSTALL STATIC FILE
#=================================================
ynh_print_info "Installing static site…"
cp -a ../sources/. $www_path
chown -R $app_user: $www_path
sed -i "s@PATHTOCHANGE@$path_url@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$www_path@g" ../conf/nginx.conf
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
nginx -tq
service nginx reload

41
scripts/remove Normal file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
source _common.sh
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path_url)
app_user=$(ynh_app_setting_get $app app_user)
www_path=$(ynh_app_setting_get $app www_path)
#=================================================
# STANDARD REMOVE
#=================================================
ynh_print_info "Removing static site..."
rm -rf $www_path
rm -f /etc/nginx/conf.d/$domain.d/$app.conf
nginx -t > /dev/null
service nginx reload
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing system user..."
ynh_system_user_delete $app_user

50
scripts/upgrade Normal file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
source _common.sh
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path_url)
app_user=$(ynh_app_setting_get $app app_user)
www_path=$(ynh_app_setting_get $app www_path)
#=================================================
# ACTIVE TRAP
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# REINSTALL STATIC FILES
#=================================================
ynh_print_info "Installing static site..."
rm -rf $www_path
mkdir -p $www_path
cp -r ../sources/. $www_path
chown -R $app_user: $www_path
sed -i "s@PATHTOCHANGE@$path_url@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$www_path@g" ../conf/nginx.conf
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
nginx -tq
service nginx reload