2018-06-14 02:13:59 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-04-10 23:29:40 +02:00
|
|
|
BORG_VERSION=1.2.8
|
2018-06-14 02:13:59 +02:00
|
|
|
|
2019-05-21 17:05:24 +02:00
|
|
|
# Install borg with pip if borg is not here
|
|
|
|
install_borg_with_pip () {
|
2021-04-08 20:20:10 +02:00
|
|
|
if [ -d /opt/borg-env ]; then
|
2021-12-02 16:58:51 +01:00
|
|
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip list | grep "borgbackup *$BORG_VERSION" || ynh_secure_remove /opt/borg-env
|
2021-04-08 20:20:10 +02:00
|
|
|
fi
|
2019-05-21 17:05:24 +02:00
|
|
|
if [ ! -d /opt/borg-env ]; then
|
2021-01-11 00:34:05 +01:00
|
|
|
python3 -m venv /opt/borg-env
|
2024-04-10 23:29:40 +02:00
|
|
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip install pip -U
|
|
|
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip install setuptools -U
|
|
|
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip install wheel -U
|
2021-04-11 18:55:48 +02:00
|
|
|
ynh_print_info --message="Installing/compiling borg, this may take some time..."
|
2024-04-10 23:29:40 +02:00
|
|
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup[pyfuse3]==$BORG_VERSION
|
2019-05-21 17:05:24 +02:00
|
|
|
echo "#!/bin/bash
|
|
|
|
/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg
|
2021-04-08 20:20:10 +02:00
|
|
|
touch "/opt/borg-env/$(ynh_get_debian_release)"
|
2019-05-21 17:05:24 +02:00
|
|
|
fi
|
2021-04-08 20:20:10 +02:00
|
|
|
# We need this to be executable by other borg apps
|
|
|
|
chmod a+x /usr/local/bin/borg
|
2019-05-21 17:05:24 +02:00
|
|
|
}
|