forked from dfu-programmer/dfu-programmer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·37 lines (31 loc) · 1.22 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /bin/sh
aclocal -I m4
autoheader
automake --foreign --add-missing --copy
autoconf
if [ "$(echo `uname`)" = "Linux" ]; then
TARGET_START_LINE=$( grep START_TARGET_LIST_LINE -n src/arguments.c | \
sed "s/^\(.*\):.*/\1/")
TARGET_END_LINE=$( grep END_TARGET_LIST_LINE -n src/arguments.c | \
sed "s/^\(.*\):.*/\1/")
TARGET_INFO=$( sed -n "$TARGET_START_LINE,$TARGET_END_LINE p" src/arguments.c | \
grep "^\s*{ \"" | sed 's/.*"\(.*\)".*,\s*\([xX0-9A-Fa-f]*\)\s*},/\1::\2/' )
DFU_COMP=dfu_programmer
echo \#\ autocomplete\ script > $DFU_COMP
echo "# code sourced from dfu_completion, DO NOT EDIT IN THIS FILE" \
>> $DFU_COMP
echo >> $DFU_COMP
echo -n "TARGET_INFO=\" " >> $DFU_COMP
echo -n $TARGET_INFO >> $DFU_COMP
echo " \"" >> $DFU_COMP
echo >> $DFU_COMP
echo >> $DFU_COMP
cat dfu_completion >> $DFU_COMP
chmod +x $DFU_COMP
#if [ "$(cat /etc/*release | grep DISTRIB_ID | sed 's/DISTRIB_ID=//')" = "Ubuntu" ]]; then
echo "To install tab completion run"
echo " \$ sudo mv $DFU_COMP /etc/bash_completion.d/"
#fi
echo "To use tab completion in this terminal run"
echo " \$ source $DFU_COMP"
fi