1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00

Shellcheck

This commit is contained in:
Jean-Baptiste Holcroft 2017-10-19 15:40:50 +02:00
parent 1a9d9cee46
commit 8bb3d4f6dd
4 changed files with 28 additions and 30 deletions

View file

@ -17,11 +17,9 @@ app=$YNH_APP_INSTANCE_NAME
# Set app specific variables # Set app specific variables
dbname=$app dbname=$app
dbuser=$app
# Retrieve app settings # Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get "$app" domain)
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get "$app" final_path)
# Copy the app source files # Copy the app source files

View file

@ -18,14 +18,14 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# Normalize the url path syntax # Normalize the url path syntax
path=$(ynh_normalize_url_path "$path_url") path_url=$(ynh_normalize_url_path "$path_url")
# Check web path availability # Check web path availability
ynh_webpath_available "$domain" "$path_url" ynh_webpath_available "$domain" "$path_url"
# Register (book) web path # Register (book) web path
ynh_webpath_register "$app" "$domain" "$path_url" ynh_webpath_register "$app" "$domain" "$path_url"
ynh_app_setting_set $app admin_user $admin ynh_app_setting_set "$app" admin_user "$admin"
# Retrieve admin email # Retrieve admin email
email=$(ynh_user_get_info "$admin" mail) email=$(ynh_user_get_info "$admin" mail)
@ -34,7 +34,7 @@ email=$(ynh_user_get_info "$admin" mail)
final_path="/var/www/$app" final_path="/var/www/$app"
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die "This path already contains a folder"
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set "$app" final_path "$final_path"
# Generate random password # Generate random password
dbpass=$(ynh_string_random) dbpass=$(ynh_string_random)
@ -43,9 +43,9 @@ dbuser=$app
# Initialize database and store mysql password for upgrade # Initialize database and store mysql password for upgrade
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
ynh_app_setting_set $app mysqlpwd $dbpass ynh_app_setting_set "$app" mysqlpwd "$dbpass"
ynh_app_setting_set $app adminusername $admin ynh_app_setting_set "$app" adminusername "$admin"
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set "$app" is_public "$is_public"
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
@ -60,8 +60,8 @@ ynh_replace_string "yuno_email" "$email" "$config_php"
ynh_replace_string "yuno_domain" "$domain" "$config_php" ynh_replace_string "yuno_domain" "$domain" "$config_php"
# Set permissions to kanboard and data directory # Set permissions to kanboard and data directory
chown -R root:root ${final_path} chown -R root:root "$final_path"
chown -R www-data ${final_path}/{data,plugins} chown -R www-data "$final_path"/{data,plugins}
# Copy and set php-fpm configuration # Copy and set php-fpm configuration
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
@ -70,8 +70,8 @@ cp ../conf/php-fpm.conf "$phpfpm_conf"
ynh_replace_string "#POOLNAME#" "$app" "$phpfpm_conf" ynh_replace_string "#POOLNAME#" "$app" "$phpfpm_conf"
ynh_replace_string "#DESTDIR#" "$final_path" "$phpfpm_conf" ynh_replace_string "#DESTDIR#" "$final_path" "$phpfpm_conf"
chown root: $phpfpm_conf chown root: "$phpfpm_conf"
chmod 644 $phpfpm_conf chmod 644 "$phpfpm_conf"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -80,7 +80,7 @@ chmod 644 $phpfpm_conf
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
if [ "$path_url" == "/" ] if [[ "$path_url" == "/" ]]
then then
# ynh panel is only comptable with non-root installation # ynh panel is only comptable with non-root installation
ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf" ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"
@ -99,7 +99,7 @@ then
fi fi
# Init database # Init database
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ${final_path}/app/Schema/Sql/mysql.sql ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < "${final_path}/app/Schema/Sql/mysql.sql"
# Reload services # Reload services
service php5-fpm restart service php5-fpm restart

View file

