2024-05-18 15:16:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [[ $(lsb_release --codename --short) == "bookworm" ]]; then
|
|
|
|
luaversion="5.4"
|
|
|
|
else
|
|
|
|
luaversion="5.2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2024-05-26 22:08:46 +00:00
|
|
|
install_certificates() {
|
|
|
|
domains=("$domain" "groups.$domain" "share.$domain")
|
|
|
|
for d in "${domains[@]}"
|
|
|
|
do
|
2024-05-27 22:00:22 +00:00
|
|
|
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"
|
2024-05-26 22:08:46 +00:00
|
|
|
done
|
|
|
|
chown $app /etc/snikket/certs/*
|
|
|
|
}
|
|
|
|
|
2024-05-27 22:00:22 +00:00
|
|
|
### 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.
|
2024-06-11 23:03:02 +00:00
|
|
|
### Usage: add_extra_nginx_config <subdomain>
|
2024-05-27 22:00:22 +00:00
|
|
|
add_extra_nginx_config() {
|
2024-06-11 23:03:02 +00:00
|
|
|
local extra_subdomain="$1"
|
|
|
|
local extra_domain=$extra_subdomain.$domain
|
2024-05-27 22:00:22 +00:00
|
|
|
local finalnginxconf="/etc/nginx/conf.d/$extra_domain.d/$app.conf"
|
|
|
|
|
2024-06-11 23:03:02 +00:00
|
|
|
ynh_add_config --template="nginx.$extra_subdomain.conf" --destination="$finalnginxconf"
|
2024-05-27 22:00:22 +00:00
|
|
|
|
|
|
|
ynh_store_file_checksum --file="$finalnginxconf"
|
|
|
|
}
|
|
|
|
|
2024-05-18 15:16:58 +00:00
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|