mirror of
https://github.com/YunoHost-Apps/vaultwarden_ynh.git
synced 2024-09-03 18:26:31 +02:00
apply last example
This commit is contained in:
parent
980f625ab1
commit
ada2aa88f0
3 changed files with 21 additions and 58 deletions
|
@ -129,7 +129,7 @@ pushd "$final_path"/build
|
|||
popd
|
||||
|
||||
# Install bitwarden_rs
|
||||
cp -a "$final_path"/build/target/release/bitwarden_rs "$final_path"/live/bitwarden_rs
|
||||
cp -a "$final_path/build/target/release/bitwarden_rs" "$final_path/live/bitwarden_rs"
|
||||
|
||||
# Remove build files and rustup
|
||||
ynh_secure_remove --file="$final_path/build"
|
||||
|
@ -152,24 +152,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..."
|
||||
|
||||
config="$final_path/live/bitwarden_rs.env"
|
||||
|
||||
cp -f ../conf/bitwarden_rs.env "$config"
|
||||
|
||||
ynh_replace_string --match_string="__ADMIN_TOKEN__" --replace_string="$admin_token" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$config"
|
||||
ynh_replace_string --match_string="__WEBSOCKET_PORT__" --replace_string="$websocket_port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__ROCKET_PORT__" --replace_string="$rocket_port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing the config file checksum..."
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$config"
|
||||
ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -218,11 +201,13 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Usern
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
|
@ -241,12 +226,9 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
ynh_script_progression --message="Sending a readme for the admin..."
|
||||
|
||||
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"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message"
|
||||
ynh_add_config --template="../conf/message" --destination="../conf/msg_install"
|
||||
|
||||
ynh_send_readme_to_admin --app_message="../conf/message" --recipients="$admin_mail" --type='install'
|
||||
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients="$admin_mail" --type='install'
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -99,14 +99,6 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
|||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -129,6 +121,13 @@ ynh_script_progression --message="Starting a systemd service..."
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" --length=100
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -44,15 +44,16 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
if ! ynh_permission_exists --permission="admin"; then
|
||||
# Create the required permissions
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed="$admin" --show_tile="false"
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --url="/api" --additional_urls="/identity/connect/token" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
if ! ynh_permission_exists --permission="admin"; then
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed="$admin" --show_tile="false"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -149,7 +150,7 @@ then
|
|||
ynh_secure_remove --file="$final_path/live/bitwarden_rs.d"
|
||||
|
||||
# Install bitwarden_rs
|
||||
cp -af "$final_path"/build/target/release/bitwarden_rs "$final_path"/live/bitwarden_rs
|
||||
cp -af "$final_path/build/target/release/bitwarden_rs" "$final_path/live/bitwarden_rs"
|
||||
|
||||
# Remove build files and rustup
|
||||
ynh_secure_remove --file="$final_path/build"
|
||||
|
@ -170,26 +171,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..."
|
||||
|
||||
config="$final_path/live/bitwarden_rs.env"
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
|
||||
cp -f ../conf/bitwarden_rs.env "$config"
|
||||
|
||||
ynh_replace_string --match_string="__ADMIN_TOKEN__" --replace_string="$admin_token" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$config"
|
||||
ynh_replace_string --match_string="__WEBSOCKET_PORT__" --replace_string="$websocket_port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__ROCKET_PORT__" --replace_string="$rocket_port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing the config file checksum..."
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$config"
|
||||
ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Reference in a new issue