Files
Ventoy/build-scripts/integration/krd/krd-new-repack.sh
T

37 lines
1.4 KiB
Bash

#!/bin/bash
set -e
W=/root/krd24
cd "$W"
if grep -q 'Paravis: KRD from files' sqroot/etc/KRD/live_env.sh; then
echo " уже пропатчено"
else
python3 - <<'EOF'
import io
p='/root/krd24/sqroot/etc/KRD/live_env.sh'
s=io.open(p,encoding='utf-8').read()
old='export KRD_LIVE_LAYERS_BOOT_FOLDER="/run/live/medium"\n'
new=('export KRD_LIVE_LAYERS_BOOT_FOLDER="/run/live/medium"\n'
'# Paravis: KRD from files (efi/Paravis/KRD/live) instead of ISO image\n'
'if [[ -d "/run/live/medium/efi/Paravis/KRD/live/KRD" ]]\n'
'then\n'
' export KRD_LIVE_LAYERS_BOOT_FOLDER="/run/live/medium/efi/Paravis/KRD"\n'
'fi\n')
assert old in s
io.open(p,'w',encoding='utf-8').write(s.replace(old,new,1))
print(' live_env.sh: патч применён')
EOF
fi
echo "=== результат:"
sed -n '76,86p' sqroot/etc/KRD/live_env.sh
echo "=== пересборка squashfs (xz, 256K, 16 потоков) ..."
rm -f filesystem-patched.squashfs
mksquashfs sqroot filesystem-patched.squashfs \
-comp xz -b 262144 -noappend -processors 16 > /tmp/mksq.log 2>&1 || { tail -20 /tmp/mksq.log; exit 1; }
tail -4 /tmp/mksq.log
ls -l filesystem.squashfs filesystem-patched.squashfs
echo "=== проверка нового образа:"
unsquashfs -s filesystem-patched.squashfs | head -6
unsquashfs -cat filesystem-patched.squashfs etc/KRD/live_env.sh 2>/dev/null | sed -n '76,86p'