From ea16ab086f843f7d3a03f8756a48bfdfeeb634a9 Mon Sep 17 00:00:00 2001 From: matlink Date: Wed, 12 Nov 2014 22:22:53 +0100 Subject: [PATCH] all added for first test --- conf/nginx.conf | 17 +++++++++++++++ manifest.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ scripts/install | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/remove | 6 ++++++ 4 files changed, 132 insertions(+) create mode 100644 conf/nginx.conf create mode 100644 manifest.json create mode 100644 scripts/install create mode 100644 scripts/remove diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..90fe813 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,17 @@ +location YNH_EXAMPLE_PATH { + # Path to source + alias YNH_EXAMPLE_ALIAS ; + # Example PHP configuration + index 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; + } + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..1ec6969 --- /dev/null +++ b/manifest.json @@ -0,0 +1,55 @@ +{ + "name": "PluXml", + "id": "pluxml", + "description": { + "en": "A fast and light blog/CMS with XML", + "fr": "Blog ou CMS à l'Xml, rapide et léger" + }, + "developer": { + "name": "matlink", + "email": "matlink@matlink.fr", + "url": "" + }, + "multi_instance": "false", + "license": "GPL", + "arguments": { + "install" : [ + { + "name": "domain", + "ask": { + "en": "Choose a domain for pluxml", + "fr": "Choisissez un domaine pour pluxml" + }, + "example": "domain.org" + }, + { + "name": "path", + "ask": { + "en": "Choose a path for pluxml", + "fr": "Choisissez un chemin pour pluxml" + }, + "example": "/example", + "default": "/example" + }, + { + "name": "admin", + "ask": { + "en": "Choose an admin user for pluxml", + "fr": "Choisissez un administrateur pour pluxml" + }, + "example": "homer" + }, + { + "name": "public_site", + "ask": { + "en": "Should this application be public ?", + "fr": "Est-ce que cette application doit être visible publiquement ?" + }, + "choices": ["Yes", "No"], + "default": "No" + } + + + ] + } +} diff --git a/scripts/install b/scripts/install new file mode 100644 index 0000000..e1d260b --- /dev/null +++ b/scripts/install @@ -0,0 +1,54 @@ +#! /bin/bash + +app=pluxml + +#retrieve arguments +domain=$1 +path=$2 +admin=$3 +is_public=$4 + + +# Check domain/path availability +sudo yunohost app checkurl $domain$path -a $app +if [[ ! $? -eq 0 ]]; then +exit 1 +fi + +# Check user +sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" +if [[ ! $? -eq 0 ]]; then +echo "Wrong user" +exit 1 +fi + +# Save app settings +sudo yunohost app setting $app admin -v "$admin" +sudo yunohost app setting $app is_public -v "$is_public" + +#create path for copying +final_path=/var/www/$app +sudo mkdir -p $final_path + +#copy files to final folder and set permissions +sudo cp -R ../src/* $final_path/ +sudo chown www-data:www-data -R $final_path +sudo chmod 750 -R $final_path + +#configure nginx settings +sudo sed -i "s@YNH_EXAMPLE_PATH@$path@g" ../conf/nginx.conf +sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path/www/@g" ../conf/nginx.conf +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf + +# If app is public, add url to SSOWat conf as skipped_uris +if [ "$is_public" = "Yes" ]; +then +sudo yunohost app setting $app skipped_uris -v "/" +fi + +#adding admin to the allowed users +sudo yunohost app addaccess $app $admin + +# Restart services +sudo service nginx reload +sudo yunohost app ssowatconf \ No newline at end of file diff --git a/scripts/remove b/scripts/remove new file mode 100644 index 0000000..bc09885 --- /dev/null +++ b/scripts/remove @@ -0,0 +1,6 @@ +#! /bin/bash + +app=pluxml + +sudo rm -rf /var/www/$app +sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf