1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00

follow shellcheck suggestions about quotes

This commit is contained in:
Jean-Baptiste Holcroft 2019-03-31 15:33:09 +02:00
parent 0e139f5e42
commit caad917ea6
6 changed files with 46 additions and 46 deletions

View file

@ -28,9 +28,9 @@ ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
final_path=$(ynh_app_setting_get "$app" final_path)
domain=$(ynh_app_setting_get "$app" domain)
db_name=$(ynh_app_setting_get "$app" db_name)
#=================================================
# STANDARD BACKUP STEPS

View file

@ -27,7 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_print_info "Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path)
final_path=$(ynh_app_setting_get "$app" final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get "$app" db_name)
@ -75,7 +75,7 @@ if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$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 "/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi

View file

@ -54,7 +54,7 @@ ynh_print_info "Installing dependencies..."
ynh_install_php --phpversion="7.2"
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# CREATE A POSTGRESQL DATABASE
@ -63,14 +63,14 @@ ynh_print_info "Creating a PostgreSQL database..."
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid $app)
db_name=$(ynh_sanitize_dbid "$app")
db_user=$db_name
db_pwd=$(ynh_string_random)
ynh_app_setting_set $app db_name $db_name
ynh_app_setting_set $app db_pwd $db_pwd
ynh_app_setting_set "$app" db_name "$db_name"
ynh_app_setting_set "$app" db_pwd "$db_pwd"
# Initialize database and store postgres password for upgrade
ynh_psql_setup_db $db_user $db_name $db_pwd
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd"
systemctl reload postgresql
@ -107,7 +107,7 @@ ynh_print_info "Configuring php-fpm..."
ynh_add_fpm_config --phpversion="7.2"
#Ugly move waiting 'ynh_add_fpm_config --phpversion='' released
mv /etc/php/7.0/fpm/pool.d/$app.conf /etc/php/7.2/fpm/pool.d/$app.conf
mv "/etc/php/7.0/fpm/pool.d/$app.conf" "/etc/php/7.2/fpm/pool.d/$app.conf"
systemctl reload php7.2-fpm
#=================================================
@ -116,7 +116,7 @@ systemctl reload php7.2-fpm
chown -R "$app": "$final_path"
ynh_install_composer --workdir=$final_path
ynh_install_composer --workdir="$final_path"
#=================================================
# SPECIFIC SETUP
@ -145,7 +145,7 @@ ynh_store_file_checksum "$config"
# DEPLOYMENT
#=================================================
pushd $final_path
pushd "$final_path"
php7.2 artisan -n key:generate --force
php7.2 artisan config:clear
php7.2 artisan config:cache

View file

@ -32,7 +32,7 @@ ynh_psql_execute_as_root "\connect $db_name
SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';"
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db $db_user $db_name
ynh_psql_remove_db "$db_user" "$db_name"
#=================================================
# REMOVE PHP-FPM CONFIGURATION
@ -40,7 +40,7 @@ ynh_psql_remove_db $db_user $db_name
ynh_print_info "Removing php-fpm configuration"
#Ugly move waiting 'ynh_add_fpm_config --phpversion='' released
mv /etc/php/7.2/fpm/pool.d/$app.conf /etc/php/7.0/fpm/pool.d/$app.conf
mv "/etc/php/7.2/fpm/pool.d/$app.conf" "/etc/php/7.0/fpm/pool.d/$app.conf"
systemctl reload php7.2-fpm
# Remove the dedicated php-fpm config

View file

@ -28,20 +28,20 @@ ynh_print_info "Loading settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
db_pwd=$(ynh_app_setting_get $app db_pwd)
domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path)
final_path=$(ynh_app_setting_get "$app" final_path)
db_name=$(ynh_app_setting_get "$app" db_name)
db_pwd=$(ynh_app_setting_get "$app" db_pwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Validating restoration parameters..."
ynh_webpath_available $domain $path_url \
ynh_webpath_available "$domain" "$path_url" \
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
test ! -d "$final_path" \
|| ynh_die "There is already a directory: $final_path "
#=================================================
@ -65,14 +65,14 @@ ynh_restore_file "$final_path"
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create $app
ynh_system_user_create "$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R root: $final_path
chown -R root: "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
@ -88,7 +88,7 @@ ynh_restore_file "/etc/php/7.2/fpm/pool.d/$app.conf"
ynh_print_info "Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# RESTORE THE PostgreSQL DATABASE
@ -105,13 +105,13 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name"
ynh_print_info "Restoring the systemd configuration..."
ynh_restore_file "/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"
#=================================================
# RESTORE THE CRON FILE

View file

@ -16,13 +16,13 @@ ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
admin=$(ynh_app_setting_get $app admin)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
language=$(ynh_app_setting_get $app language)
db_name=$(ynh_app_setting_get $app db_name)
domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path)
admin=$(ynh_app_setting_get "$app" admin)
is_public=$(ynh_app_setting_get "$app" is_public)
final_path=$(ynh_app_setting_get "$app" final_path)
language=$(ynh_app_setting_get "$app" language)
db_name=$(ynh_app_setting_get "$app" db_name)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -31,23 +31,23 @@ ynh_print_info "Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1
ynh_app_setting_set "$app" is_public 1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0
ynh_app_setting_set "$app" is_public 0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z $db_name ]; then
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid "$app")
ynh_app_setting_set "$app" db_name "$db_name"
fi
# If final_path doesn't exist, create it
if [ -z $final_path ]; then
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set "$app" final_path "$final_path"
fi
#=================================================
@ -74,7 +74,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=$(ynh_normalize_url_path "$path_url")
#=================================================
# STANDARD UPGRADE STEPS
@ -99,7 +99,7 @@ ynh_add_nginx_config
#=================================================
ynh_print_info "Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# CREATE DEDICATED USER
@ -107,7 +107,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_print_info "Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create $app
ynh_system_user_create "$app"
#=================================================
# PHP-FPM CONFIGURATION
@ -152,7 +152,7 @@ ynh_add_systemd_config
#=================================================
# Set permissions on app files
chown -R root: $final_path
chown -R root: "$final_path"
#=================================================
# SETUP SSOWAT
@ -163,7 +163,7 @@ ynh_print_info "Upgrading SSOwat configuration..."
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set $app unprotected_uris "/"
ynh_app_setting_set "$app" unprotected_uris "/"
fi
#=================================================