Implement WSL hooks for Focal

The same hooks used to build Jammy and later
This commit is contained in:
Carlos Nihelton 2025-06-27 16:46:45 -03:00 committed by Carlos Nihelton
parent 53ccadc770
commit beb2bf1565
No known key found for this signature in database
GPG Key ID: B5A3E4BCA4EE69AB
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
# vi: ts=4 expandtab
#
# Enable systemd by default on our WSL image
#
cat <<EOF >/etc/wsl.conf
[boot]
systemd=true
EOF

View File

@ -0,0 +1,20 @@
#!/bin/bash -eu
# vi: ts=4 expandtab
#
# Create wsl-distribution.conf for WSL setup
#
source /etc/os-release
cat <<EOF >/etc/wsl-distribution.conf
[oobe]
command = /usr/lib/wsl/wsl-setup
defaultUid = 1000
defaultName = ${NAME}-${VERSION_ID}
[shortcut]
icon = /usr/share/wsl/ubuntu.ico
[windowsterminal]
ProfileTemplate = /usr/share/wsl/terminal-profile.json
EOF

View File

@ -0,0 +1,10 @@
#!/bin/bash
#
# Create the necessary groups
#
echo "Adding admin group..."
addgroup --system --quiet admin
echo "Adding netdev group..."
addgroup --system --quiet netdev

View File

@ -0,0 +1,25 @@
#!/bin/bash -eu
# vi: ts=4 expandtab
#
# Generate the compressed root directory for WSL manually.
# Type "plain" unfortunately does not execute lb_binary_* helpers.
case $ARCH in
amd64|arm64)
;;
*)
echo "WSL root tarballs are not generated for $ARCH."
exit 0;;
esac
## remove attributes not supported by WSL's tar
setfattr -x system.posix_acl_access chroot/var/log/journal
setfattr -x system.posix_acl_default chroot/var/log/journal
# Create the rootfs as a .wsl extension
cd chroot
tar --xattrs --sort=name -czf ../livecd.$PROJECT${SUBARCH:+-$SUBARCH}.wsl *
cd ..
# Remove initial ext4-formatted fs
rm -f binary/boot/filesystem.ext4