mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
Merge pull request #92 from YunoHost-Apps/patch-21
[fix] Remove useless Condition
This commit is contained in:
commit
ab683da2d2
1 changed files with 62 additions and 70 deletions
132
scripts/install
132
scripts/install
|
@ -125,11 +125,11 @@ ynh_app_setting_set "$app" db_pwd "$db_pwd"
|
||||||
|
|
||||||
# Bug in Nginx with locations and aliases (see http://stackoverflow.com/a/35102259 )
|
# Bug in Nginx with locations and aliases (see http://stackoverflow.com/a/35102259 )
|
||||||
if [ $path_url = "/" ]; then
|
if [ $path_url = "/" ]; then
|
||||||
sed -i "s@__LOCATION_HACK__@@g" ../conf/nginx.conf
|
ynh_replace_string "__LOCATION_HACK__" "" "../conf/nginx.conf"
|
||||||
sed -i "s@__PATH_HACK__@/@g" ../conf/nginx.conf
|
ynh_replace_string "__PATH_HACK__" "/" "../conf/nginx.conf"
|
||||||
else
|
else
|
||||||
sed -i "s@__LOCATION_HACK__@$path_url@g" ../conf/nginx.conf
|
ynh_replace_string "__LOCATION_HACK__" "$path_url" "../conf/nginx.conf"
|
||||||
sed -i "s@__PATH_HACK__@$path_url$path_url@g" ../conf/nginx.conf
|
ynh_replace_string "__PATH_HACK__" "$path_url$path_url" "../conf/nginx.conf"
|
||||||
fi
|
fi
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -173,74 +173,66 @@ systemctl reload nginx
|
||||||
# FLARUM POST-INSTALL
|
# FLARUM POST-INSTALL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [[ -n $admin && -n $title ]]; then
|
# Copy the configuration.yml to working directory
|
||||||
# If admin user and title were specified, start post-installation
|
finalflarumconf="$final_path/configuration.yml"
|
||||||
# Copy the configuration.yml to working directory
|
cp ../conf/configuration.yml $finalflarumconf
|
||||||
finalflarumconf="$final_path/configuration.yml"
|
chown $app:www-data $finalflarumconf
|
||||||
cp ../conf/configuration.yml $finalflarumconf
|
# Generate admin password and retrieve their email address
|
||||||
chown $app:www-data $finalflarumconf
|
admin_pwd=$(ynh_string_random 8)
|
||||||
# Generate admin password and retrieve their email address
|
admin_mail=$(ynh_user_get_info $admin mail)
|
||||||
admin_pwd=$(ynh_string_random 8)
|
# Populate configuration.yml
|
||||||
admin_mail=$(ynh_user_get_info $admin mail)
|
ynh_replace_string "__DOMAIN__" "$domain" "$finalflarumconf"
|
||||||
# Populate configuration.yml
|
ynh_replace_string "/__PATH__" "$path_url" "$finalflarumconf"
|
||||||
sed -i "s@__DOMAIN__@$domain@g" $finalflarumconf
|
ynh_replace_string "__USER__" "$app" "$finalflarumconf"
|
||||||
sed -i "s@/__PATH__@$path_url@g" $finalflarumconf
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$finalflarumconf"
|
||||||
sed -i "s@__USER__@$app@g" $finalflarumconf
|
ynh_replace_string "__ADMIN__" "$admin" "$finalflarumconf"
|
||||||
sed -i "s@__DB_PWD__@$db_pwd@g" $finalflarumconf
|
ynh_replace_string "__ADMIN_PWD__" "$admin_pwd" "$finalflarumconf"
|
||||||
sed -i "s@__ADMIN__@$admin@g" $finalflarumconf
|
ynh_replace_string "__ADMIN_EML__" "$admin_mail" "$finalflarumconf"
|
||||||
sed -i "s@__ADMIN_PWD__@$admin_pwd@g" $finalflarumconf
|
ynh_replace_string "__FORUM_TITLE__" "$title" "$finalflarumconf"
|
||||||
sed -i "s%__ADMIN_EML__%$admin_mail%g" $finalflarumconf
|
# Execute post-installation
|
||||||
sed -i "s@__FORUM_TITLE__@$title@g" $finalflarumconf
|
pushd $final_path
|
||||||
# Execute post-installation
|
exec_as $app "php -d $final_path -d memory_limit=-1 flarum install -f configuration.yml"
|
||||||
pushd $final_path
|
# Delete configuration.yml as it sensitive data
|
||||||
exec_as $app "php -d $final_path -d memory_limit=-1 flarum install -f configuration.yml"
|
ynh_secure_remove $finalflarumconf
|
||||||
# Delete configuration.yml as it sensitive data
|
popd
|
||||||
ynh_secure_remove $finalflarumconf
|
|
||||||
popd
|
|
||||||
|
|
||||||
# Email setup
|
# Email setup
|
||||||
sql_command="REPLACE INTO \`settings\` (\`key\`, \`value\`) VALUES
|
sql_command="REPLACE INTO \`settings\` (\`key\`, \`value\`) VALUES
|
||||||
('mail_driver', 'mail'),
|
('mail_driver', 'mail'),
|
||||||
('mail_encryption', 'ssl'),
|
('mail_encryption', 'ssl'),
|
||||||
('mail_from', '$app@$domain'),
|
('mail_from', '$app@$domain'),
|
||||||
('mail_host', 'localhost'),
|
('mail_host', 'localhost'),
|
||||||
('mail_port', '587');"
|
('mail_port', '587');"
|
||||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||||
|
|
||||||
# Install and active the SSOwat auth extension
|
# Install and active the SSOwat auth extension
|
||||||
install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext-auth-ssowat:$ssowat_ext_ver" "tituspijean-auth-ssowat"
|
install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext-auth-ssowat:$ssowat_ext_ver" "tituspijean-auth-ssowat"
|
||||||
# Configure SSOwat auth extension
|
# Configure SSOwat auth extension
|
||||||
ssowatdomain=$(</etc/yunohost/current_host)
|
ssowatdomain=$(</etc/yunohost/current_host)
|
||||||
sql_command="INSERT INTO \`settings\` (\`key\`, \`value\`) VALUES ('tituspijean-auth-ssowat.domain', '$ssowatdomain'), ('tituspijean-auth-ssowat.onlyUse', '0');"
|
sql_command="INSERT INTO \`settings\` (\`key\`, \`value\`) VALUES ('tituspijean-auth-ssowat.domain', '$ssowatdomain'), ('tituspijean-auth-ssowat.onlyUse', '0');"
|
||||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||||
|
|
||||||
# Install, activate and set language extensions
|
# Install, activate and set language extensions
|
||||||
case $language in
|
case $language in
|
||||||
fr)
|
fr)
|
||||||
install_and_activate_extension $app $final_path $db_name "milescellar/flarum-ext-french" "milescellar-french"
|
install_and_activate_extension $app $final_path $db_name "milescellar/flarum-ext-french" "milescellar-french"
|
||||||
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||||
;;
|
;;
|
||||||
de)
|
de)
|
||||||
install_and_activate_extension $app $final_path $db_name "cbmainz/flarum-de" "cbmainz-de"
|
install_and_activate_extension $app $final_path $db_name "cbmainz/flarum-de" "cbmainz-de"
|
||||||
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ $bazaar_extension ]]; then
|
if [[ $bazaar_extension ]]; then
|
||||||
exec_composer $app $final_path "require flagrow/bazaar --ansi"
|
exec_composer $app $final_path "require flagrow/bazaar --ansi"
|
||||||
fi
|
|
||||||
|
|
||||||
# Send login credentials to admin
|
|
||||||
app_message="User : $admin, password : $admin_pwd
|
|
||||||
Change your password!
|
|
||||||
Your forum is accessible at https://$domain$path_url"
|
|
||||||
>&2 echo $app_message
|
|
||||||
ynh_send_readme_to_admin "$app_message" "$admin"
|
|
||||||
else
|
|
||||||
# If admin user and title were not specified, ask admin to perform manual post-installation
|
|
||||||
app_message="Post-installation required, visit your Flarum instance."
|
|
||||||
>&2 echo $app_message
|
|
||||||
ynh_send_readme_to_admin "$app_message" "$admin"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Send login credentials to admin
|
||||||
|
app_message="User : $admin, password : $admin_pwd
|
||||||
|
Change your password!
|
||||||
|
Your forum is accessible at https://$domain$path_url"
|
||||||
|
>&2 echo $app_message
|
||||||
|
ynh_send_readme_to_admin "$app_message" "$admin"
|
||||||
|
|
Loading…
Add table
Reference in a new issue