1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/openproject_ynh.git synced 2024-09-03 19:56:10 +02:00

Shell-check-ed

USing shellcheck to sanitize code.
This commit is contained in:
Moutonjr Geoff 2019-10-02 20:53:28 +02:00
parent 0e34c2ea6a
commit 79a5eb325b
7 changed files with 111 additions and 121 deletions

View file

@ -5,20 +5,20 @@
#=================================================
# dependencies used by the app
pkg_dependencies="zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev git curl poppler-utils unrtf tesseract-ocr catdoc libxml2 libxml2-dev libxslt1-dev memcached rbenv postgresql postgresql-contrib libpq-dev apt-transport-https ca-certificates nginx"
export pkg_dependencies="zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev git curl poppler-utils unrtf tesseract-ocr catdoc libxml2 libxml2-dev libxslt1-dev memcached rbenv postgresql postgresql-contrib libpq-dev apt-transport-https ca-certificates nginx"
#=================================================
# PERSONAL HELPERS
#=================================================
exec_as() {
echo "exec_as $@"
ynh_print_info "exec_as $*"
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" sh -c ". ~/.profile && $@"
sudo -u "$USER" sh -c ". ~/.profile && $*"
fi
}

View file

@ -7,7 +7,7 @@
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -24,9 +24,9 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
domain=$(ynh_app_setting_get --app="$app" --key=domain)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
#=================================================
# STANDARD BACKUP STEPS
@ -35,7 +35,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# BACKUP THE APP MAIN DIR
@ -56,7 +56,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Backing up the PostgreSQL database..." --time --weight=1
sudo -u postgres pg_dump $db_name > db.postgres
ynh_psql_dump_db -d "$db_name" > db.postgres
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
@ -87,7 +87,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT

View file

@ -27,7 +27,8 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Loading installation settings..." --time --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
export final_path
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
@ -60,8 +61,8 @@ then
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
export domain="$old_domain"
export path_url="$new_path"
# Create a dedicated nginx config
ynh_add_nginx_config
fi
@ -71,7 +72,7 @@ if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
mv "$nginx_conf_path" "/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi

View file

