mirror of
https://github.com/Kron4ek/Conty
synced 2024-12-26 09:58:38 +01:00
Add glibc libs and fuse3 support
The integrated utils now include two squashfuse binaries: the one is for fuse2 and the second is for fuse3. Conty will automatically use the fuse3 version if fuse3 is installed, otherwise it will use the fuse2 version. Besides, glibc libs are now included and they are used for the integrated utils. Which means that the integrated utils now don't depend on system-wide glibc and will work even on really old distros (like Ubuntu 12.04, for example), assuming that kernel version is new enough, of course.
This commit is contained in:
parent
ceca3a65ad
commit
358acd8aca
3 changed files with 43 additions and 20 deletions
|
@ -43,11 +43,11 @@ mount_point="${working_dir}"/mnt
|
|||
# a problem with mounting the squashfs image due to an incorrectly calculated offset.
|
||||
|
||||
# The size of this script
|
||||
scriptsize=19853
|
||||
scriptsize=20179
|
||||
|
||||
# The size of the utils.tar archive
|
||||
# utils.tar contains bwrap and squashfuse binaries
|
||||
utilssize=1515520
|
||||
utilssize=4270080
|
||||
|
||||
# Offset where the squashfs image is stored
|
||||
offset=$((scriptsize+utilssize))
|
||||
|
@ -149,10 +149,26 @@ exec_test () {
|
|||
fi
|
||||
}
|
||||
|
||||
launch_wrapper () {
|
||||
if [ "$1" = "mount" ]; then
|
||||
${use_sudo} "$@"
|
||||
elif [ "${USE_SYS_UTILS}" = 1 ]; then
|
||||
"$@"
|
||||
else
|
||||
"${working_dir}"/utils/ld-linux-x86-64.so.2 --library-path "${working_dir}"/utils "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if FUSE2 is installed when SUDO_MOUNT is not enabled
|
||||
if [ "${SUDO_MOUNT}" != 1 ] && ! command -v fusermount 1>/dev/null; then
|
||||
echo "Please install fuse2 and run the script again!"
|
||||
exit 1
|
||||
if [ "${SUDO_MOUNT}" != 1 ]; then
|
||||
if ! command -v fusermount3 1>/dev/null && ! command -v fusermount 1>/dev/null; then
|
||||
echo "Please install fuse2 or fuse3 and run the script again!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v fusermount3 1>/dev/null; then
|
||||
fuse_version=3
|
||||
fi
|
||||
fi
|
||||
|
||||
# Extract utils.tar
|
||||
|
@ -174,7 +190,7 @@ if [ "${USE_SYS_UTILS}" != 1 ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
mount_tool="${working_dir}"/utils/squashfuse
|
||||
mount_tool="${working_dir}"/utils/squashfuse${fuse_version}
|
||||
bwrap="${working_dir}"/utils/bwrap
|
||||
|
||||
if [ ! -f "${mount_tool}" ] || [ ! -f "${bwrap}" ]; then
|
||||
|
@ -193,8 +209,6 @@ if [ "${USE_SYS_UTILS}" != 1 ]; then
|
|||
chmod +x "${mount_tool}"
|
||||
chmod +x "${bwrap}"
|
||||
fi
|
||||
|
||||
export LD_LIBRARY_PATH="${working_dir}/utils:${LD_LIBRARY_PATH}"
|
||||
else
|
||||
if ! command -v bwrap 1>/dev/null; then
|
||||
echo "USE_SYS_UTILS is enabled, but bwrap is not installed!"
|
||||
|
@ -410,7 +424,7 @@ run_bwrap () {
|
|||
|
||||
echo
|
||||
|
||||
"${bwrap}" --ro-bind "${mount_point}" / \
|
||||
launch_wrapper "${bwrap}" --ro-bind "${mount_point}" / \
|
||||
--dev-bind /dev /dev \
|
||||
--ro-bind /sys /sys \
|
||||
--bind-try /tmp /tmp \
|
||||
|
@ -551,7 +565,7 @@ trap_exit () {
|
|||
rm -f "${working_dir}"/running_"${script_id}"
|
||||
|
||||
if [ ! "$(ls "${working_dir}"/running_* 2>/dev/null)" ]; then
|
||||
fusermount -uz "${mount_point}" 2>/dev/null || \
|
||||
fusermount${fuse_version} -uz "${mount_point}" 2>/dev/null || \
|
||||
${use_sudo} umount --lazy "${mount_point}" 2>/dev/null
|
||||
|
||||
rm -rf "${working_dir}"
|
||||
|
@ -566,7 +580,7 @@ trap 'trap_exit' EXIT
|
|||
mkdir -p "${mount_point}"
|
||||
|
||||
if [ "$(ls "${mount_point}" 2>/dev/null)" ] || \
|
||||
${use_sudo} "${mount_tool}" -o offset="${offset}",ro "${script}" "${mount_point}" ; then
|
||||
launch_wrapper "${mount_tool}" -o offset="${offset}",ro "${script}" "${mount_point}" ; then
|
||||
|
||||
echo 1 > "${working_dir}"/running_"${script_id}"
|
||||
|
||||
|
|
|
@ -54,12 +54,24 @@ mv bin/usr/local/lib/libzstd.so.${zstd_version} utils/libzstd.so.1
|
|||
mv bin/usr/local/lib/libfuseprivate.so.0.0.0 utils/libfuseprivate.so.0
|
||||
mv bin/usr/local/lib/libsquashfuse.so.0.0.0 utils/libsquashfuse.so.0
|
||||
|
||||
if [ -f /usr/lib/libcap.so.2 ]; then
|
||||
cp -L /usr/lib/libcap.so.2 utils/libcap.so.2
|
||||
elif [ -f /lib/x86_64-linux-gnu/libcap.so.2 ]; then
|
||||
cp -L /lib/x86_64-linux-gnu/libcap.so.2 utils/libcap.so.2
|
||||
if [ ! "$(ldd utils/squashfuse | grep libfuse.so.2)" ]; then
|
||||
mv utils/squashfuse utils/squashfuse3
|
||||
mv utils/squashfuse_ll utils/squashfuse3_ll
|
||||
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"
|
||||
|
||||
if [ -d /lib/x86_64-linux-gnu ]; then
|
||||
syslib_path=/lib/x86_64-linux-gnu
|
||||
else
|
||||
syslib_path=/usr/lib
|
||||
fi
|
||||
|
||||
for i in ${libs_list}; do
|
||||
cp -L "${syslib_path}"/"${i}" utils
|
||||
done
|
||||
|
||||
find utils -type f -exec strip --strip-unneeded {} \; 2>/dev/null
|
||||
|
||||
cat <<EOF > utils/info
|
||||
|
@ -77,6 +89,3 @@ rm -rf build-utils
|
|||
|
||||
clear
|
||||
echo "Done!"
|
||||
echo
|
||||
echo "Keep in mind that your glibc version is: $(ldd --version | head -n 1)"
|
||||
echo "The compiled utils will not work with older glibc versions!"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ca83dc1213867b68a29816219fd0ffe857a928803806bdbae5efc13798a2650b
|
||||
size 1515520
|
||||
oid sha256:5317be4f8a013eecc680b32c40321ca6f2eae0b36a5134a572bbe1f80d083370
|
||||
size 4270080
|
||||
|
|
Loading…
Reference in a new issue