63 lines
2.1 KiB
Bash
63 lines
2.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
W=/root/krd24
|
|
cd "$W"
|
|
|
|
echo "=== чистый srm + финальный патч"
|
|
rm -rf srm10f; unsquashfs -d srm10f 10-krd.srm >/dev/null 2>&1
|
|
|
|
python3 - <<'PYEOF'
|
|
import io
|
|
p='/root/krd24/srm10f/scripts/find_product_dir.sh'
|
|
s=io.open(p,encoding='utf-8').read()
|
|
anchor='''if [[ ! -f "${KRD_MOUNTS_FILE_PATH}" ]]
|
|
then
|
|
trace_message "${TRACE_LVL_ERROR}" "Volumes aren't mounted!"
|
|
trace_and_exit 1
|
|
fi
|
|
'''
|
|
add='''
|
|
# Paravis build: the product folder always lives inside efi/Paravis/KRD on the
|
|
# boot medium. No <KRD2024_Data> folders are created on other disks.
|
|
# live-boot mounts the medium read-only, and a second mount of the same block
|
|
# device reuses that superblock (so KRD's own rw mount stays ro) - hence the
|
|
# explicit remount.
|
|
paravis_medium="/run/live/medium"
|
|
|
|
if [[ -d "${paravis_medium}/efi/Paravis/KRD/live" ]]
|
|
then
|
|
mount -o remount,rw "${paravis_medium}" 2>/dev/null
|
|
|
|
if touch "${paravis_medium}/.paravis_rw_check" 2>/dev/null
|
|
then
|
|
rm -f "${paravis_medium}/.paravis_rw_check"
|
|
|
|
paravis_product_dir="${paravis_medium}/efi/Paravis/KRD/${KRD_DATA_DIRECTORY_NAME}"
|
|
mkdir -p "${paravis_product_dir}/${KRD_TRACES_DIRNAME}" 2>/dev/null
|
|
|
|
if [[ -d "${paravis_product_dir}/${KRD_TRACES_DIRNAME}" ]]
|
|
then
|
|
echo -e "${paravis_product_dir}" >> "${KRD_DATA_DIRECTORY_FILE_PATH}"
|
|
trace_message "${TRACE_LVL_INFO}" "Paravis build: product directory is <${paravis_product_dir}>"
|
|
trace_and_exit 0
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
trace_message "${TRACE_LVL_ERROR}" "Paravis build: product folder is kept in RAM"
|
|
trace_and_exit 3
|
|
'''
|
|
assert anchor in s, 'anchor'
|
|
assert 'Paravis build' not in s, 'already patched'
|
|
io.open(p,'w',encoding='utf-8').write(s.replace(anchor, anchor+add, 1))
|
|
print(' патч применён')
|
|
PYEOF
|
|
|
|
bash -n srm10f/scripts/find_product_dir.sh && echo " bash -n: OK"
|
|
|
|
rm -f 10-krd-final.srm
|
|
mksquashfs srm10f 10-krd-final.srm -comp xz -b 262144 -Xbcj x86 -noappend >/dev/null 2>&1
|
|
ls -l 10-krd-final.srm
|
|
cp -f 10-krd-final.srm /path/to/pf/KRD/files/live/KRD/10-krd.srm
|
|
echo " стенд обновлён (флешку обновим после теста)"
|