diff --git a/README.md b/README.md index be0e775..6057ec1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # os.js_ynh -A desktop you have access through a web interface. -## État: WORKING ONLY FOR TEST +## Description + +OS.js is a webdesktop written in nodejs. It allows you to have everything in the cloud, that is to say, your documents, your applications... and you can decide to make it private. Everything is stored and you can find them again each time you connect to it. + +## État: WORKING +Backup is in experimental state for this app. Same for restore and upgrade. Be careful. diff --git a/scripts/_common.sh b/scripts/_common.sh index 5ab9822..03aa6b8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -455,14 +455,26 @@ ynh_send_readme_to_admin() { local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" local mail_message="This is an automated message from your beloved YunoHost server. + Specific information for the application $app. + $app_message + --- Automatic diagnosis data from YunoHost + $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" + # Define binary to use for mail command + if [ -e /usr/bin/bsd-mailx ] + then + local mail_bin=/usr/bin/bsd-mailx + else + local mail_bin=/usr/bin/mail.mailutils + fi + # Send the email to the recipients - echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" + echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" } #================================================= diff --git a/scripts/install b/scripts/install index 06c32eb..e9def29 100644 --- a/scripts/install +++ b/scripts/install @@ -23,6 +23,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN is_public=$YNH_APP_ARG_IS_PUBLIC path_url=$YNH_APP_ARG_PATH +admin_user=$YNH_APP_ARG_ADMIN_USER +admin_pass=$YNH_APP_ARG_ADMIN_PASS app=$YNH_APP_INSTANCE_NAME @@ -47,6 +49,8 @@ ynh_webpath_register $app $domain $path_url ynh_app_setting_set $app domain $domain ynh_app_setting_set $app is_public $is_public +ynh_app_setting_set $app admin_user $admin_user +ynh_app_setting_set $app admin_pass $admin_pass #================================================= # STANDARD MODIFICATIONS @@ -60,6 +64,16 @@ port=$(ynh_find_port 8000) yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port +#================================================= +# CREATE A MYSQL DATABASE +#================================================= +# If your app uses a MySQL database, you can use these lines to bootstrap +# a database, an associated user and save the password in app settings + +db_name=$(ynh_sanitize_dbid $app) +ynh_app_setting_set $app db_name $db_name +ynh_mysql_setup_db $db_name $db_name + #================================================= # INSTALL NODEJS #================================================= @@ -132,7 +146,29 @@ npm run package:discover popd #================================================= -# Set right on directory and configure init script +# Add Authentication through Mysql Database +#================================================= + +node osjs config:set --name=authenticator --value=database +node osjs config:set --name=server.modules.auth.database.driver --value=mysql +node osjs config:set --name=server.modules.auth.database.mysql.host --value=localhost +node osjs config:set --name=server.modules.auth.database.mysql.user --value=$db_name +node osjs config:set --name=server.modules.auth.database.mysql.password --value=$db_pwd +node osjs config:set --name=server.modules.auth.database.mysql.database --value=$db_name +node osjs config:set --name=client.ReloadOnShutdown --value=true + +node osjs build:config + +#================================================= +# Add the first user +#================================================= + +node bin/add-user.js add $admin_name admin +node bin/add-user.js pwd $admin_name <<< $admin_pass +mkdir vfs/home/$admin_name + +#================================================= +# Configure init script #================================================= ynh_replace_string "8000" "$port" "$final_path/src/server/config.js"