To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit aedd55af authored by Reto Da Forno's avatar Reto Da Forno

embed image tool updated, link tests disabled, unused sql file removed

parent f6e879b5
../../database/DB_Architecture_Observer.sql
\ No newline at end of file
......@@ -165,7 +165,7 @@ def main(argv):
now = time.strftime(config.get("database", "timeformat"), time.gmtime())
# schedule link measurement if needed
flocklab.scheduleLinkTest(logger, config, cur, cn, debug)
#flocklab.scheduleLinkTest(logger, config, cur, cn, debug)
# Check for work ---
# Check if a new test is to be started ---
......
#!/bin/sh
#!/bin/bash
#
# embeds an exe/elf file into a the FlockLab XML config file
#
# 2020, rdaforno
#
#
# in order to use "drag&drop" to pass the image file and XML config to this script,
# you will need to create a *.desktop file with the following content:
# [Desktop Entry]
# Name=Embed FlockLab Image Wrapper
# Comment=Drop FlockLab XML config and target image file here
# Exec=[absolute_path_to_embed_image_script] %U
# Type=Application
#
# embeds an exe/elf file into a the Flocklab XML config file
XMLFILE=flocklab.xml
SEDCMD=sed
B64CMD=base64
XMLFILE=flocklab.xml # default file name, if not provided via argument
# check if sed tool is installed
which $SEDCMD > /dev/null 2>&1
if [ $? -ne 0 ];
if [ $? -ne 0 ]
then
echo "command '$SEDCMD' not found"
exit 1
fi
# check if base64 tool is installed
which $B64CMD > /dev/null 2>&1
if [ $? -ne 0 ];
if [ $? -ne 0 ]
then
echo "command '$B64CMD' not found"
exit 1
fi
if [ $# -lt 1 ];
# at least one arguments are required (the target image)
if [ $# -lt 1 ]
then
echo "usage: $0 [input file (exe)] [output file (xml)]"
echo "usage: $0 [image file (exe/elf)] ([input / output XML file])"
exit 1
fi
if [ $# -gt 1 ] && [ -f $2 ];
# if an additional argument is provided, check if it is an xml file
IMGFILE=$1
if [ $# -gt 1 ]
then
XMLFILE=$2
if [[ $1 == *.xml ]]
then
# swap the two files
XMLFILE=$1
IMGFILE=$2
fi
fi
if [ ! -f $1 ];
# check file extension of image
if [[ ! $IMGFILE == *.exe ]] && [[ ! $IMGFILE == *.elf ]] && [[ ! $IMGFILE == *.hex ]] && [[ ! $IMGFILE == *.sky ]] && [[ ! $IMGFILE == *.out ]]
then
echo "file $1 not found"
exit 1
echo "invalid image file format"
exit 2
fi
if [ ! -f $XMLFILE ];
# check if files exist
if [ ! -f $IMGFILE ]
then
echo "file $IMGFILE not found"
exit 3
fi
if [ ! -f $XMLFILE ]
then
echo "file $XMLFILE not found"
exit 1
exit 4
fi
if [ ! -f $XMLFILE ]
then
echo "file $XMLFILE not found"
exit 5
fi
B64FILE="$1.b64"
B64FILE="$IMGFILE.b64"
$B64CMD $1 > $B64FILE
# convert to base 64
$B64CMD $IMGFILE > $B64FILE
# insert binary into xml (in-place)
$SEDCMD -i -n '1h;1!H;${ g;s/<data>.*<\/data>/<data>\n<\/data>/;p}' $XMLFILE
$SEDCMD -i "/<data>/r ${B64FILE}" $XMLFILE
# remove temporary file
rm $B64FILE
echo "image $1 embedded into $XMLFILE"
echo "image $IMGFILE embedded into $XMLFILE"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment