1
0
Fork 0
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:
magikcypress 2016-08-30 00:22:47 +02:00
parent b1b0ea4299
commit 828fa2bdaf
3 changed files with 60 additions and 33 deletions

View file

@ -1,23 +1,21 @@
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
admin_spip=$3
app=$YNH_APP_INSTANCE_NAME
# Check if admin exists
sudo yunohost user list --json | grep -q "\"username\": \"$admin_spip\""
if [[ ! $? -eq 0 ]]; then
echo "Wrong admin"
exit 1
fi
sudo yunohost app setting spip admin -v $admin_spip
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
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
sudo yunohost app checkurl $domain$path -a spip
if [[ ! $? -eq 0 ]]; then
exit 1
fi
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
# 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')

View file

@ -1,9 +1,17 @@
#!/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_name=spip
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 ;"
sudo rm -rf /var/www/spip

View file

@ -1,11 +1,23 @@
#!/bin/bash
# Retrieve arguments
domain=$(sudo yunohost app setting spip domain)
path=$(sudo yunohost app setting spip path)
admin_spip=$(sudo yunohost app setting spip admin)
language=$(sudo yunohost app setting spip language)
is_public=$(sudo yunohost app setting spip is_public)
# Exit on command errors and treat unset variables as an error
set -eu
# 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)
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)
@ -38,5 +50,14 @@ else
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
# Reload Nginx
sudo service nginx reload