@ -36,7 +36,7 @@ ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
# Restore permissions # Restore permissions
chown -R root:root "$final_path" chown -R root:root "$final_path"
chown -R www-data ${final_path}/{data,plugins} chown -R www-data "$final_path"/{data,plugins}
# Restore configuration files # Restore configuration files
ynh_restore_file "/etc/nginx/conf.d/${domain}.d/${app}.conf" ynh_restore_file "/etc/nginx/conf.d/${domain}.d/${app}.conf"

View file

@ -12,7 +12,6 @@ ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# Set app specific variables # Set app specific variables
dbname=$app
dbuser=$app dbuser=$app
# Source app helpers # Source app helpers
@ -27,34 +26,35 @@ dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
is_public=$(ynh_app_setting_get "$app" is_public) is_public=$(ynh_app_setting_get "$app" is_public)
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get "$app" final_path)
if [ -z $is_public ] if [[ -z "$is_public" ]]
then # Old version doesnt have is_public settings then # Old version doesnt have is_public settings
is_public=0 is_public=0
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set "$app" is_public "$is_public"
fi fi
# flush php sessions before upgrade # flush php sessions before upgrade
ynh_secure_remove /var/lib/php5/session/* ynh_secure_remove /var/lib/php5/session/*
# Move old app dir # Move old app dir
mv ${final_path} ${final_path}.old mv "$final_path" "$final_path.old"
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
# restore data # restore data
cp -a ${final_path}.old/data ${final_path} cp -a "$final_path.old/data" "$final_path"
# restore plugins # restore plugins
if [ -e ${final_path}.old/plugins ] if [ -e "$final_path.old/plugins" ]
then then
cp -a ${final_path}.old/plugins ${final_path} cp -a "$final_path.old/plugins" "$final_path"
fi fi
# delete temp directory # delete temp directory
ynh_secure_remove "${final_path}.old" ynh_secure_remove "$final_path.old"
# Copy and edit config.php # Copy and edit config.php
config_php=${final_path}/config.php config_php="$final_path/config.php"
cp ../conf/config.php "$config_php" cp ../conf/config.php "$config_php"
ynh_replace_string "yuno_dbpdw" "$dbpass" "$config_php" ynh_replace_string "yuno_dbpdw" "$dbpass" "$config_php"
ynh_replace_string "yuno_dbuser" "$dbuser" "$config_php" ynh_replace_string "yuno_dbuser" "$dbuser" "$config_php"
ynh_replace_string "yuno_admin" "$admin" "$config_php" ynh_replace_string "yuno_admin" "$admin" "$config_php"
@ -62,11 +62,11 @@ ynh_replace_string "yuno_email" "$email" "$config_php"
ynh_replace_string "yuno_domain" "$domain" "$config_php" ynh_replace_string "yuno_domain" "$domain" "$config_php"
# Set permissions to kanboard and data directory # Set permissions to kanboard and data directory
chown -R root:root ${final_path} chown -R root:root "$final_path"
chown -R www-data ${final_path}/{data,plugins} chown -R www-data "$final_path"/{data,plugins}
# Launch database migration # Launch database migration
${final_path}/cli db:migrate "$final_path"/cli db:migrate
# Copy and set php-fpm configuration # Copy and set php-fpm configuration
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
@ -77,12 +77,12 @@ ynh_replace_string "#GROUP#" "$app" "$phpfpm_conf"
ynh_replace_string "#POOLNAME#" "$app" "$phpfpm_conf" ynh_replace_string "#POOLNAME#" "$app" "$phpfpm_conf"
ynh_replace_string "#DESTDIR#" "$final_path" "$phpfpm_conf" ynh_replace_string "#DESTDIR#" "$final_path" "$phpfpm_conf"
chown root: $phpfpm_conf chown root: "$phpfpm_conf"
chmod 644 $phpfpm_conf chmod 644 "$phpfpm_conf"
ynh_add_nginx_config ynh_add_nginx_config
if [ "$path_url" == "/" ] if [[ "$path_url" == "/" ]]
then then
# ynh panel is only comptable with non-root installation # ynh panel is only comptable with non-root installation
ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf" ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"