mirror of
https://github.com/YunoHost-Apps/jappix_ynh.git
synced 2024-09-03 19:26:19 +02:00
[enh] Update scripts for YunoHost changes in multi-instances apps
This commit is contained in:
parent
0adbd1b203
commit
56f37e362e
6 changed files with 80 additions and 66 deletions
|
@ -11,7 +11,10 @@
|
|||
"name": "titoko",
|
||||
"email": "titoko@titoko.fr"
|
||||
},
|
||||
"multi_instance": "true",
|
||||
"multi_instance": true,
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.3.14"
|
||||
},
|
||||
"services": [
|
||||
"nginx",
|
||||
"php5-fpm",
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#!/bin/bash
|
||||
app=jappix
|
||||
|
||||
# The parameter $1 is the backup directory location
|
||||
# which will be compressed afterward
|
||||
backup_dir=$1/apps/$app
|
||||
mkdir -p $backup_dir
|
||||
app=${!#}
|
||||
|
||||
# Backup sources & data
|
||||
sudo cp -a /var/www/$app/. $backup_dir/sources
|
||||
# Retrieve arguments
|
||||
backup_dir=$1
|
||||
|
||||
# Copy Nginx and YunoHost parameters to make the script "standalone"
|
||||
sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf
|
||||
# Retrieve app settings
|
||||
domain=$(sudo yunohost app setting "$app" domain)
|
||||
|
||||
# Save sources & data
|
||||
sudo cp -a "/var/www/${app}" ./sources
|
||||
|
||||
# Copy NGINX configuration
|
||||
sudo cp -a "/etc/nginx/conf.d/${domain}.d/${app}.conf" ./nginx.conf
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
source ./_common.sh
|
||||
|
||||
app=${!#}
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
|
@ -9,7 +13,7 @@ name=$3
|
|||
language=$4
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a jappix
|
||||
sudo yunohost app checkurl "${domain}${path}" -a "$app"
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -21,16 +25,16 @@ path=${path%/}
|
|||
wget -nv -O jappix.tar.gz https://github.com/jappix/jappix/archive/${VERSION}.tar.gz
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/jappix
|
||||
sudo mkdir -p $final_path
|
||||
sudo tar -C $final_path -xf jappix.tar.gz --strip-components 1
|
||||
sudo cp ../conf/*.xml $final_path/store/conf/
|
||||
final_path="/var/www/${app}"
|
||||
sudo mkdir -p "${final_path}/store/conf"
|
||||
sudo tar -C "$final_path" -xf jappix.tar.gz --strip-components 1
|
||||
sudo cp ../conf/*.xml "${final_path}/store/conf/"
|
||||
|
||||
# Set permissions to jappix directory
|
||||
sudo chown -R www-data: $final_path
|
||||
sudo chown -R www-data: "$final_path"
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sudo sed -i "s@PATHTOCHANGE2@$path@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@PATHTOCHANGE2@${path}@g" ../conf/nginx.conf
|
||||
|
||||
if [ -z "$path" ]; then
|
||||
path="/"
|
||||
|
@ -42,19 +46,18 @@ then
|
|||
language="en"
|
||||
fi
|
||||
|
||||
sudo yunohost app setting jappix name -v $name
|
||||
sudo yunohost app setting jappix language -v $language
|
||||
sudo yunohost app setting "$app" name -v "$name"
|
||||
sudo yunohost app setting "$app" language -v "$language"
|
||||
|
||||
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jappix.conf
|
||||
sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/store/conf/hosts.xml
|
||||
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@CHANGELANG@$language@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@CHANGENAME@$name@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/store/conf/hosts.xml
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml"
|
||||
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
# Reload services
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#!/bin/bash
|
||||
domain=$(sudo yunohost app setting jappix domain)
|
||||
|
||||
sudo rm -rf /var/www/jappix
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/jappix.conf
|
||||
app=${!#}
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting "$app" domain)
|
||||
|
||||
# Remove sources and configuration
|
||||
sudo rm -rf "/var/www/${app}"
|
||||
sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
|
||||
# Reload services
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
#!/bin/bash
|
||||
app=jappix
|
||||
|
||||
# The parameter $1 is the uncompressed restore directory location
|
||||
backup_dir=$1/apps/$app
|
||||
app=${!#}
|
||||
|
||||
# Retrieve arguments
|
||||
backup_dir=$1
|
||||
|
||||
# Retrieve old app settings
|
||||
domain=$(sudo yunohost app setting "$app" domain)
|
||||
|
||||
# Restore sources & data
|
||||
sudo cp -a $backup_dir/sources/. /var/www/$app
|
||||
sudo cp -a ./sources "/var/www/${app}"
|
||||
|
||||
# Restore Nginx and YunoHost parameters
|
||||
sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
|
||||
# Restart webserver
|
||||
sudo service nginx reload
|
||||
# Reload services
|
||||
sudo service nginx reload
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
source ./_common.sh
|
||||
|
||||
app=${!#}
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting jappix domain)
|
||||
path=$(sudo yunohost app setting jappix path)
|
||||
name=$(sudo yunohost app setting jappix name)
|
||||
language=$(sudo yunohost app setting jappix language)
|
||||
domain=$(sudo yunohost app setting "$app" domain)
|
||||
path=$(sudo yunohost app setting "$app" path)
|
||||
name=$(sudo yunohost app setting "$app" name)
|
||||
language=$(sudo yunohost app setting "$app" language)
|
||||
|
||||
if [[ "$name" = "" ]];
|
||||
then
|
||||
|
@ -24,31 +26,30 @@ path=${path%/}
|
|||
wget -nv -O jappix.tar.gz https://github.com/jappix/jappix/archive/${VERSION}.tar.gz
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/jappix
|
||||
sudo mkdir -p $final_path
|
||||
sudo tar -C $final_path -xf jappix.tar.gz --strip-components 1
|
||||
sudo cp ../conf/*.xml $final_path/store/conf/
|
||||
final_path="/var/www/${app}"
|
||||
sudo mkdir -p "$final_path"
|
||||
sudo tar -C "$final_path" -xf jappix.tar.gz --strip-components 1
|
||||
sudo cp ../conf/*.xml "${final_path}/store/conf/"
|
||||
|
||||
# Set permissions to jappix directory
|
||||
sudo chown -R www-data: $final_path
|
||||
sudo chown -R www-data: "$final_path"
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sudo sed -i "s@PATHTOCHANGE2@$path@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@PATHTOCHANGE2@${path}@g" ../conf/nginx.conf
|
||||
|
||||
if [ -z "$path" ]; then
|
||||
path="/"
|
||||
fi
|
||||
|
||||
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jappix.conf
|
||||
sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/store/conf/hosts.xml
|
||||
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@CHANGELANG@$language@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@CHANGENAME@$name@g" $final_path/store/conf/main.xml
|
||||
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/store/conf/hosts.xml
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml"
|
||||
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml"
|
||||
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
# Reload services
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
Loading…
Reference in a new issue