rusefi/firmware/bin/upload_bundle.sh

33 lines
1.3 KiB
Bash
Raw Normal View History

2024-01-29 05:04:48 -08:00
#!/usr/bin/env bash
USER=$1
PASS=$2
HOST=$3
2024-01-29 05:04:48 -08:00
SCRIPT_NAME=$(basename "$0")
2024-02-16 16:10:52 -08:00
# technical debt: more than one file uses magic 'rusefi_bundle_' constant, can we extract constant?
FULL_BUNDLE_FILE="rusefi_bundle_${BUNDLE_NAME}.zip"
UPDATE_BUNDLE_FILE="rusefi_bundle_${BUNDLE_NAME}_autoupdate.zip"
2024-01-29 05:04:48 -08:00
if [ -n "${USER}" -a -n "$PASS" -a -n "${HOST}" ]; then
2024-01-29 05:04:48 -08:00
echo "$SCRIPT_NAME: Uploading full bundle"
RET=0
2024-03-07 19:17:51 -08:00
if [ "$LTS" == "true" -a -n "$REF" ]; then
tar -czf - $FULL_BUNDLE_FILE | sshpass -p $PASS ssh -o StrictHostKeyChecking=no ${USER}@${HOST} "mkdir -p build_server/lts/${REF}; tar -xzf - -C build_server/lts/${REF}"
2024-03-08 13:17:32 -08:00
RET=$((RET+$?+PIPESTATUS))
tar -czf - $UPDATE_BUNDLE_FILE | sshpass -p $PASS ssh -o StrictHostKeyChecking=no ${USER}@${HOST} "mkdir -p build_server/lts/${REF}/autoupdate; tar -xzf - -C build_server/lts/${REF}/autoupdate"
2024-03-08 13:17:32 -08:00
RET=$((RET+$?+PIPESTATUS))
2024-01-29 05:04:48 -08:00
else
tar -czf - $FULL_BUNDLE_FILE | sshpass -p $PASS ssh -o StrictHostKeyChecking=no ${USER}@${HOST} "tar -xzf - -C build_server"
2024-03-08 13:17:32 -08:00
RET=$((RET+$?+PIPESTATUS))
tar -czf - $UPDATE_BUNDLE_FILE | sshpass -p $PASS ssh -o StrictHostKeyChecking=no ${USER}@${HOST} "mkdir -p build_server/autoupdate; tar -xzf - -C build_server/autoupdate"
2024-03-08 13:17:32 -08:00
RET=$((RET+$?+PIPESTATUS))
2024-01-29 05:04:48 -08:00
fi
if [ $RET -ne 0 ]; then
echo "$SCRIPT_NAME: Bundle upload failed"
exit 1
fi
else
echo "$SCRIPT_NAME: Upload not configured"
fi