forked from PeachyPrinter/peachy-pro-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.sh
executable file
·82 lines (76 loc) · 2.04 KB
/
Program.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
OVERRIDE_FILE="inc/overrides.h"
NOT_SAFE_OVERRIDES="./overrides/not_safe_overrides.h"
SAFE_OVERRIDES="./overrides/safe_overrides.h"
MODE="UNKOWN"
VERSION="$(./version.sh)"
echo
echo 'Is the Git repository at:' $PWD ' ?'
echo 'if not change path inside script'
echo
echo 'Short Programming pins and plug in usb (pins labeled JP4)'
while true; do
echo
echo ---------------------------
echo 'Checked out git:' $VERSION
echo 'Current git state:' $MODE
echo ---------------------------
echo 'q) Quit (CTRL+c at any time)'
echo '1) program YXE3D'
echo '2) recompile current files'
echo '3) compile master branch'
echo '4) compile not_safe branch'
echo '5) git pull'
echo '6) reset local git files'
read -p "Give option (q|1|2|3|4|5|6):" input
if [ $input == 1 ]; then
dfu-util -a 0 --dfuse-address 0x08000000 -D main.bin -d 16d0:0af3
elif [ $input == 2 ]; then
make
MODE="USER-COMPILED"
elif [ $input == 3 ]; then
git checkout master
cp $SAFE_OVERRIDES $OVERRIDE_FILE
make
MODE="MASTER"
VERSION="$(./version.sh)"
elif [ $input == 4 ]; then
#git checkout not_safe
cp $NOT_SAFE_OVERRIDES $OVERRIDE_FILE
make
MODE="NOT_SAFE"
VERSION="$(./version.sh)"
elif [ $input == 5 ]; then
git pull
VERSION="$(./version.sh)"
elif [ $input == 6 ]; then
echo
echo ---------------------------
echo 'CAUTION: This will remove all your modified files'
echo ' This deletes files and re-pulls'
echo ---------------------------
echo
read -p "Are you sure you want to start over? (y|N):" choice
if [ "$choice" == "y" ]; then
git rm --cached -r .
git reset --hard
git checkout master
cp $SAFE_OVERRIDES $OVERRIDE_FILE
make
MODE="MASTER"
fi
elif [ $input == 7 ]; then
echo
echo ---------------------------
echo 'Please only do this if your name is Will'
echo 'Gavin.... Just stop ;)'
echo ---------------------------
echo
read -p "Are you sure you want to merge? (y|N):" merge
if [ "$merge" == "y" ]; then
source merge_master_not_safe.sh
fi
elif [ "$input" == "q" ]; then
exit
fi
done