detached c744bdc

test(vm): add push-binary-to-vm.sh script for transferring binaries to test VM

Script accepts binary filepath as parameter and handles SSH transfer with verification.
commit
c744bdc9452d901d9220979671d82f5b748bc4c4
author
bnema · · 2025-10-26 18:16 UTC
parent
e465377
signature
unsigned
1 file · +52 -0
A test/vm/push-binary-to-vm.sh +52 -0
@@ -0,0 +1,52 @@
1+#!/bin/bash
2+# Push binary to VM for testing
3+# Usage: ./push-binary-to-vm.sh /path/to/binary
4+
5+set -eo pipefail
6+
7+if [ $# -eq 0 ]; then
8+ echo "Usage: $0 /path/to/binary"
9+ echo "Example: $0 ../../../dist/archup-installer_linux_amd64_v1/archup-installer"
10+ exit 1
11+fi
12+
13+BINARY_PATH="$1"
14+BINARY_NAME=$(basename "$BINARY_PATH")
15+
16+# Check if file exists
17+if [ ! -f "$BINARY_PATH" ]; then
18+ echo "Error: Binary file not found: $BINARY_PATH"
19+ exit 1
20+fi
21+
22+VM_HOST="localhost"
23+VM_PORT="2222"
24+VM_USER="root"
25+VM_PASS="test"
26+REMOTE_PATH="/root/.local/share/archup"
27+
28+echo "Pushing $BINARY_NAME to VM..."
29+
30+# Create remote directory
31+sshpass -p "$VM_PASS" ssh -p "$VM_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
32+ "$VM_USER@$VM_HOST" "mkdir -p $REMOTE_PATH" 2>&1 | grep -v "Warning: Permanently added" || true
33+
34+# Send binary
35+sshpass -p "$VM_PASS" scp -P "$VM_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
36+ "$BINARY_PATH" "$VM_USER@$VM_HOST:$REMOTE_PATH/$BINARY_NAME" 2>&1 | grep -v "Warning: Permanently added" || true
37+
38+# Verify
39+FILE_SIZE=$(stat -c%s "$BINARY_PATH" 2>/dev/null || stat -f%z "$BINARY_PATH" 2>/dev/null)
40+REMOTE_SIZE=$(sshpass -p "$VM_PASS" ssh -p "$VM_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
41+ "$VM_USER@$VM_HOST" "stat -c%s $REMOTE_PATH/$BINARY_NAME" 2>&1 | grep -v "Warning: Permanently added" || true)
42+
43+if [ "$FILE_SIZE" = "$REMOTE_SIZE" ]; then
44+ echo "✓ Binary pushed successfully!"
45+ echo " Location: $REMOTE_PATH/$BINARY_NAME"
46+ echo " Size: $FILE_SIZE bytes"
47+else
48+ echo "⚠ Size mismatch - transfer may have failed"
49+ echo " Local: $FILE_SIZE bytes"
50+ echo " Remote: $REMOTE_SIZE bytes"
51+ exit 1
52+fi
@@ -0,0 +1,52 @@
1+#!/bin/bash
2+# Push binary to VM for testing
3+# Usage: ./push-binary-to-vm.sh /path/to/binary
4+
5+set -eo pipefail
6+
7+if [ $# -eq 0 ]; then
8+ echo "Usage: $0 /path/to/binary"
9+ echo "Example: $0 ../../../dist/archup-installer_linux_amd64_v1/archup-installer"
10+ exit 1
11+fi
12+
13+BINARY_PATH="$1"
14+BINARY_NAME=$(basename "$BINARY_PATH")
15+
16+# Check if file exists
17+if [ ! -f "$BINARY_PATH" ]; then
18+ echo "Error: Binary file not found: $BINARY_PATH"
19+ exit 1
20+fi
21+
22+VM_HOST="localhost"
23+VM_PORT="2222"
24+VM_USER="root"
25+VM_PASS="test"
26+REMOTE_PATH="/root/.local/share/archup"
27+
28+echo "Pushing $BINARY_NAME to VM..."
29+
30+# Create remote directory
31+sshpass -p "$VM_PASS" ssh -p "$VM_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
32+ "$VM_USER@$VM_HOST" "mkdir -p $REMOTE_PATH" 2>&1 | grep -v "Warning: Permanently added" || true
33+
34+# Send binary
35+sshpass -p "$VM_PASS" scp -P "$VM_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
36+ "$BINARY_PATH" "$VM_USER@$VM_HOST:$REMOTE_PATH/$BINARY_NAME" 2>&1 | grep -v "Warning: Permanently added" || true
37+
38+# Verify
39+FILE_SIZE=$(stat -c%s "$BINARY_PATH" 2>/dev/null || stat -f%z "$BINARY_PATH" 2>/dev/null)
40+REMOTE_SIZE=$(sshpass -p "$VM_PASS" ssh -p "$VM_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
41+ "$VM_USER@$VM_HOST" "stat -c%s $REMOTE_PATH/$BINARY_NAME" 2>&1 | grep -v "Warning: Permanently added" || true)
42+
43+if [ "$FILE_SIZE" = "$REMOTE_SIZE" ]; then
44+ echo "✓ Binary pushed successfully!"
45+ echo " Location: $REMOTE_PATH/$BINARY_NAME"
46+ echo " Size: $FILE_SIZE bytes"
47+else
48+ echo "⚠ Size mismatch - transfer may have failed"
49+ echo " Local: $FILE_SIZE bytes"
50+ echo " Remote: $REMOTE_SIZE bytes"
51+ exit 1
52+fi

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