Add lzo, lzma and gzip support

This commit is contained in:
Kron4ek 2021-06-10 19:58:12 +05:00
parent b6cfb6eddb
commit ff29fd4d5f
4 changed files with 39 additions and 14 deletions

View file

@ -47,7 +47,7 @@ scriptsize=20179
# The size of the utils.tar archive
# utils.tar contains bwrap and squashfuse binaries
utilssize=4270080
utilssize=4679680
# Offset where the squashfs image is stored
offset=$((scriptsize+utilssize))

View file

@ -1,15 +1,16 @@
#!/usr/bin/env bash
# Dependencies: squashfs-tools zstd lz4
# Dependencies: squashfs-tools
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
# Builtin squashfuse supports only lz4 and zstd
# So choose either lz4 or zstd
# Supported compression algorithms: lz4, zstd, gzip, xz, lzo
# These are the algorithms supported by the integrated squashfuse
# However, your squashfs-tools (mksquashfs) may not support some of them
squashfs_compressor="lz4"
compressor_arguments="-Xhc"
# Set to true to use the existing squashfs image if it exists
# Set to true to use an existing squashfs image if it exists
# Otherwise the script will always create a new image
use_existing_image="false"
@ -33,10 +34,28 @@ if ! command -v mksquashfs 1>/dev/null; then
fi
if [ ! -d "${bootstrap}" ]; then
echo "Bootstrap is required!"
echo "Distro bootstrap is required!"
echo "Use the create-arch-bootstrap.sh script to get it"
exit 1
fi
# Check if selected compression algorithm is supported by mksquashfs
if command -v grep 1>/dev/null; then
# mksquashfs writes its output to stderr instead of stdout
mksquashfs &>mksquashfs_out.txt
if [ ! "$(cat mksquashfs_out.txt | grep ${squashfs_compressor})" ]; then
echo "Seems like your mksquashfs doesn't support the selected"
echo "compression algorithm (${squashfs_compressor})."
echo
echo "Choose another algorithm and run the script again"
exit 1
fi
rm -f mksquashfs_out.txt
fi
echo
echo "Creating Conty..."
echo

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Dependencies: wget gcc make autoconf libtool pkgconf libcap fuse2 (or fuse3)
# Dependencies: lz4 zstd wget gcc make autoconf libtool pkgconf libcap fuse2 (or fuse3)
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -41,7 +41,7 @@ make -j$(nproc) DESTDIR="${script_dir}"/build-utils/bin install
cd ../squashfuse-${squashfuse_version}
./autogen.sh
./configure --without-zlib --without-xz --without-lzo
./configure
make -j$(nproc) DESTDIR="${script_dir}"/build-utils/bin install
cd "${script_dir}"/build-utils
@ -60,16 +60,22 @@ if [ ! "$(ldd utils/squashfuse | grep libfuse.so.2)" ]; then
fi
libs_list="ld-linux-x86-64.so.2 libcap.so.2 libc.so.6 libdl.so.2 \
libfuse.so.2 libfuse3.so.3 libpthread.so.0"
libfuse.so.2 libfuse3.so.3 libpthread.so.0 libz.so.1 \
liblzma.so.5 liblzo2.so.2"
if [ -d /lib/x86_64-linux-gnu ]; then
syslib_path=/lib/x86_64-linux-gnu
syslib_path="/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu"
else
syslib_path=/usr/lib
syslib_path="/usr/lib /usr/lib64"
fi
for i in ${libs_list}; do
cp -L "${syslib_path}"/"${i}" utils
for j in ${syslib_path}; do
if [ -f "${j}"/"${i}" ]; then
cp -L "${j}"/"${i}" utils
break
fi
done
done
find utils -type f -exec strip --strip-unneeded {} \; 2>/dev/null

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5317be4f8a013eecc680b32c40321ca6f2eae0b36a5134a572bbe1f80d083370
size 4270080
oid sha256:1983330d428449462b047fba52c2fca8a551a6da88768992338830bcc3e1442e
size 4679680