main 6af0a61

push-binary-to-vm.sh RawHistoryFolder

1#!/bin/bash
2# Push binary to VM for testing
3# Usage: ./push-binary-to-vm.sh [--local] /path/to/binary
4#
5# --local  Also sync local install/ assets/ and logo.txt into /tmp/archup-install/ on
6#          the VM and set ARCHUP_LOCAL=1 in /tmp/archup-local-env so the installer
7#          skips all GitHub downloads and uses the pre-seeded files instead.
8
9set -eo pipefail
10
11LOCAL_MODE=0
12BINARY_PATH=""
13
14for arg in "$@"; do
15    case "$arg" in
16        --local) LOCAL_MODE=1 ;;
17        *)       BINARY_PATH="$arg" ;;
18    esac
19done
20
21if [ -z "$BINARY_PATH" ]; then
22    echo "Usage: $0 [--local] /path/to/binary"
23    echo "Example: $0 ../../../dist/archup_linux_amd64_v1/archup"
24    echo "         $0 --local ../../../dist/archup_linux_amd64_v1/archup"
25    exit 1
26fi
27
28BINARY_NAME=$(basename "$BINARY_PATH")
29
30if [ ! -f "$BINARY_PATH" ]; then
31    echo "Error: Binary file not found: $BINARY_PATH"
32    exit 1
33fi
34
35VM_HOST="localhost"
36VM_PORT="2222"
37VM_USER="root"
38VM_PASS="test"
39REMOTE_PATH="/tmp"
40REMOTE_INSTALL_DIR="/tmp/archup-install"
41
42SSH_OPTS="-p $VM_PORT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
43SCP_OPTS="-P $VM_PORT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
44SSHPASS="sshpass -p $VM_PASS"
45
46ssh_cmd() {
47    $SSHPASS ssh $SSH_OPTS "$VM_USER@$VM_HOST" "$@" 2>&1 | grep -v "Warning: Permanently added" || true
48}
49
50scp_cmd() {
51    $SSHPASS scp $SCP_OPTS "$@" 2>&1 | grep -v "Warning: Permanently added" || true
52}
53
54rsync_cmd() {
55    $SSHPASS rsync -az --checksum --no-perms -e "ssh $SSH_OPTS" "$@" 2>&1 | grep -v "Warning: Permanently added" || true
56}
57
58echo "Pushing $BINARY_NAME to VM..."
59
60ssh_cmd "mkdir -p $REMOTE_PATH"
61scp_cmd "$BINARY_PATH" "$VM_USER@$VM_HOST:$REMOTE_PATH/$BINARY_NAME"
62
63# Verify binary
64FILE_SIZE=$(stat -c%s "$BINARY_PATH" 2>/dev/null || stat -f%z "$BINARY_PATH" 2>/dev/null)
65REMOTE_SIZE=$(ssh_cmd "stat -c%s $REMOTE_PATH/$BINARY_NAME")
66
67if [ "$FILE_SIZE" = "$REMOTE_SIZE" ]; then
68    echo "[OK] Binary pushed successfully!"
69    echo "  Location: $REMOTE_PATH/$BINARY_NAME"
70    echo "  Size: $FILE_SIZE bytes"
71else
72    echo "Warning: Size mismatch - transfer may have failed"
73    echo "  Local: $FILE_SIZE bytes"
74    echo "  Remote: $REMOTE_SIZE bytes"
75    exit 1
76fi
77
78if [ "$LOCAL_MODE" = "1" ]; then
79    # Resolve repo root (two levels up from test/vm/)
80    SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
81    REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
82
83    echo ""
84    echo "Syncing local install files to VM ($REMOTE_INSTALL_DIR)..."
85
86    ssh_cmd "mkdir -p \
87        $REMOTE_INSTALL_DIR/configs \
88        $REMOTE_INSTALL_DIR/assets/plymouth \
89        $REMOTE_INSTALL_DIR/install/configs \
90        $REMOTE_INSTALL_DIR/install/mandatory/post-boot"
91
92    # install/ configs (bootstrap files land here: /tmp/archup-install/<file>)
93    rsync_cmd "$REPO_ROOT/install/base.packages"                     "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/"
94    rsync_cmd "$REPO_ROOT/install/extra.packages"                    "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/"
95    rsync_cmd "$REPO_ROOT/install/configs/limine.conf.template"      "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/configs/"
96    rsync_cmd "$REPO_ROOT/install/configs/chaotic-aur.conf"          "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/configs/"
97    rsync_cmd "$REPO_ROOT/install/configs/limine-update.hook"        "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/configs/"
98
99    # install/ configs also at repo-relative path (used by tryReadLocal fallback)
100    rsync_cmd "$REPO_ROOT/install/configs/limine.conf.template"      "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/install/configs/"
101    rsync_cmd "$REPO_ROOT/install/configs/limine-update.hook"        "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/install/configs/"
102
103    # assets
104    rsync_cmd "$REPO_ROOT/assets/plymouth/"                          "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/assets/plymouth/"
105
106    # logo.txt
107    rsync_cmd "$REPO_ROOT/logo.txt"                                  "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/"
108
109    # post-boot scripts
110    rsync_cmd "$REPO_ROOT/install/mandatory/post-boot/"              "$VM_USER@$VM_HOST:$REMOTE_INSTALL_DIR/install/mandatory/post-boot/"
111
112    # Write env file so the installer wrapper can source ARCHUP_LOCAL=1
113    ssh_cmd "echo 'export ARCHUP_LOCAL=1' > /tmp/archup-local-env"
114
115    echo "[OK] Local files synced to $REMOTE_INSTALL_DIR"
116    echo "[OK] /tmp/archup-local-env written — run: source /tmp/archup-local-env && $REMOTE_PATH/$BINARY_NAME"
117fi

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close