Add build, deploy and test sources

This commit is contained in:
Paravis committed 2026-11-13 07:52:37 +03:00
1 parent b962581812
commit 3d1a08f230
259 files changed
+15273

No files matched your search

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
cd /root
rm -rf sg2d
git clone --depth 1 -q https://github.com/supergrub/supergrub.git sg2d
cd sg2d
echo "=== default/timeout in menus:"
grep -rn 'set default\|set timeout\|default=' menus/ | head -20
echo
echo "=== main.cfg (first 120 lines):"
sed -n '30,120p' menus/sgd/main.cfg
@@ -0,0 +1,8 @@
#!/bin/bash
echo "=== download page links:"
curl -sL --max-time 60 "https://www.supergrubdisk.org/supergrub2-download/" \
| grep -oE 'href="[^"]+\.(zip|img|iso|tar\.gz|efi)"' | sort -u | head -30
echo
echo "=== sourceforge listing:"
curl -sL --max-time 60 "https://sourceforge.net/projects/supergrub2/files/" \
| grep -oE 'supergrub2-[0-9][^"/]*' | sort -u | head -20
@@ -0,0 +1,17 @@
#!/bin/bash
W=/root/efichk
rm -rf "$W"; mkdir -p "$W"; cd "$W"
cp /path/to/pf/super/x64.efi new.efi
cp /mnt/f/efi/Paravis/Boot/grub2/apps/super.efi old.efi
for f in new old; do
echo "===== $f"
objdump -h $f.efi 2>/dev/null | awk '$2 ~ /memdisk|mods|grub/ {print " section:",$2,$3}'
objcopy -O binary --only-section=.memdisk $f.efi $f.mem 2>/dev/null
ls -l $f.mem 2>/dev/null | awk '{print " memdisk:",$5,"bytes"}'
if [ -s $f.mem ]; then
file $f.mem | sed 's/^/ /'
mkdir -p $f.dir && cd $f.dir
(cpio -itv < ../$f.mem 2>/dev/null || tar tvf ../$f.mem 2>/dev/null) | awk '{print " "$NF, $5}' | sort | head -40
cd ..
fi
done
@@ -0,0 +1,7 @@
#!/bin/bash
cd /root/sg2d || exit 1
echo "=== main menu options (process_main_option calls):"
grep -n 'process_main_option\|^menuentry' menus/sgd/main.cfg | head -30
echo
echo "=== 195..250:"
sed -n '195,250p' menus/sgd/main.cfg
@@ -0,0 +1,13 @@
#!/bin/bash
cd /root/sg2dwork || exit 1
echo "=== ISO main.cfg (patched?):"
xorriso -osirrox on -indev super.iso -extract /boot/grub/sgd/main.cfg /tmp/mc2.cfg >/dev/null 2>&1
grep -n 'set default\|id=detect' /tmp/mc2.cfg | head -5
xorriso -osirrox on -indev super.iso -extract /boot/grub/grub.cfg /tmp/gc2.cfg >/dev/null 2>&1
echo "=== ISO grub.cfg:"
grep -n 'set lang' /tmp/gc2.cfg | head -3
echo "=== ISO EFI images:"
xorriso -indev super.iso -report_el_torito plain 2>/dev/null | grep -E 'boot img|img path'
echo "=== deployed file signature:"
cp /path/to/pf/super/x64.efi /tmp/sig.efi
sbverify --cert /path/to/pf/Ventoy/keys/ventoy.crt /tmp/sig.efi
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
cd /tmp
rm -rf sg2drel sg2d.zip
curl -sL --max-time 900 "https://downloads.sourceforge.net/project/supergrub2/2.06s4/super_grub2_disk_2.06s4.zip" -o sg2d.zip
echo "zip size: $(stat -c %s sg2d.zip)"
mkdir -p sg2drel
7z x -y -osg2drel sg2d.zip >/dev/null
echo "=== contents:"
find sg2drel -maxdepth 2 -type f -printf ' %-60P %10s\n' | head -40
echo "=== efi files inside:"
find sg2drel -iname '*.efi' -printf ' %-60P %10s\n' | head -20
@@ -0,0 +1,12 @@
#!/bin/bash
echo "=== repo:"
curl -sL --max-time 60 "https://api.github.com/repos/supergrub/supergrub" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print('name:',d.get('full_name'),'| default:',d.get('default_branch'),'| size:',d.get('size'),'KB'); print('desc:',d.get('description'))"
echo "=== tags:"
curl -sL --max-time 60 "https://api.github.com/repos/supergrub/supergrub/tags?per_page=10" \
| python3 -c "import sys,json; [print(' ', t['name']) for t in json.load(sys.stdin)]"
echo "=== root contents:"
curl -sL --max-time 60 "https://api.github.com/repos/supergrub/supergrub/contents/" \
| python3 -c "import sys,json; [print(' %-24s %s' % (e['name'], e['type'])) for e in json.load(sys.stdin)]"
echo "=== supergrubdisk.org reachable?"
curl -sI --max-time 30 https://www.supergrubdisk.org/ | head -3
@@ -0,0 +1,11 @@
#!/bin/bash
cd /root/sg2dwork || exit 1
echo "=== files under /boot/grub/sgd (or similar) with default:"
xorriso -indev super.iso -find /boot/grub -name 'main.cfg' 2>/dev/null
for p in $(xorriso -indev super.iso -find /boot/grub -name 'main.cfg' 2>/dev/null | tr -d "'"); do
echo "--- $p"
xorriso -osirrox on -indev super.iso -extract "$p" /tmp/mc.cfg >/dev/null 2>&1
grep -n 'set default' /tmp/mc.cfg
done
echo "=== also check embedded menu in x64.efi (memdisk) via strings:"
strings -a /path/to/pf/super/x64.efi 2>/dev/null | grep -c 'set default=1' || true
@@ -0,0 +1,16 @@
#!/bin/bash
cd /root/sg2dwork || exit 1
rm -rf isochk; mkdir isochk; cd isochk
xorriso -osirrox on -indev ../super.iso -extract /efi.img efi.img >/dev/null 2>&1
ls -l efi.img
mkdir mnt
mount -o loop,ro efi.img mnt 2>/dev/null || { echo "mount failed"; exit 1; }
find mnt -maxdepth 3 | sed 's/^/ /' | head -30
echo "--- sizes:"
find mnt -name '*.efi' -exec ls -l {} \;
umount mnt
# also check that ISO's menus were patched
mkdir iso2
xorriso -osirrox on -indev ../super.iso -extract /boot/grub/grub.cfg iso2/grub.cfg >/dev/null 2>&1
echo "--- ISO grub.cfg lang/default:"
grep -n 'set lang\|set default' iso2/grub.cfg | head
@@ -0,0 +1,9 @@
#!/bin/bash
cd /root/sg2dwork || exit 1
echo "=== ISO tree:"
xorriso -indev super.iso -ls / 2>/dev/null | head -30
echo "=== find efi:"
xorriso -indev super.iso -find / -name '*efi*' 2>/dev/null | head -20
xorriso -indev super.iso -find / -name '*.EFI' 2>/dev/null | head -20
echo "=== boot catalog:"
xorriso -indev super.iso -report_el_torito plain 2>/dev/null | head -40
@@ -0,0 +1,11 @@
#!/bin/bash
# Rebuild Super GRUB2 ISO (Russian + 2nd item default) from the already-patched tree.
set -e
cd /root/sg2dwork/sg2d || exit 1
grep -n 'set default' menus/sgd/main.cfg | head -3
./supergrub-mkrescue -o=/root/sg2dwork/super.iso \
--grub-mkrescue-binary=/usr/bin/grub-mkrescue \
--grub-mkfont-binary=/usr/bin/grub-mkfont > /tmp/sg_iso.log 2>&1 || { tail -15 /tmp/sg_iso.log; exit 1; }
ls -l /root/sg2dwork/super.iso
echo "--- EFI content of ISO:"
xorriso -indev /root/sg2dwork/super.iso -find /EFI -exec lsdl -- 2>/dev/null | head -40
@@ -0,0 +1,5 @@
#!/bin/bash
cd /tmp
curl -sL --max-time 90 "https://sourceforge.net/projects/supergrub2/files/2.06s4/" -o sg2d_list.html
echo "=== files in 2.06s4:"
grep -oE '/2\.06s4/[A-Za-z0-9._-]+' sg2d_list.html | sort -u | head -30
@@ -0,0 +1,7 @@
#!/bin/bash
cd /root/sg2d || exit 1
echo "=== main.cfg 140..190:"
sed -n '140,190p' menus/sgd/main.cfg
echo
echo "=== where the main menu entries are created (tail):"
tail -40 menus/sgd/main.cfg
@@ -0,0 +1,7 @@
#!/bin/bash
cd /root/sg2dwork/sg2d || exit 1
echo "=== mkrescue options:"
grep -n 'grub-mkrescue-binary\|GRUB_MKRESCUE_BINARY\|-o=\|-O=' supergrub-mkrescue | head -20
echo
echo "=== usage:"
sed -n '20,45p' supergrub-mkrescue
@@ -0,0 +1,6 @@
#!/bin/bash
cd /root/sg2dwork/sg2d || exit 1
echo "=== all --*-binary options:"
grep -n -- '--.*-binary)' supergrub-mkrescue
echo "=== defaults:"
grep -n 'GRUB_.*_BINARY=' supergrub-mkrescue | head -20
@@ -0,0 +1,4 @@
#!/bin/bash
cd /root/sg2dwork/sg2d || exit 1
echo "=== lines 100..125:"
sed -n '100,125p' supergrub-mkrescue
@@ -0,0 +1,32 @@
#!/bin/bash
python3 - <<'EOF'
import zlib, struct
def ppm2png(src, dst):
d=open(src,'rb').read()
# parse header
parts=[]; i=0
while len(parts)<4:
while d[i:i+1].isspace(): i+=1
if d[i:i+1]==b'#':
while d[i:i+1] not in (b'\n',b'\r'): i+=1
continue
j=i
while not d[j:j+1].isspace(): j+=1
parts.append(d[i:j]); i=j
i+=1
w=int(parts[1]); h=int(parts[2])
px=d[i:i+w*h*3]
raw=b''.join(b'\x00'+px[y*w*3:(y+1)*w*3] for y in range(h))
def chunk(t,data):
c=t+data
return struct.pack('>I',len(data))+c+struct.pack('>I',zlib.crc32(c)&0xffffffff)
png=b'\x89PNG\r\n\x1a\n'
png+=chunk(b'IHDR',struct.pack('>IIBBBBB',w,h,8,2,0,0,0))
png+=chunk(b'IDAT',zlib.compress(raw,9))
png+=chunk(b'IEND',b'')
open(dst,'wb').write(png)
print(dst,w,h,len(png))
ppm2png('/tmp/shot.ppm','/path/to/pf/super/preview.png')
ppm2png('/tmp/shot2.ppm','/path/to/pf/super/preview2.png')
EOF
ls -l /path/to/pf/super/
@@ -0,0 +1,13 @@
#!/bin/bash
for u in \
"https://sourceforge.net/projects/supergrub2/files/2.06s4/" \
"https://downloads.sourceforge.net/project/supergrub2/2.06s4/supergrub2-2.06s4.iso" \
"https://downloads.sourceforge.net/project/supergrub2/2.06s4/supergrub2-2.06s4-multiarch-USB.img" \
"https://downloads.sourceforge.net/project/supergrub2/2.06s4/supergrub2-2.06s4-standalone-efi.zip" \
; do
printf '%-88s ' "$(echo "$u" | cut -c1-88)"
code=$(curl -sL -o /dev/null -w '%{http_code} %{size_download}' --max-time 45 "$u" 2>/dev/null)
echo "$code"
done
echo "=== files listing via sf api:"
curl -sL --max-time 45 "https://sourceforge.net/projects/supergrub2/best_release.json" | head -c 400; echo
@@ -0,0 +1,5 @@
#!/bin/bash
echo "=== qemu:"; which qemu-system-x86_64 || true
echo "=== ovmf:"; ls -l /usr/share/OVMF/ 2>/dev/null | head
ls -l /usr/share/ovmf/ 2>/dev/null | head
echo "=== mtools:"; which mformat mcopy || true
@@ -0,0 +1,40 @@
#!/bin/bash
# Boot the freshly built Super GRUB2 x64.efi in QEMU/OVMF and screenshot the menu.
set -e
W=/root/qtest
rm -rf "$W"; mkdir -p "$W"; cd "$W"
dd if=/dev/zero of=esp.img bs=1M count=64 status=none
mformat -i esp.img -F :: >/dev/null
mmd -i esp.img ::/EFI ::/EFI/BOOT
mcopy -i esp.img /root/sg2dwork/super-x64.efi ::/EFI/BOOT/BOOTX64.EFI
cp /usr/share/OVMF/OVMF_VARS_4M.fd vars.fd
rm -f /tmp/qmon.sock /tmp/shot.ppm
qemu-system-x86_64 -m 1024 -machine q35 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \
-drive if=pflash,format=raw,file=vars.fd \
-drive format=raw,file=esp.img \
-net none -display none \
-monitor unix:/tmp/qmon.sock,server,nowait -daemonize
sleep 25
python3 - <<'EOF'
import socket, time
s = socket.socket(socket.AF_UNIX); s.connect('/tmp/qmon.sock'); time.sleep(0.3)
s.recv(65536)
s.sendall(b'screendump /tmp/shot.ppm\n'); time.sleep(1.5)
s.recv(65536)
s.sendall(b'screendump /tmp/shot2.ppm\n'); time.sleep(1.5)
s.sendall(b'quit\n')
EOF
sleep 2
pkill -f 'qemu-system-x86_64.*qtest' 2>/dev/null || true
ls -l /tmp/shot*.ppm
python3 - <<'EOF'
import struct
for n in ('/tmp/shot.ppm','/tmp/shot2.ppm'):
d=open(n,'rb').read()
print(n, d[:20], len(d))
EOF
command -v convert >/dev/null && { convert /tmp/shot.ppm /path/to/pf/super/preview.png; convert /tmp/shot2.ppm /path/to/pf/super/preview2.png; ls -l /path/to/pf/super/preview*.png; } || echo "no imagemagick"
@@ -0,0 +1,12 @@
#!/bin/bash
cd /tmp/sg2d || exit 1
echo "=== releases dir:"
ls releases/ 2>/dev/null | head -20
echo "=== news-releases:"
ls news-releases/ 2>/dev/null | head -10
echo "=== version header:"
head -20 info_cfg_header.cfg 2>/dev/null
echo "=== urls in release scripts:"
grep -rhoE 'https?://[^"'"'"' ]+' supergrub-official-release supergrub-release-news supergrub-release-changes 2>/dev/null | sort -u | head -20
echo "=== po has ru?"
ls po/ | grep -iE 'ru|RU'
@@ -0,0 +1,13 @@
#!/bin/bash
cd /tmp
rm -rf sg2d
git clone --depth 1 -q https://github.com/supergrub/supergrub.git sg2d
cd sg2d
echo "=== version files:"
cat supergrub-build-config 2>/dev/null | head -20
echo "=== language handling in menus:"
grep -rn 'lang' menus/ 2>/dev/null | head -20
echo "=== po files:"
ls po/ | head
echo "=== mkstandalone:"
sed -n '1,60p' supergrub-mkstandalone
@@ -0,0 +1,20 @@
#!/bin/bash
set -e
K=/path/to/pf/Ventoy/keys
D=/path/to/pf/ParavisGrub
A=$D/apps
mkdir -p "$A"
echo "=== SG2D build sanity"
strings -a /tmp/sg2d_ru.efi | grep -aiE 'Super GRUB2 Disk|sg2d_directory|Language' | sort -u | head -6
echo "=== sign -> staged apps/super.efi"
sbsign --key "$K/ventoy.key" --cert "$K/ventoy.crt" --output "$A/super.efi" /tmp/sg2d_ru.efi
sbverify --cert "$K/ventoy.crt" "$A/super.efi"
ls -l "$A/super.efi"
sha256sum "$A/super.efi"
echo
echo "=== what will be deployed (structure check)"
echo " p1 efi/Paravis/Boot/grub2/ <- only our new loader lives here"
ls -l "$D" "$D/menu" "$A"