1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/strut_ynh.git synced 2024-09-03 20:26:33 +02:00

[enh] Update every script according to 2.4.0 release

This commit is contained in:
opi 2016-05-14 13:57:42 +02:00
parent b8848c0308
commit f4ba74d60e
6 changed files with 72 additions and 51 deletions

View file

@ -2,6 +2,9 @@
"name": "Strut",
"id": "strut",
"packaging_format": 1,
"requirements": {
"yunohost": ">= 2.4.0"
},
"description": {
"en": "Strut is a slide editor creating impress.js presentations.",
"fr": "Strut est un éditeur de slide permetant de créer des présentation impress.js."

View file

@ -1,18 +1,21 @@
#!/bin/bash
# The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# The parameter $2 is theid of the app instance ex: strut__2
APP=$2
# Source YNH helpers
. /usr/share/yunohost/helpers
domain=$(sudo yunohost app setting $APP domain)
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
public_site=$(sudo yunohost app setting $app public_site)
# Copy the app files
final_path=/var/www/$APP
sudo cp -a $final_path "${BACKUP_DIR}/www"
ynh_backup "/var/www/$app" "sources"
# Copy the conf files
sudo mkdir -p "${BACKUP_DIR}/conf"
sudo cp -a /etc/nginx/conf.d/$domain.d/$APP.conf "${BACKUP_DIR}/conf/nginx.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"

View file

@ -1,22 +1,27 @@
#!/bin/bash
APP='strut'
# Retrieve arguments
domain=$1
path=$2
public_site=$3
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
sudo yunohost app setting $APP public_site -v $public_site
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH
public_site=$YNH_APP_ARG_PUBLIC_SITE
sudo yunohost app setting $app public_site -v $public_site
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $APP
sudo yunohost app checkurl $domain$path -a $app
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Copy files to the right place
final_path=/var/www/$APP
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
@ -27,12 +32,12 @@ sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$APP.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app setting $APP skipped_uris -v "/"
sudo yunohost app setting $app skipped_uris -v "/"
if [ "$public_site" = "No" ];
then
sudo yunohost app setting $APP protected_uris -v "/index.html,/scripts"
sudo yunohost app setting $app protected_uris -v "/index.html,/scripts"
fi
sudo yunohost app ssowatconf

View file

@ -1,6 +1,10 @@
#!/bin/bash
domain=$(sudo yunohost app setting strut domain)
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
sudo rm -rf /var/www/strut
sudo rm -f /etc/nginx/conf.d/$domain.d/strut.conf
# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
sudo rm -rf /var/www/$app
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf

View file

@ -1,47 +1,50 @@
#!/bin/bash
# The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# The parameter $2 is the id of the app instance ex: strut__2
APP=$2
# Source YNH helpers
. /usr/share/yunohost/helpers
domain=$(sudo yunohost app setting $APP domain)
path=$(sudo yunohost app setting $APP path)
public_site=$(sudo yunohost app setting $APP public_site)
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
public_site=$(sudo yunohost app setting $app public_site)
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $APP
sudo yunohost app checkurl $domain$path -a $app
if [[ ! $? -eq 0 ]]; then
echo "There is already an app on this URL : $domain$path" | sudo tee /dev/stderr
exit 1
fi
# Restore the app files
final_path=/var/www/$APP
final_path=/var/www/$app
if [ -d $final_path ]; then
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
exit 1
fi
sudo cp -a "${BACKUP_DIR}/www" $final_path
sudo cp -a "sources" $final_path
sudo chown -R www-data: $final_path
# Restore the conf files
conf=/etc/nginx/conf.d/$domain.d/$APP.conf
conf=/etc/nginx/conf.d/$domain.d/$app.conf
if [ -f $conf ]; then
echo "There is already a nginx conf file at this path: $conf " | sudo tee /dev/stderr
exit 1
fi
sudo cp -a "${BACKUP_DIR}/conf/nginx.conf" $conf
sudo cp -a "conf/nginx.conf" $conf
# Reload Nginx
sudo service nginx reload
# Set ssowat config
sudo yunohost app setting $APP skipped_uris -v "/"
sudo yunohost app setting $app skipped_uris -v "/"
if [ "$public_site" = "No" ];
then
sudo yunohost app setting $APP protected_uris -v "/index.html,/scripts"
sudo yunohost app setting $app protected_uris -v "/index.html,/scripts"
fi
sudo yunohost app ssowatconf

View file

@ -1,16 +1,18 @@
#!/bin/bash
APP='strut'
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $APP domain)
path=$(sudo yunohost app setting $APP path)
public_site=$(sudo yunohost app setting $APP public_site)
### Execute potential SQL statements here
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
public_site=$(sudo yunohost app setting $app public_site)
# Copy files to the right place
final_path=/var/www/$APP
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
@ -21,14 +23,15 @@ sudo chown -R www-data: $final_path
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$APP.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Reload Nginx
sudo service nginx reload
sudo yunohost app setting $APP skipped_uris -v "/"
# SSO configuration
sudo yunohost app setting $app skipped_uris -v "/"
if [ "$public_site" = "No" ];
then
sudo yunohost app setting $APP protected_uris -v "/index.html,/scripts"
sudo yunohost app setting $app protected_uris -v "/index.html,/scripts"
fi
sudo yunohost app ssowatconf