test: make passt.mbuto script more robust

Creation of a symbolic link from /sbin to /usr/sbin fails if /sbin
exists and is non-empty. This is the case on Ubuntu-23.04.

We fix this by removing /sbin before creating the link.

Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Jon Paul Maloy 2023-12-14 16:12:19 -05:00 committed by Stefano Brivio
parent 6a348cb435
commit f0ccca741f

View file

@ -26,6 +26,9 @@ DIRS="${DIRS} /tmp /sbin /usr/share /var/log /var/lib /etc/ssh /run/sshd /root/.
COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin" COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin"
FIXUP="${FIXUP}"' FIXUP="${FIXUP}"'
mv /sbin/* /usr/sbin || :
rm -rf /sbin
ln -s /usr/sbin /sbin
cat > /sbin/dhclient-script << EOF cat > /sbin/dhclient-script << EOF
#!/bin/sh #!/bin/sh
LOG=/var/log/dhclient-script.log LOG=/var/log/dhclient-script.log
@ -47,7 +50,6 @@ set >> \$LOG
exit 0 exit 0
EOF EOF
chmod 755 /sbin/dhclient-script chmod 755 /sbin/dhclient-script
ln -s /sbin /usr/sbin
ln -s /bin /usr/bin ln -s /bin /usr/bin
ln -s /run /var/run ln -s /run /var/run
:> /etc/fstab :> /etc/fstab