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:
parent
b8848c0308
commit
f4ba74d60e
6 changed files with 72 additions and 51 deletions
|
@ -2,6 +2,9 @@
|
||||||
"name": "Strut",
|
"name": "Strut",
|
||||||
"id": "strut",
|
"id": "strut",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">= 2.4.0"
|
||||||
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Strut is a slide editor creating impress.js presentations.",
|
"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."
|
"fr": "Strut est un éditeur de slide permetant de créer des présentation impress.js."
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The parameter $1 is the backup directory location dedicated to the app
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
BACKUP_DIR=$1
|
set -e
|
||||||
|
|
||||||
# The parameter $2 is theid of the app instance ex: strut__2
|
# Source YNH helpers
|
||||||
APP=$2
|
. /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
|
# Copy the app files
|
||||||
final_path=/var/www/$APP
|
ynh_backup "/var/www/$app" "sources"
|
||||||
sudo cp -a $final_path "${BACKUP_DIR}/www"
|
|
||||||
|
|
||||||
# Copy the conf files
|
# Copy the conf files
|
||||||
sudo mkdir -p "${BACKUP_DIR}/conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
|
||||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$APP.conf "${BACKUP_DIR}/conf/nginx.conf"
|
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
APP='strut'
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
# Retrieve arguments
|
set -e
|
||||||
domain=$1
|
|
||||||
path=$2
|
|
||||||
public_site=$3
|
|
||||||
|
|
||||||
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
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a $APP
|
sudo yunohost app checkurl $domain$path -a $app
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/var/www/$APP
|
final_path=/var/www/$app
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo cp -a ../sources/* $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
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sed -i "s@ALIASTOCHANGE@$final_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
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app setting $APP skipped_uris -v "/"
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
if [ "$public_site" = "No" ];
|
if [ "$public_site" = "No" ];
|
||||||
then
|
then
|
||||||
sudo yunohost app setting $APP protected_uris -v "/index.html,/scripts"
|
sudo yunohost app setting $app protected_uris -v "/index.html,/scripts"
|
||||||
fi
|
fi
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
domain=$(sudo yunohost app setting strut domain)
|
# Get app instance name
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
sudo rm -rf /var/www/strut
|
# Retrieve arguments
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/strut.conf
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
|
||||||
|
sudo rm -rf /var/www/$app
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
|
@ -1,47 +1,50 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The parameter $1 is the backup directory location dedicated to the app
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
BACKUP_DIR=$1
|
set -e
|
||||||
|
|
||||||
# The parameter $2 is the id of the app instance ex: strut__2
|
# Source YNH helpers
|
||||||
APP=$2
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
domain=$(sudo yunohost app setting $APP domain)
|
# Get app instance name
|
||||||
path=$(sudo yunohost app setting $APP path)
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
public_site=$(sudo yunohost app setting $APP public_site)
|
|
||||||
|
# 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
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a $APP
|
sudo yunohost app checkurl $domain$path -a $app
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
echo "There is already an app on this URL : $domain$path" | sudo tee /dev/stderr
|
echo "There is already an app on this URL : $domain$path" | sudo tee /dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore the app files
|
# Restore the app files
|
||||||
final_path=/var/www/$APP
|
final_path=/var/www/$app
|
||||||
|
|
||||||
if [ -d $final_path ]; then
|
if [ -d $final_path ]; then
|
||||||
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
|
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sudo cp -a "${BACKUP_DIR}/www" $final_path
|
sudo cp -a "sources" $final_path
|
||||||
sudo chown -R www-data: $final_path
|
sudo chown -R www-data: $final_path
|
||||||
|
|
||||||
# Restore the conf files
|
# 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
|
if [ -f $conf ]; then
|
||||||
echo "There is already a nginx conf file at this path: $conf " | sudo tee /dev/stderr
|
echo "There is already a nginx conf file at this path: $conf " | sudo tee /dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sudo cp -a "${BACKUP_DIR}/conf/nginx.conf" $conf
|
sudo cp -a "conf/nginx.conf" $conf
|
||||||
|
|
||||||
# Reload Nginx
|
# Reload Nginx
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
||||||
# Set ssowat config
|
# Set ssowat config
|
||||||
sudo yunohost app setting $APP skipped_uris -v "/"
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
if [ "$public_site" = "No" ];
|
if [ "$public_site" = "No" ];
|
||||||
then
|
then
|
||||||
sudo yunohost app setting $APP protected_uris -v "/index.html,/scripts"
|
sudo yunohost app setting $app protected_uris -v "/index.html,/scripts"
|
||||||
fi
|
fi
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
#!/bin/bash
|
#!/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
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting $APP domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
path=$(sudo yunohost app setting $APP path)
|
path=$(sudo yunohost app setting $app path)
|
||||||
public_site=$(sudo yunohost app setting $APP public_site)
|
public_site=$(sudo yunohost app setting $app public_site)
|
||||||
|
|
||||||
|
|
||||||
### Execute potential SQL statements here
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/var/www/$APP
|
final_path=/var/www/$app
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo cp -a ../sources/* $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@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
||||||
sed -i "s@ALIASTOCHANGE@$final_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
|
# Reload Nginx
|
||||||
sudo service nginx reload
|
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" ];
|
if [ "$public_site" = "No" ];
|
||||||
then
|
then
|
||||||
sudo yunohost app setting $APP protected_uris -v "/index.html,/scripts"
|
sudo yunohost app setting $app protected_uris -v "/index.html,/scripts"
|
||||||
fi
|
fi
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Add table
Reference in a new issue