[PATCH v2] install.sh: Preserve symlinks in destination file system

Thierry Escande posted 1 patch 4 days, 1 hour ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260319165047.900047-1-thierry.escande@vates.tech
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] install.sh: Preserve symlinks in destination file system
Posted by Thierry Escande 4 days, 1 hour ago
In various distros (i.e. Debian), /lib is a symbolic link. The tar
command in install.sh replaces the /lib symlink with a directory and
results in a non-functioning system. This has been introduced by the
installation of the systemd watchdog sleep script in /lib/systemd.

This patch adds the tar option --dereference (-h for short) to preserve
symlinks when extracting the dist archive.

Fixes: e54a6cd6a1f3 ("systemd: Add hooks to stop/start xen-watchdog on suspend/resume")
Signed-off-by: Thierry Escande <thierry.escande@vates.tech>
---
Changes in v2:
* Use more standard -h option instead of --keep-directory-symlink
* Update commit message

 install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sh b/install.sh
index 3e11c4d46f..1d74541320 100644
--- a/install.sh
+++ b/install.sh
@@ -27,7 +27,7 @@ tmp="`mktemp -d`"
 echo "Installing Xen from '$src' to '$dst'..."
 (cd $src; tar -cf - * ) | tar -C "$tmp" -xf -
 
-(cd $tmp; tar -cf - *) | tar --no-same-owner -C "$dst" -xf -
+(cd $tmp; tar -cf - *) | tar --no-same-owner -C "$dst" -xhf -
 rm -rf "$tmp"
 
 echo "All done."
-- 
2.51.0



--
Thierry Escande | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH v2] install.sh: Preserve symlinks in destination file system
Posted by Jason Andryuk 3 days, 4 hours ago
On 2026-03-19 12:50, Thierry Escande wrote:
> In various distros (i.e. Debian), /lib is a symbolic link. The tar
> command in install.sh replaces the /lib symlink with a directory and
> results in a non-functioning system. This has been introduced by the
> installation of the systemd watchdog sleep script in /lib/systemd.
> 
> This patch adds the tar option --dereference (-h for short) to preserve
> symlinks when extracting the dist archive.
> 
> Fixes: e54a6cd6a1f3 ("systemd: Add hooks to stop/start xen-watchdog on suspend/resume")
> Signed-off-by: Thierry Escande <thierry.escande@vates.tech>

Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Tested-by: Jason Andryuk <jason.andryuk@amd.com>

Thanks,
Jason