1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/h5ai_ynh.git synced 2024-09-03 20:36:25 +02:00

First Commit

This commit is contained in:
inrepublica 2016-06-02 16:10:37 +02:00
parent 952a0b0e33
commit dc6718b90c
6 changed files with 161 additions and 0 deletions

9
LICENSE Normal file
View file

@ -0,0 +1,9 @@
The MIT License (MIT)
Copyright (c) 2016 Lars Jung (https://larsjung.de)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# H5AI for Yunohost
H5AI 0.27.0 for [Yunohost](http://yunohost.org/). Works with Debian 8 and YunoHost 2.4.0.6.
# Installation
You can install this package by going through the administration web interface by choosing "Install custom app", or using the moulinette:
`yunohost app install https://github.com/inrepublica/h5ai_ynh`
# Configuration

23
conf/nginx.conf Normal file
View file

@ -0,0 +1,23 @@
location YNH_WWW_PATH {
# Path to source
alias YNH_WWW_ALIAS ;
# Example PHP configuration
index index.php /YNH_WWW_PATH/public/index.php;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

46
manifest.json Normal file
View file

@ -0,0 +1,46 @@
{
"name": "H5AI",
"id": "h5ai",
"packaging_format": 1,
"description": {
"en": "A modern HTTP web server index for Nginx.",
"fr": "Un serveur moderne d'index pour Nginx."
},
"url": "https://larsjung.de/h5ai/",
"license": "free",
"maintainer": {
"name": "inrepublica",
"email": "duvalmickael@gmail.com"
},
"requirements": {
"yunohost": ">= 2.4.0.6"
},
"multi_instance": false,
"services": [
"nginx",
"php5-fpm"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for H5AI",
"fr": "Choisissez un domaine pour H5AI"
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for H5AI",
"fr": "Choisissez un chemin pour H5AI"
},
"example": "/_h5ai",
"default": "/_h5ai"
}
]
}
}

54
scripts/install Normal file
View file

@ -0,0 +1,54 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# Define app
app=h5ai
version=0.28.1
md5_source=d99b2d43102e23f52eb0c645a5a3b3dc
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Save app settings
ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" path "$path"
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
# Download source, check md5, untar, copy it
sudo wget -q https://release.larsjung.de/h5ai/h5ai-$version.zip -O /tmp/h5ai.zip
# Check md5
md5_check=($(md5sum /tmp/hai.zip))
if [ $md5_source != $md5_check ]
then
ynh_die "the download is corrupted (md5 different)"
fi
# unzip and copy it
sudo unzip -o /tmp/h5ai.zip -d /tmp/
final_path=/var/www/$path
sudo mkdir -p $final_path
sudo cp -a /tmp/_h5ai/. $final_path
# Set permissions to phpsysinfo directory
sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set "$app" unprotected_uris "/"
# Restart services
sudo service nginx reload

20
scripts/remove Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# Define app
app=h5ai
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
# Remove sources
sudo rm -rf /var/www/$path
# Remove configuration files
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
# Restart services
sudo service nginx reload