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

46 lines
1.4 KiB
Bash
Raw Normal View History

2019-08-05 01:29:15 +02:00
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
2023-12-03 12:08:34 +01:00
_download_vaultwarden_from_docker() {
2023-12-03 12:13:43 +01:00
docker_image="vaultwarden/server"
debian=$(lsb_release --codename --short)
if [[ $debian = "bullseye" ]]; then
docker_version="$(ynh_app_upstream_version)"
elif [[ $debian = "bookworm" ]]; then
docker_version="$(ynh_app_upstream_version)-alpine"
fi
2023-12-03 12:08:34 +01:00
docker_arg=""
# Fixup for armhf
if [ "$YNH_ARCH" == "armhf" ]; then
2023-12-03 12:08:34 +01:00
docker_arg="--os_arch_variant=linux/arm/v7"
fi
2023-12-03 12:13:43 +01:00
ynh_docker_image_extract --dest_dir="$install_dir/build/" --image_spec="$docker_image:$docker_version" $docker_arg
# Move files from the extract to the live directory
ynh_secure_remove --file="$install_dir/live/"
mkdir -p "$install_dir/live/"
mv -f "$install_dir/build/"{vaultwarden,web-vault} "$install_dir/live/"
ynh_secure_remove --file="$install_dir/build"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
2023-12-03 12:08:34 +01:00
}
2019-08-05 01:29:15 +02:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================