@ -11,16 +11,22 @@ source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
# Dealing with script's variables
#=================================================
# TODO
# Note: variables are stored in a single location to avoid confusion
# and declaration sequencing issues.
# Arguments from Manifest
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
# Build home dir in install file
# Installer variables
db_name=$(ynh_sanitize_dbid --db_name="$app")
db_pwd=$(ynh_string_random) # Generate a random password
db_user=$db_name
final_path="/var/www/$app"
_homedir="/var/$app/"
# Find a free port.
@ -28,30 +34,34 @@ _homedir="/var/$app/"
# - By PUMA to fire app server listening to this port, and
# - Nginx to proxify on this.
port=$(ynh_find_port --port=6001)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
#TODO
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=homedir --value=$_homedir
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd"
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
ynh_app_setting_set --app="$app" --key=homedir --value="$_homedir"
ynh_app_setting_set --app="$app" --key=is_public --value="$is_public"
ynh_app_setting_set --app="$app" --key=language --value="$language"
ynh_app_setting_set --app="$app" --key=path --value="$path_url"
ynh_app_setting_set --app="$app" --key=port --value="$port"
# Make app public if necessary
[ "$is_public" -eq 1 ] && ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
#=================================================
# ENVIRONMENT SETUP
@ -62,14 +72,14 @@ ynh_app_setting_set --app=$app --key=homedir --value=$_homedir
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
ynh_system_user_create --username=$app --home_dir=$_homedir -s
ynh_system_user_create --username="$app" --home_dir="$_homedir" -s
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
@ -78,44 +88,43 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Setting up Rbenv and Nodenv..." --weight=1
# 1: Ruby
exec_as $app git clone -q https://github.com/rbenv/rbenv.git $_homedir/.rbenv
exec_as $app git clone -q https://github.com/rbenv/ruby-build.git $_homedir/.rbenv/plugins/ruby-build
exec_as "$app" git clone -q https://github.com/rbenv/rbenv.git "$_homedir/.rbenv"
exec_as "$app" git clone -q https://github.com/rbenv/ruby-build.git "$_homedir/.rbenv/plugins/ruby-build"
# 2: Node
exec_as $app git clone -q https://github.com/nodenv/nodenv.git $_homedir/.nodenv
exec_as $app git clone -q git://github.com/nodenv/node-build.git $_homedir/.nodenv/plugins/node-build
exec_as "$app" git clone -q https://github.com/nodenv/nodenv.git "$_homedir/.nodenv"
exec_as "$app" git clone -q git://github.com/nodenv/node-build.git "$_homedir/.nodenv/plugins/node-build"
cat >> $_homedir/.profile << EOF
cat >> "$_homedir/.profile" << EOF
export PATH="$_homedir/.nodenv/bin:$_homedir/.rbenv/bin:$PATH"
eval "\$(rbenv init -)"
eval "\$(nodenv init -)"
RAILS_ENV="production"
EOF
chown $app: $_homedir/.profile
chown "$app": "$_homedir/.profile"
ynh_script_progression --message="Setting up Ruby and Node..." --weight=1
# 3: Ruby setup
exec_as $app rbenv install 2.6.4 > /dev/null
exec_as $app rbenv rehash
exec_as $app rbenv global 2.6.4
exec_as "$app" rbenv install 2.6.4 > /dev/null
exec_as "$app" rbenv rehash
exec_as "$app" rbenv global 2.6.4
# 3: Node setup
exec_as $app nodenv install 12.11.0 > /dev/null
exec_as $app nodenv rehash
exec_as $app nodenv global 12.11.0
exec_as "$app" nodenv install 12.11.0 > /dev/null
exec_as "$app" nodenv rehash
exec_as "$app" nodenv global 12.11.0
# Test result
exec_as $app ruby --version >/dev/null 2>&1 || ynh_die "Ruby installation failed with rubyenv"
exec_as $app node --version >/dev/null 2>&1 || ynh_die "Node installation failed with nodenv"
exec_as "$app" ruby --version >/dev/null 2>&1 || ynh_die "Ruby installation failed with rubyenv"
exec_as "$app" node --version >/dev/null 2>&1 || ynh_die "Node installation failed with nodenv"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
@ -129,12 +138,8 @@ ynh_add_nginx_config
#=================================================
# OPENPROJECT CONFIGURATION
#=================================================
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_pwd=$(ynh_string_random) # Generate a random password
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
db_user=$db_name
ynh_script_progression --message="Configuring OpenProject..." --weight=1
exec_as $app cat >> $final_path/config/database.yml << EOF
exec_as "$app" cat >> "$final_path/config/database.yml" << EOF
production:
adapter: postgresql
database: $db_name
@ -147,7 +152,7 @@ EOF
ynh_store_file_checksum --file="$final_path/config/database.yml"
#TODO Not sure aout this email sending. To be tested.
exec_as $app cat >> $final_path/config/configuration.yml << EOF
exec_as "$app" cat >> "$final_path/config/configuration.yml" << EOF
production:
# Outgoing emails configuration (see examples above)
email_delivery_method: :smtp
@ -163,31 +168,29 @@ ynh_store_file_checksum --file="$final_path/config/configuration.yml"
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
ynh_app_setting_set --app=$app --key=dbpwd --value=$db_pwd # Store the password in the app's config
ynh_exec_as postgres psql -c "CREATE USER $app WITH PASSWORD '$db_pwd';"
ynh_exec_as postgres createdb -O $app $db_name
ynh_psql_create_user "$db_user" "$db_pwd"
ynh_psql_create_db "$db_name" "$db_user"
#=================================================
# RUBY POST-INSTALL
#=================================================
ynh_script_progression --message="Compiling OpenProject with NPM and RUBYGems..." --weight=1
exec_as $app gem update --system
exec_as "$app" gem update --system
pushd $final_path
exec_as $app gem install puma
# TODO Remove if test success exec_as $app gem install bundler
exec_as $app bundle install --deployment --without development test therubyracer docker
exec_as $app npm install
pushd "$final_path"
exec_as "$app" gem install puma
exec_as "$app" bundle install --deployment --without development test therubyracer docker
exec_as "$app" npm install
ynh_script_progression --message="Provisioning assets..." --weight=1
exec_as $app ./bin/rake db:create
exec_as $app ./bin/rake db:migrate
exec_as $app ./bin/rake LOCALE=$language db:seed
exec_as $app ./bin/rake assets:precompile
echo "export SECRET_KEY_BASE=$(./bin/rake secret)" >> /etc/environment
exec_as "$app" ./bin/rake db:create
exec_as "$app" ./bin/rake db:migrate
exec_as "$app" ./bin/rake LOCALE="$language" db:seed
exec_as "$app" ./bin/rake assets:precompile
# shellcheck disable=SC2016
exec_as "$app" 'echo "export SECRET_KEY_BASE=$(./bin/rake secret)"' >> /etc/environment
. /etc/environment
chmod o+x .
@ -211,7 +214,7 @@ ynh_add_systemd_config
###
#### Set the app as temporarily public for curl call
###ynh_script_progression --message="Configuring SSOwat..." --weight=1
###ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
###ynh_app_setting_set --app="$app" --key=skipped_uris --value="/"
#### Reload SSOwat config
###yunohost app ssowatconf
###
@ -225,7 +228,7 @@ ynh_add_systemd_config
#### Remove the public access
###if [ $is_public -eq 0 ]
###then
### ynh_app_setting_delete --app=$app --key=skipped_uris
### ynh_app_setting_delete --app="$app" --key=skipped_uris
###fi
#=================================================
@ -236,11 +239,11 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1
ynh_use_logrotate
# ADVERTISE SERVICE IN ADMIN PANEL
yunohost service add $app --log "/var/log/$app/$app.log"
yunohost service add "$app" --log "/var/log/$app/$app.log"
# START SYSTEMD SERVICE
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
# SETUP FAIL2BAN
ynh_script_progression --message="Configuring fail2ban..." --weight=1
@ -253,12 +256,6 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# RELOAD NGINX

