test_apps/permissions_app_ynh/scripts/install

27 lines
848 B
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Stop script if errors
ynh_abort_if_errors
# Retrieve arguments
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
admin_user=$YNH_APP_ARG_ADMIN
# Check domain/path availability
ynh_webpath_available $domain $path_url || ynh_die "$domain$path_url is not available, please use an other domain or path."
ynh_webpath_register $app $domain $path_url
ynh_permission_create --permission "admin" --urls "$domain$path_url/admin"
ynh_permission_update --permission "admin" --add "$admin_user"
ynh_permission_create --permission "dev"
ynh_permission_urls --permission "dev" --add "$domain$path_url/dev"