1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vaultwarden_ynh.git synced 2024-09-03 18:26:31 +02:00

Upgrade to 1.5.0

This commit is contained in:
yalh76 2020-06-03 21:53:23 +02:00
parent 330dd28948
commit 85a8702dcf
13 changed files with 147 additions and 120 deletions

View file

@ -1,18 +1,17 @@
# Bitwarden for YunoHost
[![Integration level](https://dash.yunohost.org/integration/bitwarden.svg)](https://dash.yunohost.org/appci/app/bitwarden)
[![Integration level](https://dash.yunohost.org/integration/bitwarden.svg)](https://dash.yunohost.org/appci/app/bitwarden) ![](https://ci-apps.yunohost.org/ci/badges/bitwarden.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/bitwarden.maintain.svg)
[![Install Bitwarden with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=bitwarden)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Bitwarden quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
> *This package allows you to install Bitwarden quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Bitwarden is a open source password manager.
**Shipped version:** 1.14.2
**Shipped version:** 1.5.0
## Important points to read before installing
@ -36,14 +35,14 @@ How to configure this app: by an admin panel at https://bitwarden.domain.tld/adm
## YunoHost specific features
#### Multi-users support
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bitwarden/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bitwarden/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bitwarden/)
## Links
@ -55,14 +54,14 @@ How to configure this app: by an admin panel at https://bitwarden.domain.tld/adm
---
Developers info
Developer info
----------------
Please do your pull request to the [testing branch]https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install --debug https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing
sudo yunohost app install https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing --debug
or
sudo yunohost app upgrade --debug bitwarden -u https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing
sudo yunohost app upgrade bitwarden -u https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing --debug
```

View file

@ -1,18 +1,17 @@
# Bitwarden pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/bitwarden.svg)](https://dash.yunohost.org/appci/app/bitwarden)
[![Niveau d'intégration](https://dash.yunohost.org/integration/bitwarden.svg)](https://dash.yunohost.org/appci/app/bitwarden) ![](https://ci-apps.yunohost.org/ci/badges/bitwarden.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/bitwarden.maintain.svg)
[![Installer Bitwarden avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=bitwarden)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Bitwarden rapidement et simplement sur un serveur Yunohost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble
Bitwarden est un gestionnaire de mots de passe open source.
**Version incluse:** 1.14.2
**Version incluse:** 1.5.0
## Points importants à lire avant l'installation
@ -36,7 +35,7 @@ Comment configurer cette application: via le panneau d'administration https://bi
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs
#### Support multi-utilisateur
* L'authentification LDAP et HTTP est-elle prise en charge? **No**
* L'application peut-elle être utilisée par plusieurs utilisateurs? **Yes**

View file

@ -18,6 +18,7 @@
setup_public=1
upgrade=1
upgrade=1 from_commit=501bf18eafcda987ac255d12ca213d15e63c5eef
upgrade=1 from_commit=769c3c874b1c206120c5836bcf5671913a6882b4
backup_restore=1
multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
@ -31,7 +32,7 @@
Email=yalh@yahoo.com
Notification=all
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
; commit=501bf18eafcda987ac255d12ca213d15e63c5eef
name=1.9.1~ynh3
; commit=769c3c874b1c206120c5836bcf5671913a6882b4
name=1.14.2~ynh1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/dani-garcia/bitwarden_rs/archive/1.14.2.tar.gz
SOURCE_SUM=242f10592dec87b83cd9ea360dc83901cb8adaf019c9220ea910824d8f9a7d98c713ff37ddc3f0522a1961006a899c38d1c4ebd3394190267d845c81325eeb88
SOURCE_URL=https://github.com/dani-garcia/bitwarden_rs/archive/1.5.0.tar.gz
SOURCE_SUM=0986a6b9202906c214661b0dbc21cd71d2a324fc5f3ad0b49e53b48110668f3451cd96868f59effd4b237d886df09668f480ff98b20e1ab430cdc98c6ea0a203
SOURCE_SUM_PRG=sha512sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.13.2b/bw_web_v2.13.2b.tar.gz
SOURCE_SUM=3e1acebc3f4d1ce242e09ff4a391206b4989a175a97ae4b28fa0c25c344719458f50612bf65a1eb2d8f234270b8d7b57650c1b5cccc67a241f3d9c0c50f03a91
SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.14.0/bw_web_v2.14.0.tar.gz
SOURCE_SUM=4f8eb3fbb809d90fda6bb62bfba80076a53e546c03c1dd2d1725e457193ff1b25500749fd307d8ae03d28e0f5b65bd2005712823119aaed2b77bab483d22c8bf
SOURCE_SUM_PRG=sha512sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

46
issue_template.md Normal file
View file

@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *Otherwise, the issue may be due to bitwarden itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
*A clear and concise description of what the bug is.*
**Versions**
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install bitwarden
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
4. *See error*
**Expected behavior**
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -6,7 +6,7 @@
"en": "Manage passwords and other sensitive informations",
"fr": "Géres les mots de passe et autres informations sensibles"
},
"version": "1.14.2~ynh1",
"version": "1.5.0~ynh1",
"url": "https://github.com/dani-garcia/bitwarden_rs",
"license": "GPL-3.0-or-later",
"maintainer": {
@ -45,7 +45,7 @@
"type": "user",
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
"fr": "Choisissez l'administrateur"
},
"example": "johndoe"
},

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting
@ -32,32 +31,25 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server"
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_print_info --message="Backing up fail2ban configuration..."
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
@ -67,24 +59,15 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_print_info --message="Backing up logrotate configuration..."
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_print_info --message="Backing up systemd configuration..."
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" --length=100
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
ynh_print_info --message="Retrieve arguments from the manifest"
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
@ -25,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -40,7 +39,7 @@ websocket_port=$(ynh_app_setting_get --app=$app --key=websocket_port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -75,14 +74,14 @@ fi
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_print_info --message="Updating nginx web server configuration..."
ynh_script_progression --message="Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -113,7 +112,7 @@ fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_print_info --message="Modifying a config file..."
ynh_script_progression --message="Modifying a config file..."
config="$final_path/live/bitwarden_rs.env"
@ -129,14 +128,15 @@ ynh_store_file_checksum --file="$config"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" --length=100
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -144,4 +144,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Change of URL completed for $app"
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting
@ -24,7 +23,6 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
@ -39,7 +37,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..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -50,7 +48,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..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
@ -63,7 +61,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..."
# Find an available port
websocket_port=$(ynh_find_port --port=3012)
@ -76,14 +74,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..."
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..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
@ -96,7 +94,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..."
# Create a dedicated nginx config
ynh_add_nginx_config "websocket_port rocket_port"
@ -104,7 +102,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..."
# Create a system user
ynh_system_user_create --username="$app" --home_dir="$final_path"
@ -114,7 +112,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..."
# Set right permissions
chown -R "$app":"$app" "$final_path"
@ -142,7 +140,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..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -150,7 +148,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..."
config="$final_path/live/bitwarden_rs.env"
@ -166,7 +164,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..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
@ -176,7 +174,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..."
# Set permissions to app files
chown -R "$app":"$app" "$final_path"
@ -186,7 +184,7 @@ chown -R "$app":"$app" "/var/log/$app"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info --message="Configuring log rotation..."
ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
@ -194,14 +192,14 @@ ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_print_info --message="Integrating service in YunoHost..."
ynh_script_progression --message="Integrating service in YunoHost..."
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..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" --length=100
@ -209,7 +207,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
#=================================================
# SETUP FAIL2BAN
#=================================================
ynh_print_info --message="Configuring fail2ban..."
ynh_script_progression --message="Configuring fail2ban..."
# Create a dedicated fail2ban config
touch /var/log/"$app"/"$app".log
@ -218,7 +216,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..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -230,14 +228,14 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
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..."
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"
@ -250,4 +248,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"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -24,19 +24,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_print_info --message="Removing service integration in YunoHost..."
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_print_info --message="Removing $app service..."
ynh_script_progression --message="Removing $app service..."
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info --message="Stopping and removing the systemd service..."
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -44,7 +43,7 @@ ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info --message="Removing dependencies..."
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -52,7 +51,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info --message="Removing app main directory..."
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -60,7 +59,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Removing nginx web server configuration..."
ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -68,7 +67,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_print_info --message="Removing logrotate configuration..."
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -76,7 +75,7 @@ ynh_remove_logrotate
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_print_info --message="Removing fail2ban configuration..."
ynh_script_progression --message="Removing fail2ban configuration..."
# Remove the dedicated fail2ban config
ynh_remove_fail2ban_config
@ -86,6 +85,7 @@ ynh_remove_fail2ban_config
#=================================================
# REMOVE THE LOG FILE
#=================================================
ynh_script_progression --message="Removing the log file..."
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
@ -95,7 +95,7 @@ ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info --message="Removing the dedicated system user..."
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
@ -104,4 +104,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_print_info --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed"

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting
@ -24,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -35,7 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -47,20 +46,21 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the nginx configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -68,7 +68,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_print_info --message="Restoring user rights..."
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R "$app":"$app" "$final_path"
@ -78,7 +78,7 @@ chown -R "$app":"$app" /var/log/"$app"
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the fail2ban configuration..."
ynh_script_progression --message="Restoring the fail2ban configuration..."
# Create a dedicated fail2ban config
mkdir -p "/var/log/$app"
@ -94,7 +94,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@ -103,7 +103,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_print_info --message="Restoring the systemd configuration..."
ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
@ -111,20 +111,21 @@ systemctl enable $app.service
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_print_info --message="Integrating service in YunoHost..."
ynh_script_progression --message="Integrating service in YunoHost..."
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..."
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"
@ -133,7 +134,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -141,4 +142,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -29,13 +29,14 @@ websocket_port=$(ynh_app_setting_get --app=$app --key=websocket_port)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
@ -55,7 +56,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -72,18 +73,17 @@ ynh_abort_if_errors
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info --message="Upgrading source files..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_print_info --message="Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress the source of bitwarden_rs from app.src to his build directory
ynh_setup_source --dest_dir="$final_path/build/" --source_id="app"
@ -95,7 +95,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Upgrading nginx web server configuration..."
ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config "websocket_port rocket_port"
@ -103,14 +103,14 @@ ynh_add_nginx_config "websocket_port rocket_port"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -120,7 +120,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# MAKE UPGRADE
#=================================================
ynh_print_info --message="Making upgrade..."
ynh_script_progression --message="Making upgrade..."
# Set right permissions
chown -R "$app":"$app" "$final_path"
@ -156,7 +156,7 @@ fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_print_info --message="Modifying a config file..."
ynh_script_progression --message="Modifying a config file..."
config="$final_path/live/bitwarden_rs.env"
@ -174,7 +174,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..."
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$config"
@ -182,7 +182,7 @@ ynh_store_file_checksum --file="$config"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info --message="Upgrading logrotate configuration..."
ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
@ -190,7 +190,7 @@ ynh_use_logrotate --non-append
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info --message="Upgrading systemd configuration..."
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -200,7 +200,7 @@ ynh_add_systemd_config
#=================================================
# UPGRADE FAIL2BAN
#=================================================
ynh_print_info --message="Reconfiguring fail2ban..."
ynh_script_progression --message="Reconfiguring fail2ban..."
# Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Username or password is incorrect\. Try again\. IP: <HOST>\. Username:.*$"
@ -208,7 +208,7 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Usern
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R "$app":"$app" "$final_path"
@ -218,7 +218,7 @@ chown -R "$app":"$app" /var/log/"$app"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Upgrading SSOwat configuration..."
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -230,14 +230,14 @@ fi
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
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
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -245,4 +245,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed"