mirror of
https://github.com/CyberMind-FR/secubox-deb.git
synced 2026-08-17 01:55:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff4b1f2c5b | ||
|
|
5ebc80fc4b |
@@ -213,19 +213,26 @@ jobs:
|
||||
env:
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
run: |
|
||||
if [ -z "$GPG_PRIVATE_KEY" ]; then
|
||||
echo "⚠ GPG_PRIVATE_KEY secret not set - skipping signing"
|
||||
echo "SKIP_SIGN=true" >> $GITHUB_ENV
|
||||
exit 0
|
||||
fi
|
||||
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||
gpg --list-keys
|
||||
|
||||
- name: Setup repository
|
||||
if: env.SKIP_SIGN != 'true'
|
||||
run: |
|
||||
mkdir -p repo/conf
|
||||
cp repo/conf/distributions repo/conf/
|
||||
cp repo/conf/distributions repo/conf/ 2>/dev/null || true
|
||||
cat > repo/conf/options << EOF
|
||||
verbose
|
||||
basedir $(pwd)/repo
|
||||
EOF
|
||||
|
||||
- name: Add packages to repository
|
||||
if: env.SKIP_SIGN != 'true'
|
||||
run: |
|
||||
for deb in debs/*.deb; do
|
||||
[ -f "$deb" ] || continue
|
||||
@@ -234,14 +241,20 @@ jobs:
|
||||
done
|
||||
|
||||
- name: Export public key
|
||||
if: env.SKIP_SIGN != 'true'
|
||||
run: |
|
||||
gpg --armor --export packages@secubox.in > repo/secubox-keyring.gpg
|
||||
|
||||
- name: Deploy to server
|
||||
if: env.SKIP_SIGN != 'true'
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
||||
run: |
|
||||
if [ -z "$SSH_PRIVATE_KEY" ]; then
|
||||
echo "⚠ DEPLOY_SSH_KEY not set - skipping deploy"
|
||||
exit 0
|
||||
fi
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
@@ -85,18 +85,22 @@ done
|
||||
# Check dependencies
|
||||
command -v qemu-system-aarch64 >/dev/null || fail "qemu-system-aarch64 not found. Install: apt install qemu-system-arm"
|
||||
|
||||
# Find UEFI firmware
|
||||
# Find UEFI firmware (prefer AAVMF which has consistent 64MB size)
|
||||
UEFI_CODE=""
|
||||
UEFI_VARS=""
|
||||
for path in /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
|
||||
/usr/share/AAVMF/AAVMF_CODE.fd \
|
||||
/usr/share/edk2/aarch64/QEMU_EFI.fd; do
|
||||
UEFI_VARS_TEMPLATE=""
|
||||
for path in /usr/share/AAVMF/AAVMF_CODE.fd \
|
||||
/usr/share/edk2/aarch64/QEMU_EFI.fd \
|
||||
/usr/share/qemu-efi-aarch64/QEMU_EFI.fd; do
|
||||
if [[ -f "$path" ]]; then
|
||||
UEFI_CODE="$path"
|
||||
# Get matching VARS template if AAVMF
|
||||
if [[ "$path" == *AAVMF* ]]; then
|
||||
UEFI_VARS_TEMPLATE="${path%_CODE.fd}_VARS.fd"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ -z "$UEFI_CODE" ]] && fail "UEFI firmware not found. Install: apt install qemu-efi-aarch64"
|
||||
[[ -z "$UEFI_CODE" ]] && fail "UEFI firmware not found. Install: apt install qemu-efi-aarch64 ovmf"
|
||||
|
||||
# Prepare image
|
||||
log "Preparing image: $IMAGE"
|
||||
@@ -127,9 +131,14 @@ fi
|
||||
|
||||
# Create UEFI vars file (writable copy)
|
||||
VARS_FILE="/tmp/${VM_NAME}-uefi-vars.fd"
|
||||
if [[ ! -f "$VARS_FILE" ]]; then
|
||||
# Create empty 64MB file for UEFI variables
|
||||
truncate -s 64M "$VARS_FILE"
|
||||
if [[ ! -f "$VARS_FILE" ]] || [[ $(stat -c%s "$VARS_FILE") -ne $(stat -c%s "$UEFI_CODE") ]]; then
|
||||
if [[ -n "$UEFI_VARS_TEMPLATE" ]] && [[ -f "$UEFI_VARS_TEMPLATE" ]]; then
|
||||
cp "$UEFI_VARS_TEMPLATE" "$VARS_FILE"
|
||||
log "Using UEFI vars template: $UEFI_VARS_TEMPLATE"
|
||||
else
|
||||
# Create file matching firmware size
|
||||
truncate -s "$(stat -c%s "$UEFI_CODE")" "$VARS_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build QEMU command
|
||||
@@ -146,7 +155,7 @@ QEMU_CMD=(
|
||||
-drive "if=pflash,format=raw,file=$VARS_FILE"
|
||||
|
||||
# Boot disk
|
||||
-drive "if=virtio,format=$(qemu-img info --output=json "$IMAGE" | grep -o '"format": "[^"]*"' | cut -d'"' -f4),file=$IMAGE"
|
||||
-drive "if=virtio,format=$(qemu-img info --output=json "$IMAGE" | jq -r '.format'),file=$IMAGE"
|
||||
|
||||
# Network with port forwarding
|
||||
-netdev "user,id=net0,hostfwd=tcp::${SSH_PORT}-:22,hostfwd=tcp::${HTTP_PORT}-:80,hostfwd=tcp::$((HTTP_PORT+363))-:443"
|
||||
|
||||
Reference in New Issue
Block a user