| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/bin/bash
- set -e
- echo "Opening LUKS..."
- echo -n "09839ed1609e08d39e104e10acbf173f45f64f8c169612bbf8c79bfc3331ebfc" | cryptsetup luksOpen --key-file=- /dev/sdb2 cryptroot 2>/dev/null || true
- mkdir -p /tmp/sdroot
- mount /dev/mapper/cryptroot /tmp/sdroot 2>/dev/null || true
- # Find all waouw-update scripts
- echo "=== Finding waouw-update ==="
- find /tmp/sdroot -name "waouw-update" -type f 2>/dev/null
- # Fix in deploy/scripts source
- SRC=$(find /tmp/sdroot -path "*/deploy/scripts/waouw-update" -type f 2>/dev/null | head -1)
- if [ -n "$SRC" ]; then
- echo "Fixing: $SRC"
- sed -i 's/unzip -oq "$ZIP" -d "$STAGE"$/unzip -oq "$ZIP" -d "$STAGE" || true/' "$SRC"
- sed -i 's/\r$//' "$SRC"
- grep "unzip" "$SRC"
- fi
- # Copy to /usr/local/bin (was missing)
- if [ -n "$SRC" ]; then
- echo "Copying to /usr/local/bin..."
- cp -f "$SRC" /tmp/sdroot/usr/local/bin/waouw-update
- chmod +x /tmp/sdroot/usr/local/bin/waouw-update
- fi
- # Also fix and copy waouw-auto-update.sh
- AUTO=$(find /tmp/sdroot -path "*/deploy/scripts/waouw-auto-update.sh" -type f 2>/dev/null | head -1)
- if [ -n "$AUTO" ]; then
- echo "Fixing: $AUTO"
- sed -i 's/\r$//' "$AUTO"
- cp -f "$AUTO" /tmp/sdroot/usr/local/bin/waouw-auto-update.sh
- chmod +x /tmp/sdroot/usr/local/bin/waouw-auto-update.sh
- fi
- # Verify
- echo "=== Verify ==="
- ls -la /tmp/sdroot/usr/local/bin/waouw-update /tmp/sdroot/usr/local/bin/waouw-auto-update.sh 2>/dev/null
- grep "unzip" /tmp/sdroot/usr/local/bin/waouw-update
- echo "Cleanup..."
- umount /tmp/sdroot
- cryptsetup luksClose cryptroot
- echo "DONE"
|