forked from loopnlearn/loopbuildscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildLoopFixedDev.sh
More file actions
executable file
·194 lines (178 loc) · 6.67 KB
/
BuildLoopFixedDev.sh
File metadata and controls
executable file
·194 lines (178 loc) · 6.67 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/bash # script BuildLoopFixedDev.sh
############################################################
# this code must be repeated in any build script that uses build_functions.sh
############################################################
BUILD_DIR=~/Downloads/"BuildLoop"
SCRIPT_DIR="${BUILD_DIR}/Scripts"
if [ ! -d "${BUILD_DIR}" ]; then
mkdir "${BUILD_DIR}"
fi
if [ ! -d "${SCRIPT_DIR}" ]; then
mkdir "${SCRIPT_DIR}"
fi
STARTING_DIR="${PWD}"
# change directory to $SCRIPT_DIR before curl calls
cd "${SCRIPT_DIR}"
# define branch (to make it easier when updating)
# typically branch is main
SCRIPT_BRANCH=main
# store a copy of build_functions.sh in script directory
curl -fsSLo ./build_functions.sh https://raw.githubusercontent.com/loopnlearn/LoopBuildScripts/$SCRIPT_BRANCH/build_functions.sh
# Verify build_functions.sh was downloaded.
if [ ! -f ./build_functions.sh ]; then
echo -e "\n *** Error *** build_functions.sh not downloaded "
echo -e "Please attempt to download manually"
echo -e " Copy the following line and paste into terminal\n"
echo -e "curl -SLo ~/Downloads/BuildLoop/Scripts/build_functions.sh https://raw.githubusercontent.com/loopnlearn/LoopBuildScripts/main/build_functions.sh"
echo -e ""
exit
fi
# This brings in functions from build_functions.sh
# When testing update to build_functions.sh, set to 1 for testing only
DEBUG_FLAG=0
if [ ${DEBUG_FLAG} == 0 ]; then
source ./build_functions.sh
else
source ~/Downloads/ManualClones/lnl/loopbuildscripts/build_functions.sh
fi
############################################################
# The rest of this is specific to BuildLoopFixedDev.sh
############################################################
# store a copy of this script.sh in script directory
curl -fsSLo ./BuildLoopFixedDev.sh https://raw.githubusercontent.com/loopnlearn/LoopBuildScripts/$SCRIPT_BRANCH/BuildLoopFixedDev.sh
# Stable Dev SHA
LOOP_DEV_TESTED_SHA=885cbd3
LOOP_DEV_TESTED_DATE="2023 Jan 11"
FAPS_DEV_TESTED_SHA=dc27707
FAPS_DEV_TESTED_DATE="2023 Jan 11"
FIXED_SHA=0
section_separator
BRANCH_LOOP=dev
BRANCH_FREE=freeaps_dev
LOOPCONFIGOVERRIDE_VALID=1
echo -e "\n ${RED}${BOLD}You are running the script for the development version${NC}"
echo -e " -- If you choose Loop, branch is ${RED}${BOLD}${BRANCH_LOOP}${NC}"
echo -e " -- If you choose FreeAPS, branch is ${RED}${BOLD}${BRANCH_FREE}"
echo -e "\n** The version prepared might not be the most recent development version **"
echo -e "\n** Be aware that a development version may require frequent rebuilds **${NC}\n"
echo -e " If you have not read this section of LoopDocs - please review before continuing"
echo -e " https://loopkit.github.io/loopdocs/faqs/branch-faqs/#whats-going-on-in-the-dev-branch"
return_when_ready
#
echo -e "\nThis script chooses a version (commit) of the development branch"
echo -e " that has been built and lightly tested"
echo -e "${RED}${BOLD}Loop development branch version (includes Dexcom G7 Support):"
echo -e " ${LOOP_DEV_TESTED_DATE} workspace revision ${LOOP_DEV_TESTED_SHA}"
echo -e "FreeAPS development branch version:"
echo -e " ${FAPS_DEV_TESTED_DATE} workspace revision ${FAPS_DEV_TESTED_SHA}"
echo -e "${NC}\nBefore you begin, please ensure"
echo -e " you have Xcode and Xcode command line tools installed\n"
echo -e "Please select which version of Loop you would like to download and build"
choose_or_cancel
options=("Loop dev" "FreeAPS dev" "Cancel")
select opt in "${options[@]}"
do
case $opt in
"Loop dev")
FORK_NAME=Loop
REPO=https://github.com/LoopKit/LoopWorkspace
BRANCH=dev
FIXED_SHA=$LOOP_DEV_TESTED_SHA
LOOPCONFIGOVERRIDE_VALID=1
break
;;
"FreeAPS dev")
FORK_NAME=FreeAPS
REPO=https://github.com/loopnlearn/LoopWorkspace
BRANCH=freeaps_dev
FIXED_SHA=$FAPS_DEV_TESTED_SHA
LOOPCONFIGOVERRIDE_VALID=1
break
;;
"Cancel")
cancel_entry
;;
*)
invalid_entry
;;
esac
done
LOOP_DIR="${BUILD_DIR}/${FORK_NAME}-${BRANCH}-${DOWNLOAD_DATE}_${FIXED_SHA}"
if [ ${FRESH_CLONE} == 1 ]; then
mkdir "${LOOP_DIR}"
else
LOOP_DIR="${STARTING_DIR}"
fi
cd "${LOOP_DIR}"
section_separator
if [ ${FRESH_CLONE} == 1 ]; then
echo -e " -- Downloading ${FORK_NAME} ${BRANCH} to your Downloads folder --"
echo -e " ${LOOP_DIR}\n"
echo -e "Issuing this command:"
echo -e " git clone --branch=${BRANCH} --recurse-submodules ${REPO}"
git clone --branch=$BRANCH --recurse-submodules $REPO
fi
#
clone_download_error_check
options=("Continue" "Cancel")
select opt in "${options[@]}"
do
section_separator
case $opt in
"Continue")
cd LoopWorkspace
this_dir="$(pwd)"
echo -e "In ${this_dir}"
if [ ${FRESH_CLONE} == 0 ]; then
echo -e "\nScript used with test flag, extra steps to prepare downloaded code\n"
echo -e " Updating to latest commit"
git checkout $BRANCH
git pull
fi
echo -e " Checking out commit ${FIXED_SHA}\n"
git checkout $FIXED_SHA --recurse-submodules --quiet
git --no-pager branch
echo -e "Continue if no errors reported"
choose_or_cancel
options=("Continue" "Cancel")
select opt in "${options[@]}"
do
case $opt in
"Continue")
break
;;
"Cancel")
cancel_entry
;;
*) # Invalid option
invalid_entry
;;
esac
done
if [ ${LOOPCONFIGOVERRIDE_VALID} == 1 ]; then
check_config_override_existence_offer_to_configure
fi
section_separator
echo -e "The following items will open (when you are ready)"
echo -e "* Webpage with detailed build steps (LoopDocs)"
echo -e "* Xcode ready to prep your current download for build"
before_final_return_message
return_when_ready
if [ ${FIXED_SHA} == 0 ]; then
open "https://loopkit.github.io/loopdocs/build/step14/#prepare-to-build"
else
open "https://loopkit.github.io/loopdocs/build/step13/#build-loop"
fi
sleep 5
xed .
exit_message
break
;;
"Cancel")
cancel_entry
;;
*)
invalid_entry
;;
esac
done