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

Merge pull request #23 from YunoHost-Apps/testing

Upgrade to 1.13.0
This commit is contained in:
yalh76 2019-12-28 13:20:51 +01:00 committed by GitHub
commit 110cad954f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 116 additions and 109 deletions

View file

@ -9,7 +9,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
## Overview ## Overview
Open source password management solutions. Open source password management solutions.
**Shipped version:** 1.12.0 **Shipped version:** 1.13.0
## Important points to read before installing ## Important points to read before installing
@ -61,7 +61,7 @@ Please do your pull request to the [testing branch](https://github.com/YunoHost-
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```
sudo yunohost app install https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing --debug sudo yunohost app install --debug https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing
or or
sudo yunohost app upgrade bitwarden -u https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing --debug sudo yunohost app upgrade --debug bitwarden -u https://github.com/YunoHost-Apps/bitwarden_ynh/tree/testing
``` ```

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://github.com/dani-garcia/bitwarden_rs/archive/1.12.0.tar.gz SOURCE_URL=https://github.com/dani-garcia/bitwarden_rs/archive/1.13.0.tar.gz
SOURCE_SUM=3b53e5f5021dc7c65b7925069160474609744c55759f51a5ef0bae56c859971a SOURCE_SUM=ef17482b98b8caa089c957bc3db53f3adcbcdd1b8b64cb4b94612875bf939e259b9ef5928d2aaf99490534a83b48a3ec06933c28b243be1c41bf3dfbe68f5c8d
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha512sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=

View file

@ -37,14 +37,10 @@ WEBSOCKET_ENABLED=true
WEBSOCKET_ADDRESS=127.0.0.1 WEBSOCKET_ADDRESS=127.0.0.1
WEBSOCKET_PORT=__WEBSOCKET_PORT__ WEBSOCKET_PORT=__WEBSOCKET_PORT__
## Enable extended logging ## Enable extended logging, which shows timestamps and targets in the logs
## This shows timestamps and allows logging to file and to syslog
### To enable logging to file, use the LOG_FILE env variable
### To enable syslog, use the USE_SYSLOG env variable
# EXTENDED_LOGGING=true # EXTENDED_LOGGING=true
## Logging to file ## Logging to file
## This requires extended logging
## It's recommended to also set 'ROCKET_CLI_COLORS=off' ## It's recommended to also set 'ROCKET_CLI_COLORS=off'
LOG_FILE=/var/log/__APP__/__APP__.log LOG_FILE=/var/log/__APP__/__APP__.log
@ -56,7 +52,8 @@ LOG_FILE=/var/log/__APP__/__APP__.log
## Log level ## Log level
## Change the verbosity of the log output ## Change the verbosity of the log output
## Valid values are "trace", "debug", "info", "warn", "error" and "off" ## Valid values are "trace", "debug", "info", "warn", "error" and "off"
## This requires extended logging ## Setting it to "trace" or "debug" would also show logs for mounted
## routes and static file, websocket and alive requests
# LOG_LEVEL=Info # LOG_LEVEL=Info
## Enable WAL for the DB ## Enable WAL for the DB
@ -95,12 +92,22 @@ LOG_FILE=/var/log/__APP__/__APP__.log
## Controls if new users can register ## Controls if new users can register
SIGNUPS_ALLOWED=false SIGNUPS_ALLOWED=false
## Controls if new users need to verify their email address upon registration
## Note that setting this option to true prevents logins until the email address has been verified!
## The welcome email will include a verification link, and login attempts will periodically
## trigger another verification email to be sent.
# SIGNUPS_VERIFY=false
## If SIGNUPS_VERIFY is set to true, this limits how many seconds after the last time
## an email verification link has been sent another verification email will be sent
# SIGNUPS_VERIFY_RESEND_TIME=3600
## If SIGNUPS_VERIFY is set to true, this limits how many times an email verification
## email will be re-sent upon an attempted login.
# SIGNUPS_VERIFY_RESEND_LIMIT=6
## Controls if new users from a list of comma-separated domains can register ## Controls if new users from a list of comma-separated domains can register
## even if SIGNUPS_ALLOWED is set to false ## even if SIGNUPS_ALLOWED is set to false
##
## WARNING: There is currently no validation that prevents anyone from
## signing up with any made-up email address from one of these
## whitelisted domains!
# SIGNUPS_DOMAINS_WHITELIST=example.com,example.net,example.org # SIGNUPS_DOMAINS_WHITELIST=example.com,example.net,example.org
## Token for the admin interface, preferably use a long random string ## Token for the admin interface, preferably use a long random string

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.12.0/bw_web_v2.12.0.tar.gz SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.12.0b/bw_web_v2.12.0b.tar.gz
SOURCE_SUM=3664d4368fbb35abc08480d24a3800fae4caa1fe3e0fd06f7ec7584cafeb8d18 SOURCE_SUM=e511e061f9a064048f42a7d5b7a4b13a593bf2e1ff3fd72f4570a6aa18f45c06
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -6,7 +6,7 @@
"en": "Manage passwords and other sensitive informations", "en": "Manage passwords and other sensitive informations",
"fr": "Géres les mots de passe et autres informations sensibles" "fr": "Géres les mots de passe et autres informations sensibles"
}, },
"version": "1.12.0~ynh1", "version": "1.13.0~ynh1",
"url": "https://github.com/dani-garcia/bitwarden_rs", "url": "https://github.com/dani-garcia/bitwarden_rs",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {

View file

@ -27,8 +27,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app="$app" --key=domain)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
@ -37,7 +37,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=2 ynh_script_progression --message="Stopping a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server" ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server"
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
@ -82,9 +82,9 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Rocket has launched from"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" --line_match="Rocket has launched from"
fi fi
#================================================= #=================================================

View file

@ -27,7 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
@ -52,7 +52,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server" ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
@ -78,7 +78,7 @@ if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path" ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv "$nginx_conf_path" /etc/nginx/conf.d/"$new_domain".d/"$app".conf
# Store file checksum for the new config file location # Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
@ -96,9 +96,9 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Rocket has launched from"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" --line_match="Rocket has launched from"
fi fi
#================================================= #=================================================

View file

@ -31,7 +31,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
admin_mail=$(ynh_user_get_info $admin 'mail') admin_mail=$(ynh_user_get_info "$admin" 'mail')
admin_token=$(ynh_string_random --length=48 | base64) admin_token=$(ynh_string_random --length=48 | base64)
#================================================= #=================================================
@ -43,18 +43,18 @@ final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app="$app" --domain="$domain" --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app="$app" --key=domain --value="$domain"
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app="$app" --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app="$app" --key=admin --value="$admin"
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app="$app" --key=is_public --value="$is_public"
ynh_app_setting_set --app=$app --key=admin_token --value=$admin_token ynh_app_setting_set --app="$app" --key=admin_token --value="$admin_token"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -65,25 +65,25 @@ ynh_script_progression --message="Configuring firewall..." --weight=1
# Find a free port # Find a free port
websocket_port=$(ynh_find_port --port=3012) websocket_port=$(ynh_find_port --port=3012)
ynh_app_setting_set --app=$app --key=websocket_port --value=$websocket_port ynh_app_setting_set --app="$app" --key=websocket_port --value="$websocket_port"
# Find a free port # Find a free port
rocket_port=$(ynh_find_port --port=8095) rocket_port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=rocket_port --value=$rocket_port ynh_app_setting_set --app="$app" --key=rocket_port --value="$rocket_port"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=10 ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=3 ynh_script_progression --message="Setting up source files..." --weight=3
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
# Download, check integrity, uncompress the source of bitwarden_rs from app.src to his build directory # 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 ynh_setup_source --dest_dir="$final_path/build/" --source_id=app
@ -105,7 +105,7 @@ ynh_add_nginx_config "websocket_port rocket_port"
ynh_script_progression --message="Configuring system user..." --weight=2 ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username="$app" --home_dir="$final_path"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -115,22 +115,22 @@ ynh_system_user_create --username=$app --home_dir=$final_path
ynh_script_progression --message="Making install..." --weight=780 ynh_script_progression --message="Making install..." --weight=780
# Set right permissions # Set right permissions
chown -R "$app":"$app" $final_path chown -R "$app":"$app" "$final_path"
# Install rustup with the toolchain needed by bitwarden_rs # Install rustup with the toolchain needed by bitwarden_rs
pushd $final_path pushd "$final_path" || exit
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=$(cat build/rust-toolchain)' sudo -u "$app" RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=$(cat build/rust-toolchain)'
popd popd || exit
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
# Compile bitwarden_rs # Compile bitwarden_rs
pushd $final_path/build pushd "$final_path"/build || exit
sudo -u "$app" env PATH=$PATH cargo build --features sqlite --release sudo -u "$app" env PATH="$PATH" cargo build --features sqlite --release
popd popd || exit
# Install bitwarden_rs # Install bitwarden_rs
cp -a $final_path/build/target/release/. $final_path/live/. cp -a "$final_path"/build/target/release/. "$final_path"/live/.
# Remove build files and rustup # Remove build files and rustup
ynh_secure_remove --file="$final_path/build" ynh_secure_remove --file="$final_path/build"
@ -173,7 +173,7 @@ ynh_store_file_checksum --file="$config"
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown -R "$app":"$app" $final_path chown -R "$app":"$app" "$final_path"
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
chown -R "$app":"$app" "/var/log/$app" chown -R "$app":"$app" "/var/log/$app"
@ -189,7 +189,7 @@ ynh_use_logrotate
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log" yunohost service add "$app" --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -197,9 +197,9 @@ yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Rocket has launched from"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" --line_match="Rocket has launched from"
fi fi
#================================================= #=================================================
@ -208,7 +208,7 @@ fi
ynh_script_progression --message="Configuring fail2ban..." --weight=5 ynh_script_progression --message="Configuring fail2ban..." --weight=5
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
touch /var/log/$app/$app.log touch /var/log/"$app"/"$app".log
ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Username or password is incorrect\. Try again\. IP: <HOST>\. Username:.*$" ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Username or password is incorrect\. Try again\. IP: <HOST>\. Username:.*$"
#================================================= #=================================================
@ -217,10 +217,10 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Usern
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ "$is_public" -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
fi fi
#================================================= #=================================================
@ -239,7 +239,7 @@ ynh_replace_string --match_string="__ADMIN_MAIL__" --replace_string="$admin_m
ynh_replace_string --match_string="__ADMIN_TOKEN__" --replace_string="$admin_token" --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="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message" --recipients=$admin_mail --type='install' ynh_send_readme_to_admin --app_message="../conf/message" --recipients="$admin_mail" --type='install'
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -16,8 +16,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app="$app" --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -26,10 +26,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# Remove a service from the admin panel, added by `yunohost service add` # Remove a service from the admin panel, added by `yunohost service add`
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_exec_warn_less yunohost service status "$app" >/dev/null
then then
ynh_script_progression --message="Removing $app service..." --weight=1 ynh_script_progression --message="Removing $app service..." --weight=1
yunohost service remove $app yunohost service remove "$app"
fi fi
#================================================= #=================================================
@ -97,7 +97,7 @@ ynh_secure_remove --file="/var/log/$app/"
ynh_script_progression --message="Removing the dedicated system user..." --weight=1 ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username="$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -27,18 +27,18 @@ ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app="$app" --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app="$app" --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain="$domain" --path_url="$path_url" \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d "$final_path" \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
@ -62,16 +62,16 @@ ynh_restore_file --origin_path="$final_path"
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username="$app" --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Restore permissions on app files # Restore permissions on app files
chown -R "$app":"$app" $final_path chown -R "$app":"$app" "$final_path"
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
chown -R "$app":"$app" /var/log/$app chown -R "$app":"$app" /var/log/"$app"
#================================================= #=================================================
# RESTORE FAIL2BAN CONFIGURATION # RESTORE FAIL2BAN CONFIGURATION
@ -81,7 +81,7 @@ ynh_script_progression --message="Restoring the fail2ban configuration..." --wei
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
chown -R "$app":"$app" "/var/log/$app" chown -R "$app":"$app" "/var/log/$app"
touch /var/log/$app/$app.log touch /var/log/"$app"/"$app".log
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
@ -95,7 +95,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban
ynh_script_progression --message="Reinstalling dependencies..." --weight=8 ynh_script_progression --message="Reinstalling dependencies..." --weight=8
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
@ -103,22 +103,22 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service systemctl enable "$app".service
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log" yunohost service add "$app" --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Rocket has launched from"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" --line_match="Rocket has launched from"
fi fi
#================================================= #=================================================

View file

@ -16,15 +16,15 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app="$app" --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app="$app" --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app="$app" --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
admin_token=$(ynh_app_setting_get --app=$app --key=admin_token) admin_token=$(ynh_app_setting_get --app="$app" --key=admin_token)
rocket_port=$(ynh_app_setting_get --app=$app --key=rocket_port) rocket_port=$(ynh_app_setting_get --app="$app" --key=rocket_port)
websocket_port=$(ynh_app_setting_get --app=$app --key=websocket_port) websocket_port=$(ynh_app_setting_get --app="$app" --key=websocket_port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -39,17 +39,17 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value # Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1 ynh_app_setting_set --app="$app" --key=is_public --value=1
is_public=1 is_public=1
elif [ "$is_public" = "No" ]; then elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0 ynh_app_setting_set --app="$app" --key=is_public --value=0
is_public=0 is_public=0
fi fi
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
final_path=/var/www/$app final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
fi fi
#================================================= #=================================================
@ -74,7 +74,7 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server" ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -104,7 +104,7 @@ ynh_add_nginx_config "websocket_port rocket_port"
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=5 ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -112,7 +112,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username="$app" --home_dir="$final_path"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -122,24 +122,24 @@ ynh_system_user_create --username=$app --home_dir=$final_path
ynh_script_progression --message="Making upgrade..." --weight=760 ynh_script_progression --message="Making upgrade..." --weight=760
# Set right permissions # Set right permissions
chown -R "$app":"$app" $final_path chown -R "$app":"$app" "$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
# Install rustup with the toolchain needed by bitwarden_rs # Install rustup with the toolchain needed by bitwarden_rs
pushd $final_path pushd "$final_path" || exit
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=$(cat build/rust-toolchain)' sudo -u "$app" RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=$(cat build/rust-toolchain)'
popd popd || exit
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
# Compile bitwarden_rs # Compile bitwarden_rs
pushd $final_path/build pushd "$final_path"/build || exit
sudo -u "$app" env PATH=$PATH cargo build --features sqlite --release sudo -u "$app" env PATH="$PATH" cargo build --features sqlite --release
popd popd || exit
# Install bitwarden_rs # Install bitwarden_rs
cp -a $final_path/build/target/release/. $final_path/live/. cp -a "$final_path"/build/target/release/. "$final_path"/live/.
# Remove build files and rustup # Remove build files and rustup
ynh_secure_remove --file="$final_path/build" ynh_secure_remove --file="$final_path/build"
@ -201,9 +201,9 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Usern
#================================================= #=================================================
# Set permissions on app files # Set permissions on app files
chown -R "$app":"$app" $final_path chown -R "$app":"$app" "$final_path"
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
chown -R "$app":"$app" /var/log/$app chown -R "$app":"$app" /var/log/"$app"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
@ -214,7 +214,7 @@ ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway # unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
fi fi
#================================================= #=================================================
@ -222,9 +222,9 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Rocket has launched from"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Rocket has launched from" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" --line_match="Rocket has launched from"
fi fi
#================================================= #=================================================

View file

@ -23,7 +23,7 @@ ynh_send_readme_to_admin() {
type="${type:-install}" type="${type:-install}"
# Get the value of admin_mail_html # Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html=$(ynh_app_setting_get "$app" admin_mail_html)
admin_mail_html="${admin_mail_html:-0}" admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users # Retrieve the email of users