snikket_ynh/scripts/_common.sh

48 lines
1.6 KiB
Bash
Raw Normal View History

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
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/*
}
### 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"
}
2024-05-18 15:16:58 +00:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================