View file

@ -16,11 +16,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
_homedir=/var/$app
@ -31,10 +29,10 @@ _homedir=/var/$app
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if ynh_exec_warn_less yunohost service status $app >/dev/null
if ynh_exec_warn_less yunohost service status "$app" >/dev/null
then
ynh_script_progression --message="Removing $app service..." --weight=1
yunohost service remove $app
yunohost service remove "$app"
fi
#=================================================
@ -51,11 +49,8 @@ ynh_remove_systemd_config
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user
[ -z $db_name ] || ynh_exec_as postgres dropdb $db_name
# If DBMS is empty, remove it.
_remaining_databases=$(sudo -iu postgres psql -l | grep "^(" | sed "s/^(\([^ ]*\) .*/\1/")
[ $_remaining_databases -lt 3 ] && apt remove postgresql postgresq-contribl
ynh_psql_drop_db "$db_name"
ynh_psql_drop_user "$db_user"
#=================================================
# REMOVE DEPENDENCIES
@ -106,7 +101,7 @@ ynh_remove_fail2ban_config
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
ynh_system_user_delete --username="$app"
#=================================================
# END OF SCRIPT

View file

@ -7,7 +7,7 @@
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
@ -18,20 +18,18 @@ ynh_script_progression --message="Loading settings..." --time --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
domain=$(ynh_app_setting_get --app="$app" --key=domain)
path_url=$(ynh_app_setting_get --app="$app" --key=path)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
ynh_webpath_available --domain="$domain" --path_url="$path_url" \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
test ! -d "$final_path" \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
@ -55,14 +53,14 @@ ynh_restore_file --origin_path="$final_path"
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username="$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R $app: $final_path
chown -R "$app": "$final_path"
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
@ -81,35 +79,35 @@ ynh_systemd_action --action=restart --service_name=fail2ban
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --time --weight=1
db_pwd=$(ynh_app_setting_get --app=$app --key=dbpwd)
sudo -u postgres psql < db.postgres
exec_as postgres psql < db.postgres
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
systemctl enable "$app.service"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --log "/var/log/$app/$app.log"
yunohost service add "$app" --log "/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION

View file

@ -16,13 +16,12 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
domain=$(ynh_app_setting_get --app="$app" --key=domain)
path_url=$(ynh_app_setting_get --app="$app" --key=path)
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#language=$(ynh_app_setting_get --app="$app" --key=language)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
#=================================================
# CHECK VERSION
@ -43,23 +42,23 @@ ynh_script_progression --message="Ensuring downward compatibility..." --time --w
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
ynh_app_setting_set --app="$app" --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
ynh_app_setting_set --app="$app" --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
db_name=$(ynh_sanitize_dbid --db_name="$app")
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
fi
#=================================================
@ -86,7 +85,7 @@ ynh_abort_if_errors
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
path_url=$(ynh_normalize_url_path --path_url="$path_url")
#=================================================
# STANDARD UPGRADE STEPS
@ -95,7 +94,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -122,7 +121,7 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# CREATE DEDICATED USER
@ -130,7 +129,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username="$app"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -173,7 +172,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg
#=================================================
# Set permissions on app files
chown -R root: $final_path
chown -R root: "$final_path"
#=================================================
# SETUP SSOWAT
@ -184,7 +183,7 @@ ynh_script_progression --message="Upgrading SSOwat configuration..." --time --we
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
fi
#=================================================
@ -192,7 +191,7 @@ fi
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX