Add build, deploy and test sources
This commit is contained in:
1 parent
b962581812
commit
3d1a08f230
259 files changed
+15273
No files matched your search
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
# Интерактивный прогон: принять лицензию и снять главное окно KRT.
|
||||
set -e
|
||||
STAGE=/path/to/pf/KRD/files
|
||||
IMG=/root/krd24/ui-fat32.img
|
||||
|
||||
rm -f "$IMG"; truncate -s 8G "$IMG"
|
||||
mkfs.vfat -F 32 -n PARAVIS "$IMG" >/dev/null 2>&1
|
||||
mkdir -p /mnt/krdtest; mount -o loop "$IMG" /mnt/krdtest
|
||||
mkdir -p /mnt/krdtest/efi/Paravis/KRD
|
||||
cp -r "$STAGE/." /mnt/krdtest/efi/Paravis/KRD/
|
||||
sync; umount /mnt/krdtest
|
||||
|
||||
rm -f /tmp/qmon9.sock /tmp/ui*.ppm
|
||||
qemu-system-x86_64 -m 4096 -smp 4 -machine q35 \
|
||||
-kernel "$STAGE/live/vmlinuz" -initrd "$STAGE/live/initrd.img" \
|
||||
-append "boot=live components live-media-path=/efi/Paravis/KRD/live locales=ru_RU.UTF-8 trace" \
|
||||
-drive file="$IMG",format=raw,if=ide \
|
||||
-netdev user,id=n0 -device e1000,netdev=n0 \
|
||||
-device qemu-xhci -device usb-tablet -display none -vga std \
|
||||
-monitor unix:/tmp/qmon9.sock,server,nowait -daemonize
|
||||
|
||||
python3 - <<'EOF'
|
||||
import socket, time
|
||||
def mon(cmds, pause=0.6):
|
||||
s = socket.socket(socket.AF_UNIX); s.connect('/tmp/qmon9.sock'); time.sleep(0.3)
|
||||
s.recv(65536)
|
||||
for c in cmds:
|
||||
s.sendall((c+'\n').encode()); time.sleep(pause)
|
||||
s.settimeout(1.0)
|
||||
try: s.recv(65536)
|
||||
except Exception: pass
|
||||
s.close()
|
||||
|
||||
time.sleep(110)
|
||||
mon(['screendump /tmp/ui0.ppm'])
|
||||
|
||||
# три чекбокса лицензии
|
||||
for (x, y) in [(366,526),(366,558),(366,611)]:
|
||||
mon([f'mouse_move {x} {y}', 'mouse_button 1', 'mouse_button 0'], 0.5)
|
||||
time.sleep(0.7)
|
||||
mon(['screendump /tmp/ui1.ppm'])
|
||||
|
||||
# кнопка "Принять"
|
||||
mon(['mouse_move 864 656', 'mouse_button 1', 'mouse_button 0'], 0.6)
|
||||
time.sleep(12)
|
||||
mon(['screendump /tmp/ui2.ppm'])
|
||||
time.sleep(10)
|
||||
mon(['screendump /tmp/ui3.ppm'])
|
||||
mon(['quit'])
|
||||
EOF
|
||||
sleep 3
|
||||
pkill -f 'qemu-system-x86_64.*ui-fat32.img' 2>/dev/null || true
|
||||
ls -l /tmp/ui*.ppm
|
||||
python3 - <<'EOF'
|
||||
import zlib, struct
|
||||
def ppm2png(src, dst):
|
||||
d=open(src,'rb').read()
|
||||
parts=[]; i=0
|
||||
while len(parts)<4:
|
||||
while d[i:i+1].isspace(): i+=1
|
||||
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)
|
||||
for n in range(4):
|
||||
ppm2png(f'/tmp/ui{n}.ppm', f'/path/to/pf/KRD/ui-{n}.png')
|
||||
EOF
|
||||
Reference in new issue
Block a user