Skip to content

Commit df7b883

Browse files
committed
add hack stuff
1 parent 37e78de commit df7b883

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

hack/printversion.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "../include/config.h"
2+
#include "stdio.h"
3+
4+
// Why grep the version from the config.h when we can
5+
// just as easily have a tiny program doing it The Right Way(tm).
6+
7+
int main() {
8+
printf("%s\n", FROY_VERSION);
9+
}

hack/publish.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
cd $(dirname $0)/..
6+
7+
environment="esp_wroom_02"
8+
9+
# determine version
10+
gcc -o ver hack/printversion.c
11+
version="$(./ver)"
12+
rm ver
13+
14+
# setup
15+
remoteDirectory="infrastructure/data/monitor/ota-1/froy"
16+
remoteFilename="$remoteDirectory/froy-$version.bin"
17+
remoteHost="xrstf.de"
18+
19+
# create directory
20+
ssh "$remoteHost" "mkdir -p $remoteDirectory"
21+
22+
# check if this version already exists
23+
if ssh "$remoteHost" "test -e $remoteFilename"; then
24+
echo "A release with this version ($version) already exists, refusing to overwrite."
25+
exit 1
26+
fi
27+
28+
# build project
29+
echo "Compiling..."
30+
pio run --silent --environment "$environment" --target clean
31+
pio run --silent --environment "$environment"
32+
33+
echo "Uploading version $version ..."
34+
scp ".pio/build/$environment/firmware.bin" "$remoteHost:$remoteFilename"

0 commit comments

Comments
 (0)