1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adminer_ynh.git synced 2024-09-03 18:06:06 +02:00
adminer_ynh/scripts/install

54 lines
1.5 KiB
Text
Raw Normal View History

2014-05-08 19:46:08 +02:00
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
2014-05-08 19:46:08 +02:00
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Save app settings
ynh_app_setting_set "$app" is_public "$is_public"
2014-05-08 19:46:08 +02:00
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path_url}"
2014-05-08 19:46:08 +02:00
2014-07-22 16:08:09 +02:00
# Copy source files
src_path=/var/www/$app
sudo mkdir -p $src_path
sudo cp -a ../sources/. $src_path
2014-05-08 19:46:08 +02:00
2014-07-22 16:08:09 +02:00
# Set permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user)
sudo find $src_path -type f | xargs sudo chmod 644
sudo find $src_path -type d | xargs sudo chmod 755
sudo chown -R root: $src_path
2014-05-08 19:46:08 +02:00
# Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf
sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
sudo chown root: /etc/nginx/conf.d/$domain.d/$app.conf
sudo chmod 600 /etc/nginx/conf.d/$domain.d/$app.conf
# If app is public, add url to SSOWat conf as skipped_uris
if [[ $is_public -eq 1 ]]; then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set "$app" unprotected_uris "/"
fi
2014-05-08 19:46:08 +02:00
sudo service nginx reload
2015-07-03 19:52:18 +02:00
sudo service php5-fpm reload
2014-05-08 19:46:08 +02:00
sudo yunohost app ssowatconf