first version
This commit is contained in:
3
conf/nginx.conf
Normal file
3
conf/nginx.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
location __PATH__/ {
|
||||
alias __FINALPATH__/;
|
||||
}
|
||||
65
manifest.json
Normal file
65
manifest.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "Zola website",
|
||||
"id": "zola_website",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Zola project installer for Yunohost",
|
||||
"fr": "Installateur de projet Zola pour Yunohost"
|
||||
},
|
||||
"version": "1.0~ynh1",
|
||||
"url": "https://git.landoftheunicorn.ovh/gogs/artus/zola_ynh",
|
||||
"license": "GPL-3.0",
|
||||
"maintainer": {
|
||||
"name": "Arthur G",
|
||||
"email": "artus@landoftheunicorn.ovh"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.4"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "project_url",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Url of your git project",
|
||||
"fr": "Url vers le dépôt git de votre projet"
|
||||
},
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose domain for the website",
|
||||
"fr": "Choississez le domain pour votre site"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose path for the website",
|
||||
"fr": "Choississez le chemin pour votre site"
|
||||
},
|
||||
"example": "/my-zola-website"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Should it be public ?",
|
||||
"fr": "Le site est-il public ?"
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
14
scripts/_zola
Normal file
14
scripts/_zola
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
function check_zola_is_present() {
|
||||
if zola --version >/dev/null 2>&1; then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
# function install_zola() {}
|
||||
|
||||
72
scripts/install
Normal file
72
scripts/install
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
# RETRIEVE ARGUMENTS
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
ynh_script_progression --message="Installing zola project : $app"
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
git_url=$YNH_APP_ARG_PROJECT_URL
|
||||
|
||||
|
||||
# PRE-INSTALLATION CHECKS
|
||||
|
||||
ynh_script_progression --message="Doing some checks"
|
||||
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_dir "This path already contains a folder"
|
||||
|
||||
ynh_webpath_available $domain $path_url
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
# STORE SETTINGS
|
||||
|
||||
ynh_script_progression --message="Going through with installation"
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path_url
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
ynh_app_setting_set $app git_url $git_url
|
||||
|
||||
# SETUP SSOWAT
|
||||
|
||||
if [ $is_public -eq 1 ]; then
|
||||
ynh_permission_update --permission "main" --add visitors
|
||||
fi
|
||||
|
||||
# BUILD PROJECT
|
||||
|
||||
ynh_script_progression --message="Build zola project"
|
||||
|
||||
echo $(pwd)
|
||||
(
|
||||
tmp_dir=/tmp/$app
|
||||
mkdir $tmp_dir && cd $tmp_dir
|
||||
git clone $git_url source
|
||||
cd source/
|
||||
zola build --base-url $path_url --output-dir $final_path
|
||||
rm -r $tmp_dir
|
||||
)
|
||||
echo $(pwd)
|
||||
|
||||
chmod 755 -R $final_path
|
||||
|
||||
# CONFIGURE NGINX
|
||||
|
||||
ynh_script_progression --message="Configure nginx"
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
10
scripts/remove
Normal file
10
scripts/remove
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
ynh_secure_remove "$final_path"
|
||||
ynh_remove_nginx_config
|
||||
Reference in New Issue
Block a user