mirror of
https://github.com/jetkvm/rkcrypto.git
synced 2026-05-21 05:20:42 +00:00
41 lines
789 B
Bash
Executable File
41 lines
789 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
# Check if REMOTE_HOST is provided as argument
|
|
if [ $# -ne 1 ]; then
|
|
echo "Usage: $0 <remote_host_ip>"
|
|
echo "Example: $0 192.168.0.194"
|
|
exit 1
|
|
fi
|
|
|
|
# Set Go cross-compilation environment variables
|
|
export GOOS=linux
|
|
export GOARCH=arm
|
|
# Common ARM variants: 5 for armv5, 6 for armv6, 7 for armv7
|
|
export GOARM=7
|
|
|
|
echo "Cross-compiling Go tests for ARM Linux..."
|
|
go test -c ./...
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Cross-compilation successful"
|
|
else
|
|
echo "Cross-compilation failed"
|
|
exit 1
|
|
fi
|
|
|
|
REMOTE_USER="root"
|
|
REMOTE_PATH="/tmp"
|
|
REMOTE_HOST="$1"
|
|
|
|
cat rkcrypto.test | ssh "${REMOTE_USER}@${REMOTE_HOST}" "cat > $REMOTE_PATH/rkcrypto.test"
|
|
|
|
ssh "${REMOTE_USER}@${REMOTE_HOST}" ash <<EOF
|
|
cd /tmp
|
|
chmod +x rkcrypto.test
|
|
./rkcrypto.test
|
|
EOF
|
|
|