config file can be uploaded with this script, too

This commit is contained in:
Ollo 2021-03-21 16:06:26 +01:00
parent 2e77516d43
commit 7939bf578d

View File

@ -37,22 +37,35 @@ else
FILES=$2 FILES=$2
fi fi
echo "Generate DIET version of the files" # Convert files, if necessary
OUTFILES="" if [ "$FILES" != "config.lua" ]; then
ROOTDIR=$PWD echo "Generate DIET version of the files"
cd $TOOLDIR OUTFILES=""
for f in $FILES; do ROOTDIR=$PWD
if [[ "$f" == *.lua ]] && [[ "$f" != init.lua ]]; then cd $TOOLDIR
echo "Compress $f ..." for f in $FILES; do
out=$(echo "$f" | sed 's/.lua/_diet.lua/g') if [[ "$f" == *.lua ]] && [[ "$f" != init.lua ]]; then
$DIET ../$f -o ../diet/$out echo "Compress $f ..."
OUTFILES="$OUTFILES diet/$out" out=$(echo "$f" | sed 's/.lua/_diet.lua/g')
else $DIET ../$f -o ../diet/$out
OUTFILES="$OUTFILES $f" OUTFILES="$OUTFILES diet/$out"
fi else
done OUTFILES="$OUTFILES $f"
FILES=$OUTFILES fi
cd $ROOTDIR done
FILES=$OUTFILES
cd $ROOTDIR
fi
echo "Reboot ESP and stop init timer"
if [ ! -f $LUASCRIPT_STOP ]; then
echo "Cannot find $LUASCRIPT_STOP"
exit 1
fi
python3 $LUATOOL -p $DEVICE -f $LUASCRIPT_STOP -b $BAUD --volatile --delay 2
if [ $? -ne 0 ]; then
echo "Could not reboot"
exit 1
fi
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
# Format filesystem first # Format filesystem first
@ -62,17 +75,6 @@ if [ $# -eq 1 ]; then
echo "STOOOOP" echo "STOOOOP"
exit 1 exit 1
fi fi
else
echo "Reboot ESP and stop init timer"
if [ ! -f $LUASCRIPT_STOP ]; then
echo "Cannot find $LUASCRIPT_STOP"
exit 1
fi
python3 $LUATOOL -p $DEVICE -f $LUASCRIPT_STOP -b $BAUD --volatile --delay 2
if [ $? -ne 0 ]; then
echo "Could not reboot"
exit 1
fi
fi fi
echo "Start Flasing ..." echo "Start Flasing ..."