mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-05 20:32:15 +00:00
fix(backup): isolate native Borg from AppImage Python and library paths
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# Borg 1.2.8 has no official ARM64 standalone release. Never ship or run
|
||||
# its AMD64 executable on ARM; use the host's native distro package instead.
|
||||
if [ -x /usr/bin/borg ]; then
|
||||
# The distro package must use its own Python modules and shared libraries.
|
||||
unset PYTHONPATH PYTHONHOME LD_LIBRARY_PATH
|
||||
exec /usr/bin/borg "$@"
|
||||
fi
|
||||
echo 'Native Borg is unavailable. Install the native borgbackup package on this host to use Borg backups.' >&2
|
||||
|
||||
@@ -100,10 +100,12 @@ class AppImageArchitectureTests(unittest.TestCase):
|
||||
missing = subprocess.run(['sh', str(adapter), '--version'], capture_output=True, text=True)
|
||||
self.assertEqual(missing.returncode, 127)
|
||||
self.assertIn('Install the native borgbackup package', missing.stderr)
|
||||
native.write_text('#!/bin/sh\nprintf "native %s" "$*"\n')
|
||||
native.write_text('#!/bin/sh\nprintf "native %s|%s|%s|%s" "$*" "${PYTHONPATH-unset}" "${PYTHONHOME-unset}" "${LD_LIBRARY_PATH-unset}"\n')
|
||||
native.chmod(0o755)
|
||||
installed = subprocess.run(['sh', str(adapter), 'list', 'fixture-repo'], capture_output=True, text=True, check=True)
|
||||
self.assertEqual(installed.stdout, 'native list fixture-repo')
|
||||
installed = subprocess.run(['sh', str(adapter), 'list', 'fixture-repo'],
|
||||
env={**os.environ, 'PYTHONPATH': '/fixture/appimage/python', 'PYTHONHOME': '/fixture/appimage/home',
|
||||
'LD_LIBRARY_PATH': '/fixture/appimage/lib'}, capture_output=True, text=True, check=True)
|
||||
self.assertEqual(installed.stdout, 'native list fixture-repo|unset|unset|unset')
|
||||
|
||||
def test_arm_host_backup_never_selects_cached_amd64_borg_or_downloads_it(self):
|
||||
source = (ROOT / 'scripts/backup_restore/lib_host_backup_common.sh').read_text()
|
||||
|
||||
Reference in New Issue
Block a user