diff --git a/scripts/install b/scripts/install index 2e1b8dc..ba49c0f 100644 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." +ynh_script_progression --message="Managing script failure..." --time --weight=1 ynh_clean_setup () { ynh_clean_check_starting @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -ynh_print_info --message="Retrieving arguments from the manifest..." +ynh_script_progression --message="Retrieving arguments from the manifest..." --time --weight=1 domain=$YNH_APP_ARG_DOMAIN path_url="/" @@ -39,7 +39,7 @@ admin_token=$(ynh_string_random --length=48 | base64) #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." --time --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -50,7 +50,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." --time --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -63,7 +63,7 @@ ynh_app_setting_set --app=$app --key=admin_token --value=$admin_token #================================================= # FIND AND OPEN A PORT #================================================= -ynh_print_info --message="Configuring firewall..." +ynh_script_progression --message="Configuring firewall..." --time --weight=1 # Find an available port @@ -77,14 +77,14 @@ ynh_app_setting_set --app=$app --key=rocket_port --value="$rocket_port" #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." --time --weight=1 ynh_install_app_dependencies $pkg_dependencies #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Setting up source files..." +ynh_script_progression --message="Setting up source files..." --time --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path @@ -97,7 +97,7 @@ ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id=web #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 # Create a dedicated nginx config ynh_add_nginx_config "websocket_port rocket_port" @@ -105,7 +105,7 @@ ynh_add_nginx_config "websocket_port rocket_port" #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." --time --weight=1 # Create a system user ynh_system_user_create --username="$app" --home_dir="$final_path" @@ -115,7 +115,7 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" #================================================= # MAKE INSTALL #================================================= -ynh_print_info --message="Making install..." +ynh_script_progression --message="Making install..." --time --weight=1 # Set right permissions chown -R "$app":"$app" "$final_path" @@ -143,7 +143,7 @@ ynh_secure_remove --file="$final_path/.rustup" #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 # Create a dedicated systemd config ynh_add_systemd_config @@ -151,7 +151,7 @@ ynh_add_systemd_config #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_print_info --message="Modifying a config file..." +ynh_script_progression --message="Modifying a config file..." --time --weight=1 config="$final_path/live/bitwarden_rs.env" @@ -166,7 +166,7 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_print_info --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." --time --weight=1 # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$config" @@ -176,7 +176,7 @@ ynh_store_file_checksum --file="$config" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_script_progression --message="Securing files and directories..." --time --weight=1 # Set permissions to app files chown -R "$app":"$app" "$final_path" @@ -186,7 +186,7 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info --message="Configuring log rotation..." +ynh_script_progression --message="Configuring log rotation..." --time --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -194,14 +194,14 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Rocket has launched from" --length=100 @@ -213,7 +213,7 @@ fi #================================================= # SETUP FAIL2BAN #================================================= -ynh_print_info --message="Configuring fail2ban..." +ynh_script_progression --message="Configuring fail2ban..." --time --weight=1 # Create a dedicated fail2ban config touch /var/log/"$app"/"$app".log @@ -222,7 +222,7 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Usern #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] @@ -234,14 +234,14 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN #================================================= -ynh_print_info --message="Sending a readme for the admin..." +ynh_script_progression --message="Sending a readme for the admin..." --time --weight=1 ynh_replace_string --match_string="__ADMIN_MAIL__" --replace_string="$admin_mail" --target_file="../conf/message" ynh_replace_string --match_string="__ADMIN_TOKEN__" --replace_string="$admin_token" --target_file="../conf/message" @@ -253,4 +253,4 @@ ynh_send_readme_to_admin --app_message="../conf/message" --recipients="$admin_ma # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --time --last