yuk7 / wsldl

Advanced WSL launcher / installer. (Win10 FCU x64/arm64 or later.)
https://git.io/wsldl
MIT License
1.76k stars 131 forks source link

zstd support #152

Open Vinfall opened 7 months ago

Vinfall commented 7 months ago

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.

yuk7 commented 6 months ago

Ok, I understood. I'll support it.

yuk7 commented 6 months ago

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.

Vinfall commented 6 months ago

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"