mirror of
https://github.com/YunoHost-Apps/vaultwarden_ynh.git
synced 2024-09-03 18:26:31 +02:00
commit
4220f2f013
5 changed files with 26 additions and 59 deletions
|
@ -31,6 +31,8 @@
|
|||
upgrade=1 from_commit=e2e958b1885f7a08e0d5afe5dada5c0dd44dd671
|
||||
# 1.16.3~ynh3
|
||||
upgrade=1 from_commit=df2a0510288c352cfc03886763149f49839ed620
|
||||
# 1.19.0~ynh1
|
||||
upgrade=1 from_commit=980f625ab1eb3136437ff6275bec7990c534282c
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
|
@ -53,3 +55,5 @@ Notification=all
|
|||
name=1.16.3~ynh2
|
||||
; commit=df2a0510288c352cfc03886763149f49839ed620
|
||||
name=1.16.3~ynh3
|
||||
; commit=980f625ab1eb3136437ff6275bec7990c534282c
|
||||
name=1.19.0~ynh1
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"name": "yalh76"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.3"
|
||||
"yunohost": ">= 4.1.7.3"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
|
|
@ -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