Include git version information in webpage and /etc/rpi-issue (#110)
Fixes #95.
This commit is contained in:
parent
3f1dc37384
commit
3f9cbe8b41
|
@ -30,6 +30,7 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
IMG_VERSION=${IMG_VERSION:-$(git describe)}
|
||||||
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
|
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
|
||||||
CONTINUE=${CONTINUE:-0}
|
CONTINUE=${CONTINUE:-0}
|
||||||
PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0}
|
PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0}
|
||||||
|
@ -59,6 +60,7 @@ if [ "$CONTAINER_EXISTS" != "" ]; then
|
||||||
time $DOCKER run --rm --privileged \
|
time $DOCKER run --rm --privileged \
|
||||||
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
|
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
|
||||||
-e IMG_NAME="${IMG_NAME}"\
|
-e IMG_NAME="${IMG_NAME}"\
|
||||||
|
-e IMG_VERSION="${IMG_VERSION}"\
|
||||||
pi-gen \
|
pi-gen \
|
||||||
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
|
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
|
||||||
cd /pi-gen; ./build.sh;
|
cd /pi-gen; ./build.sh;
|
||||||
|
@ -68,6 +70,7 @@ else
|
||||||
trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM
|
trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM
|
||||||
time $DOCKER run --name "${CONTAINER_NAME}" --privileged \
|
time $DOCKER run --name "${CONTAINER_NAME}" --privileged \
|
||||||
-e IMG_NAME="${IMG_NAME}"\
|
-e IMG_NAME="${IMG_NAME}"\
|
||||||
|
-e IMG_VERSION="${IMG_VERSION}"\
|
||||||
"${config_file[@]}" \
|
"${config_file[@]}" \
|
||||||
pi-gen \
|
pi-gen \
|
||||||
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
|
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
|
||||||
|
|
7
build.sh
7
build.sh
|
@ -143,9 +143,12 @@ if [ -z "${IMG_NAME}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export USE_QEMU="${USE_QEMU:-0}"
|
export USE_QEMU="${USE_QEMU:-0}"
|
||||||
|
export IMG_VERSION=${IMG_VERSION:-$(git describe)}
|
||||||
export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}"
|
export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}"
|
||||||
export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}"}"
|
export IMG_FILENAME="${IMG_FILENAME:-"${IMG_NAME}-${IMG_VERSION}_${IMG_DATE}${IMG_SUFFIX}"}"
|
||||||
export ZIP_FILENAME="${ZIP_FILENAME:-"image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}"}"
|
export ZIP_FILENAME="${ZIP_FILENAME:-"${IMG_NAME}_image-${IMG_VERSION}_${IMG_DATE}${IMG_SUFFIX}"}"
|
||||||
|
|
||||||
|
echo "IMG_VERSION=${IMG_VERSION}"
|
||||||
|
|
||||||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
export SCRIPT_DIR="${BASE_DIR}/scripts"
|
export SCRIPT_DIR="${BASE_DIR}/scripts"
|
||||||
|
|
7
deps/tools/configServer/Makefile
vendored
7
deps/tools/configServer/Makefile
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
IMG_VERSION?=$(shell git describe)
|
||||||
DEPS_CFLAGS?=$(shell pkg-config --cflags cscore wpiutil)
|
DEPS_CFLAGS?=$(shell pkg-config --cflags cscore wpiutil)
|
||||||
DEPS_LIBS?=$(shell pkg-config --libs --static cscore wpiutil)
|
DEPS_LIBS?=$(shell pkg-config --libs --static cscore wpiutil)
|
||||||
EXEC_HOME?=/home/pi
|
EXEC_HOME?=/home/pi
|
||||||
|
@ -44,11 +45,11 @@ configServer: ${OBJS}
|
||||||
$<
|
$<
|
||||||
|
|
||||||
%.html.cpp: %.html
|
%.html.cpp: %.html
|
||||||
./gen_resource.py $@ $<
|
env IMG_VERSION=${IMG_VERSION} ./gen_resource.py $@ $<
|
||||||
|
|
||||||
%.css.cpp: %.css
|
%.css.cpp: %.css
|
||||||
./gen_resource.py $@ $<
|
env IMG_VERSION=${IMG_VERSION} ./gen_resource.py $@ $<
|
||||||
|
|
||||||
%.js.cpp: %.js
|
%.js.cpp: %.js
|
||||||
./gen_resource.py $@ $<
|
env IMG_VERSION=${IMG_VERSION} ./gen_resource.py $@ $<
|
||||||
|
|
||||||
|
|
4
deps/tools/configServer/gen_resource.py
vendored
4
deps/tools/configServer/gen_resource.py
vendored
|
@ -15,6 +15,10 @@ args = parser.parse_args()
|
||||||
with open(args.inputFile, "rb") as f:
|
with open(args.inputFile, "rb") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
|
version = os.getenv('IMG_VERSION')
|
||||||
|
if version is not None and b'IMG_VERSION' in data:
|
||||||
|
data = data.replace(b'IMG_VERSION', version.encode('utf-8'))
|
||||||
|
|
||||||
fileSize = len(data)
|
fileSize = len(data)
|
||||||
|
|
||||||
inputBase = os.path.basename(args.inputFile)
|
inputBase = os.path.basename(args.inputFile)
|
||||||
|
|
|
@ -474,6 +474,15 @@
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
<footer class="app-footer">
|
||||||
|
<div>
|
||||||
|
<a href="http://wpilib.screenstepslive.com/s/currentCS/m/85074/l/1027798-the-raspberry-pi-frc-console" target="_new">FRCVision-rPi</a>
|
||||||
|
<span>© 2019 FIRST</span>
|
||||||
|
</div>
|
||||||
|
<div class="ml-auto">
|
||||||
|
<a href="https://github.com/wpilibsuite/FRCVision-pi-gen/releases" target="_new">IMG_VERSION</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
<script type="text/javascript" src="jquery-3.3.1.slim.min.js"></script>
|
<script type="text/javascript" src="jquery-3.3.1.slim.min.js"></script>
|
||||||
<script type="text/javascript" src="popper.min.js"></script>
|
<script type="text/javascript" src="popper.min.js"></script>
|
||||||
|
|
|
@ -95,7 +95,7 @@ export -f on_chroot
|
||||||
update_issue() {
|
update_issue() {
|
||||||
local GIT_HASH
|
local GIT_HASH
|
||||||
GIT_HASH=$(git rev-parse HEAD)
|
GIT_HASH=$(git rev-parse HEAD)
|
||||||
echo -e "FRCVision ${IMG_DATE}\nGenerated using pi-gen, https://github.com/allwpilib/FRCVision-pi-gen, ${GIT_HASH}, ${1}" > "${ROOTFS_DIR}/etc/rpi-issue"
|
echo -e "FRCVision ${IMG_VERSION} built on ${IMG_DATE}\nGenerated using pi-gen, https://github.com/allwpilib/FRCVision-pi-gen, ${GIT_HASH}, ${1}" > "${ROOTFS_DIR}/etc/rpi-issue"
|
||||||
}
|
}
|
||||||
export -f update_issue
|
export -f update_issue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user