wsldl icon indicating copy to clipboard operation
wsldl copied to clipboard

zstd support

Open Vinfall opened this issue 1 year ago • 3 comments
trafficstars

Zstandard is a loseless compression algorithm, and dual-licensed under BSD OR GPLv2.

WSL supports importing quite a few formats already like .tar., .tar.xz, .tar.gz and .tar.zst.

I'm aware of https://github.com/yuk7/wsldl/issues/109 and agree with the size increase worry. Regarding implementation, do you mean a go package for the compression algorithms or something else? If you mean packages, I think this or this would work.

To test if it's possible, I just blindly modified https://github.com/yuk7/wsldl/blob/3672589d073871b495efbd11614fa7554455ed7a/src/install/install.go#L20-L22 and gladly importing .tar.zst just works. A more thorough support would require importing the package and change https://github.com/yuk7/wsldl/blob/3672589d073871b495efbd11614fa7554455ed7a/src/install/install.go#L106-L124 or wherever I'm unaware of.

A test build of wsldl is available here and I successfully built DevuanWSL based on that. Running Devuan.exe does register the instance and it works flawlessly as far as I can tell so it should be feasible I guess.

Vinfall avatar Apr 13 '24 11:04 Vinfall

Ok, I understood. I'll support it.

yuk7 avatar May 05 '24 13:05 yuk7

I have released a new build that supports .tar.zst rootfs. Please note that this may not be available in users version of WSL.

I will decide later whether to support zstd compression for vhd installs and backups.

yuk7 avatar May 06 '24 06:05 yuk7

I'll keep this open as it's just partially solved, but personally I use native WSL export and redirecting that to Zstandard works perfectly, thus having no preference on zstd compression support by wsldl.

Code snippet in case anyone is interested:

wsl --shutdown
cd path\to\distro
# Make sure to use cmd as PowerShell pipe is known to be problematic
cmd /c "wsl --export Devuan - | zstd -T0 -o Devuan-$(Get-Date -UFormat "%Y%m%d").tar.zst"

Vinfall avatar May 07 '24 01:05 Vinfall