mirror of
https://github.com/YunoHost-Apps/spip_ynh.git
synced 2024-09-03 20:25:59 +02:00
Update package
This commit is contained in:
parent
b1b0ea4299
commit
828fa2bdaf
3 changed files with 60 additions and 33 deletions
|
@ -1,23 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Retrieve arguments
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$1
|
|
||||||
path=$2
|
|
||||||
admin_spip=$3
|
|
||||||
|
|
||||||
# Check if admin exists
|
# Retrieve arguments
|
||||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin_spip\""
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
if [[ ! $? -eq 0 ]]; then
|
path=$YNH_APP_ARG_PATH
|
||||||
echo "Wrong admin"
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
exit 1
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
fi
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
sudo yunohost app setting spip admin -v $admin_spip
|
|
||||||
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
|
ynh_app_setting_set "$app" language "$language"
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a spip
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|| ynh_die "Path not available: ${domain}${path}"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate random DES key & password
|
# Generate random DES key & password
|
||||||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# See comments in install script
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve app settings
|
||||||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
|
||||||
db_user=spip
|
db_user=spip
|
||||||
db_name=spip
|
db_name=spip
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
domain=$(sudo yunohost app setting spip domain)
|
|
||||||
|
|
||||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||||
sudo rm -rf /var/www/spip
|
sudo rm -rf /var/www/spip
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Retrieve arguments
|
# Exit on command errors and treat unset variables as an error
|
||||||
domain=$(sudo yunohost app setting spip domain)
|
set -eu
|
||||||
path=$(sudo yunohost app setting spip path)
|
|
||||||
admin_spip=$(sudo yunohost app setting spip admin)
|
# See comments in install script
|
||||||
language=$(sudo yunohost app setting spip language)
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
is_public=$(sudo yunohost app setting spip is_public)
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve app settings
|
||||||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
|
admin=$(ynh_app_setting_get "$app" admin)
|
||||||
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||||
|
language=$(ynh_app_setting_get "$app" language)
|
||||||
|
|
||||||
|
# Remove trailing "/" for next commands
|
||||||
|
path=${path%/}
|
||||||
|
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
|
||||||
|
@ -15,8 +27,8 @@ db_name=spip
|
||||||
|
|
||||||
# Check if admin is not null
|
# Check if admin is not null
|
||||||
if [[ "$admin_spip" = "" || "$is_public" = "" || "$language" = "" ]]; then
|
if [[ "$admin_spip" = "" || "$is_public" = "" || "$language" = "" ]]; then
|
||||||
echo "Unable to upgrade, please contact support"
|
echo "Unable to upgrade, please contact support"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,16 +38,25 @@ sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||||
|
|
||||||
if [ $is_public = "Yes" ];
|
if [ $is_public = "Yes" ];
|
||||||
then
|
then
|
||||||
sudo cp ../conf/nginx.conf-public /etc/nginx/conf.d/$domain.d/spip.conf
|
sudo cp ../conf/nginx.conf-public /etc/nginx/conf.d/$domain.d/spip.conf
|
||||||
# grep -q "define('FORCE_SSL_ADMIN', true);" $final_path/wp-config.php
|
# grep -q "define('FORCE_SSL_ADMIN', true);" $final_path/wp-config.php
|
||||||
# if [[ ! $? -eq 0 ]];
|
# if [[ ! $? -eq 0 ]];
|
||||||
# then
|
# then
|
||||||
# echo "define('FORCE_SSL_ADMIN', true);" | sudo tee -a $final_path/config/connect.php
|
# echo "define('FORCE_SSL_ADMIN', true);" | sudo tee -a $final_path/config/connect.php
|
||||||
# else
|
# else
|
||||||
# sudo sed -i "s@//define('FORCE_SSL_ADMIN@define('FORCE_SSL_ADMIN@g" $final_path/config/connect.php
|
# sudo sed -i "s@//define('FORCE_SSL_ADMIN@define('FORCE_SSL_ADMIN@g" $final_path/config/connect.php
|
||||||
# fi
|
# fi
|
||||||
else
|
else
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/spip.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/spip.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
if [[ $is_public -eq 1 ]]; then
|
||||||
|
# See install script
|
||||||
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
sudo cp ../conf/nginx.conf-public /etc/nginx/conf.d/$domain.d/spip.conf
|
||||||
|
else
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/spip.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload Nginx
|
# Reload Nginx
|
||||||
|
|
Loading…
Add table
Reference in a new issue