70 lines
2.2 KiB
Bash
70 lines
2.2 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
W=/root/krd24
|
|
cd "$W"
|
|
|
|
echo "=== распаковка чистого 10-krd.srm"
|
|
rm -rf srm10p; unsquashfs -d srm10p 10-krd.srm >/dev/null 2>&1
|
|
|
|
echo "=== патч find_product_dir.sh"
|
|
python3 - <<'PYEOF'
|
|
import io
|
|
p='/root/krd24/srm10p/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 on other disks).
|
|
paravis_product_dir=""
|
|
|
|
for mount_dir in $(awk '{print $2}' "${KRD_MOUNTS_FILE_PATH}")
|
|
do
|
|
if [[ -d "${mount_dir}/efi/Paravis/KRD/live" ]]
|
|
then
|
|
paravis_product_dir="${mount_dir}/efi/Paravis/KRD/${KRD_DATA_DIRECTORY_NAME}"
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [[ -n "${paravis_product_dir}" ]]
|
|
then
|
|
mkdir -p "${paravis_product_dir}/${KRD_TRACES_DIRNAME}"
|
|
|
|
if [[ ${?} -eq 0 ]]
|
|
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
|
|
|
|
trace_message "${TRACE_LVL_ERROR}" "Paravis build: product folder is kept in RAM"
|
|
trace_and_exit 3
|
|
'''
|
|
assert anchor in s, 'anchor not found'
|
|
assert 'Paravis build' not in s, 'already patched'
|
|
s=s.replace(anchor, anchor+add, 1)
|
|
io.open(p,'w',encoding='utf-8').write(s)
|
|
print(' патч применён')
|
|
PYEOF
|
|
|
|
echo "=== проверка синтаксиса скрипта"
|
|
bash -n srm10p/scripts/find_product_dir.sh && echo " bash -n: OK"
|
|
|
|
echo "=== пересборка 10-krd.srm"
|
|
rm -f 10-krd-paravis.srm
|
|
mksquashfs srm10p 10-krd-paravis.srm -comp xz -b 262144 -Xbcj x86 -noappend > /tmp/mksrm2.log 2>&1
|
|
tail -2 /tmp/mksrm2.log
|
|
ls -l 10-krd.srm 10-krd-paravis.srm
|
|
unsquashfs -cat 10-krd-paravis.srm scripts/find_product_dir.sh 2>/dev/null | sed -n '/Paravis build/,+6p'
|
|
|
|
echo "=== копирую в стенд и на флешку"
|
|
cp -f 10-krd-paravis.srm /path/to/pf/KRD/files/live/KRD/10-krd.srm
|
|
cp -f 10-krd-paravis.srm /mnt/f/efi/Paravis/KRD/live/KRD/10-krd.srm
|
|
ls -l /mnt/f/efi/Paravis/KRD/live/KRD/10-krd.srm
|