mirror of
https://github.com/Kron4ek/Conty
synced 2024-11-16 19:50:06 +01:00
Split squashfs and dwarfs utils
The dwarfs utils are relatively large (~20 MB when extracted) and are not needed for squashfs-compressed images, so it's better to move them into a separate archive.
This commit is contained in:
parent
268ff808ba
commit
d97077d026
5 changed files with 42 additions and 14 deletions
|
@ -43,11 +43,11 @@ mount_point="${working_dir}"/mnt
|
|||
# a problem with mounting the image due to an incorrectly calculated offset.
|
||||
|
||||
# The size of this script
|
||||
scriptsize=24850
|
||||
scriptsize=25303
|
||||
|
||||
# The size of the utils.tar.gz archive
|
||||
# utils.tar.gz contains bwrap, squashfuse and dwarfs binaries
|
||||
utilssize=9144313
|
||||
utilssize=2923949
|
||||
|
||||
# Offset where the image is stored
|
||||
offset=$((scriptsize+utilssize))
|
||||
|
@ -404,15 +404,21 @@ if [ "$1" = "-u" ] || [ "$1" = "-U" ]; then
|
|||
# on what command line argument is used (-u or -U)
|
||||
clear
|
||||
if [ "$1" = "-U" ] && command -v wget 1>/dev/null; then
|
||||
if [ "${dwarfs_image}" = 1 ]; then
|
||||
utils="utils_dwarfs.tar.gz"
|
||||
else
|
||||
utils="utils.tar.gz"
|
||||
fi
|
||||
|
||||
echo "Downloading the init script and the utils"
|
||||
wget -q --show-progress "https://github.com/Kron4ek/Conty/raw/master/conty-start.sh"
|
||||
wget -q --show-progress "https://github.com/Kron4ek/Conty/raw/master/utils.tar.gz"
|
||||
wget -q --show-progress -O utils.tar.gz "https://github.com/Kron4ek/Conty/raw/master/${utils}"
|
||||
fi
|
||||
|
||||
if [ ! -s conty-start.sh ] || [ ! -s utils.tar.gz ]; then
|
||||
echo "Extracting the init script and the integrated utils"
|
||||
tail -c +$((scriptsize+1)) "${script}" | head -c $utilssize > utils.tar.gz
|
||||
head -c $scriptsize "${script}" > conty-start.sh
|
||||
tail -c +$((scriptsize+1)) "${script}" | head -c ${utilssize} > utils.tar.gz
|
||||
head -c ${scriptsize} "${script}" > conty-start.sh
|
||||
fi
|
||||
|
||||
# Check if there are additional arguments passed
|
||||
|
@ -714,6 +720,12 @@ fi
|
|||
# Mount the image
|
||||
mkdir -p "${mount_point}"
|
||||
|
||||
# Since mounting dwarfs images is relatively slow on HDDs, it's better
|
||||
# to show a message when the mounting is in process
|
||||
if [ "${dwarfs_image}" = 1 ] && [ ! "$(ls "${mount_point}" 2>/dev/null)" ]; then
|
||||
show_msg "Mounting the image, please wait..."
|
||||
fi
|
||||
|
||||
if [ "$(ls "${mount_point}" 2>/dev/null)" ] || \
|
||||
( [ "${dwarfs_image}" != 1 ] && launch_wrapper "${mount_tool}" -o offset="${offset}",ro "${script}" "${mount_point}" ) || \
|
||||
launch_wrapper "${mount_tool}" "${script}" "${mount_point}" -o offset="${offset}" -o debuglevel=error -o workers="${dwarfs_num_workers}" \
|
||||
|
@ -733,6 +745,10 @@ if [ "$(ls "${mount_point}" 2>/dev/null)" ] || \
|
|||
|
||||
echo 1 > "${working_dir}"/running_"${script_id}"
|
||||
|
||||
if [ "${dwarfs_image}" = 1 ] && [ "${QUIET_MODE}" != 1 ]; then
|
||||
clear
|
||||
fi
|
||||
|
||||
show_msg "Running Conty"
|
||||
|
||||
if [ "${NVIDIA_FIX}" = 1 ]; then
|
||||
|
|
|
@ -25,9 +25,15 @@ bootstrap="${script_dir}"/root.x86_64
|
|||
|
||||
cd "${script_dir}" || exit 1
|
||||
|
||||
if [ ! -f utils.tar.gz ] || [ "$(wc -c < utils.tar.gz)" -lt 1000 ]; then
|
||||
rm -f utils.tar.gz
|
||||
wget -q --show-progress "https://github.com/Kron4ek/Conty/raw/master/utils.tar.gz"
|
||||
if [ "${dwarfs}" = "true" ]; then
|
||||
utils="utils_dwarfs.tar.gz"
|
||||
else
|
||||
utils="utils.tar.gz"
|
||||
fi
|
||||
|
||||
if [ ! -f "${utils}" ] || [ "$(wc -c < "${utils}")" -lt 1000 ]; then
|
||||
rm -f "${utils}"
|
||||
wget -q --show-progress "https://github.com/Kron4ek/Conty/raw/master/${utils}"
|
||||
fi
|
||||
|
||||
if [ ! -f conty-start.sh ]; then
|
||||
|
@ -83,7 +89,7 @@ if [ ! -f "${image_path}" ] || [ "${use_existing_image}" != "true" ]; then
|
|||
fi
|
||||
|
||||
# Combine the files into a single executable using cat
|
||||
cat conty-start.sh utils.tar.gz "${image_path}" > conty.sh
|
||||
cat conty-start.sh "${utils}" "${image_path}" > conty.sh
|
||||
chmod +x conty.sh
|
||||
|
||||
clear
|
||||
|
|
|
@ -117,11 +117,14 @@ EOF
|
|||
|
||||
if [ "${build_dwarfs}" = "true" ]; then
|
||||
echo "dwarfs ${dwarfs_version}" >> utils/info
|
||||
utils="utils_dwarfs.tar.gz"
|
||||
else
|
||||
utils="utils.tar.gz"
|
||||
fi
|
||||
|
||||
tar -zcf utils.tar.gz utils
|
||||
mv "${script_dir}"/utils.tar.gz "${script_dir}"/utils_old.tar.gz
|
||||
mv utils.tar.gz "${script_dir}"
|
||||
tar -zcf "${utils}" utils
|
||||
mv "${script_dir}"/"${utils}" "${script_dir}"/"${utils}".old
|
||||
mv "${utils}" "${script_dir}"
|
||||
cd "${script_dir}" || exit 1
|
||||
rm -rf build-utils
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f02bdddb8c050751aa359e3bdabac08e1e2cc6ef767f0572fb84ccaec3a6012a
|
||||
size 9144313
|
||||
oid sha256:45bd5a06896afb76530520c16568849247c4719fcf0804539d3e71fac4444d65
|
||||
size 2923949
|
||||
|
|
3
utils_dwarfs.tar.gz
Normal file
3
utils_dwarfs.tar.gz
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f22893f87d79907c1d95bd0a9a3db00a9ff176739e91268aef91d5a996e26a3d
|
||||
size 8874518
|
Loading…
Reference in a new issue