47 lines
1.6 KiB
Bash
47 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# COMMON VARIABLES
|
|
#=================================================
|
|
|
|
if [[ $(lsb_release --codename --short) == "bookworm" ]]; then
|
|
luaversion="5.4"
|
|
else
|
|
luaversion="5.2"
|
|
fi
|
|
|
|
#=================================================
|
|
# PERSONAL HELPERS
|
|
#=================================================
|
|
|
|
install_certificates() {
|
|
domains=("$domain" "groups.$domain" "share.$domain")
|
|
for d in "${domains[@]}"
|
|
do
|
|
error_message="No certificate found for domain $d! Please set up the domain and install a Let's Encrypt certificate for it."
|
|
cp "/etc/yunohost/certs/$d/crt.pem" "/etc/snikket/certs/${d}.crt" || ynh_print_warn --message="$error_message"
|
|
cp "/etc/yunohost/certs/$d/key.pem" "/etc/snikket/certs/${d}.key" || ynh_print_warn --message="$error_message"
|
|
done
|
|
chown $app /etc/snikket/certs/*
|
|
}
|
|
|
|
### Add Nginx configuration for other domains. This is necessary because at the moment Snikket requires two additional
|
|
### subdomains to function fully. Does not reload Nginx configuration.
|
|
### Usage: add_extra_nginx_config <subdomain>
|
|
add_extra_nginx_config() {
|
|
local extra_subdomain="$1"
|
|
local extra_domain=$extra_subdomain.$domain
|
|
local finalnginxconf="/etc/nginx/conf.d/$extra_domain.d/$app.conf"
|
|
|
|
ynh_add_config --template="nginx.$extra_subdomain.conf" --destination="$finalnginxconf"
|
|
|
|
ynh_store_file_checksum --file="$finalnginxconf"
|
|
}
|
|
|
|
#=================================================
|
|
# EXPERIMENTAL HELPERS
|
|
#=================================================
|
|
|
|
#=================================================
|
|
# FUTURE OFFICIAL HELPERS
|
|
#=================================================
|