mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-17 06:29:15 +01:00
installer.sh script bug fix and enhancements
This commit is contained in:
parent
95945eab4c
commit
57292c2250
34
installer.sh
34
installer.sh
@ -37,6 +37,10 @@ function need () {
|
|||||||
|
|
||||||
|
|
||||||
need git
|
need git
|
||||||
|
if test -d `basename "$DCCEXGITURL"` ; then
|
||||||
|
: assume we are almost there
|
||||||
|
cd `basename "$DCCEXGITURL"` || exit 255
|
||||||
|
fi
|
||||||
if test -d .git ; then
|
if test -d .git ; then
|
||||||
: assume we are right here
|
: assume we are right here
|
||||||
git pull
|
git pull
|
||||||
@ -44,6 +48,21 @@ else
|
|||||||
git clone "$DCCEXGITURL"
|
git clone "$DCCEXGITURL"
|
||||||
cd `basename "$DCCEXGITURL"` || exit 255
|
cd `basename "$DCCEXGITURL"` || exit 255
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# prepare versions
|
||||||
|
VERSIONS=/tmp/versions.$$
|
||||||
|
git tag --sort=v:refname | grep Prod | tail -1 > $VERSIONS
|
||||||
|
echo master >> $VERSIONS
|
||||||
|
git tag --sort=v:refname | grep Devel | tail -1 >> $VERSIONS
|
||||||
|
echo devel >> $VERSIONS
|
||||||
|
|
||||||
|
# ask user what version to use
|
||||||
|
echo "What version to use? (give line number) If in doubt, use 1"
|
||||||
|
cat -n $VERSIONS
|
||||||
|
echo -n "> "
|
||||||
|
LINE=`awk 'BEGIN {getline A < "/dev/tty"} ; A == NR {print}' $VERSIONS`
|
||||||
|
git checkout $LINE
|
||||||
|
|
||||||
if test -f config.h ; then
|
if test -f config.h ; then
|
||||||
: all well
|
: all well
|
||||||
else
|
else
|
||||||
@ -63,7 +82,14 @@ $ACLI core update-index || exit 255
|
|||||||
|
|
||||||
# Board discovery
|
# Board discovery
|
||||||
BOARDS=/tmp/boards.$$
|
BOARDS=/tmp/boards.$$
|
||||||
$ACLI board list | grep serial > $BOARDS
|
$ACLI board list > /dev/null # download missing components
|
||||||
|
$ACLI board list | grep serial > $BOARDS # real run
|
||||||
|
if test -s $BOARDS ; then
|
||||||
|
: all well
|
||||||
|
else
|
||||||
|
echo "$ACLI: No boards found"
|
||||||
|
exit 255
|
||||||
|
fi
|
||||||
if test x`< $BOARDS wc -l` = 'x1' ; then
|
if test x`< $BOARDS wc -l` = 'x1' ; then
|
||||||
LINE=`cat $BOARDS`
|
LINE=`cat $BOARDS`
|
||||||
else
|
else
|
||||||
@ -96,6 +122,6 @@ echo FQBN is $FQBN
|
|||||||
|
|
||||||
# Install phase
|
# Install phase
|
||||||
$ACLI core install `echo $FQBN | sed 's,:[^:]*$,,1'` # remove last component to get package
|
$ACLI core install `echo $FQBN | sed 's,:[^:]*$,,1'` # remove last component to get package
|
||||||
$ACLI board attach -p $PORT --fqbn $FQBN $PWD
|
$ACLI board attach -p $PORT --fqbn $FQBN "$PWD"
|
||||||
$ACLI compile --fqbn $FQBN $PWD
|
$ACLI compile --fqbn $FQBN "$PWD"
|
||||||
$ACLI upload -v -t -p $PORT $PWD
|
$ACLI upload -v -t -p $PORT "$PWD"
|
||||||
|
Loading…
Reference in New Issue
Block a user