2016-10-25 00:00:01 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
|
set -eu
|
|
|
|
|
|
2016-10-25 23:34:42 +02:00
|
|
|
|
# Load common variables and functions
|
|
|
|
|
source ./_common.sh
|
2016-10-25 00:00:01 +02:00
|
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
|
|
|
|
path=$YNH_APP_ARG_PATH
|
|
|
|
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
|
|
|
|
|
|
|
|
# Check domain/path availability
|
|
|
|
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
|
|
|
|
|| ynh_die "Path not available: ${domain}${path}"
|
|
|
|
|
|
2016-10-26 00:28:51 +02:00
|
|
|
|
if ! [ "$path" = "/" ]
|
|
|
|
|
then
|
|
|
|
|
ynh_die "Path must be /"
|
|
|
|
|
fi
|
|
|
|
|
|
2016-10-25 23:34:42 +02:00
|
|
|
|
# Save app settings
|
|
|
|
|
ynh_app_setting_set "$app" is_public "$is_public"
|
2016-10-25 00:00:01 +02:00
|
|
|
|
|
|
|
|
|
# Install the app
|
2016-10-25 23:34:42 +02:00
|
|
|
|
install_haste $domain $path $is_public
|
2016-10-25 00:00:01 +02:00
|
|
|
|
|
|
|
|
|
# Start Haste
|
|
|
|
|
sudo systemctl start "$app".service
|
|
|
|
|
|
|
|
|
|
# Add Haste to YunoHost's monitored services
|
|
|
|
|
sudo yunohost service add "$app" --log /var/log/"$app"/"$app".log
|