Skip to content

Commit 5e4f196

Browse files
adding app removal to big_red
1 parent 82ff2ac commit 5e4f196

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

scripts/big_red_button.sh

+36-1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,33 @@ function prune_registry() {
184184
info_log "END: ${FUNCNAME[0]}"
185185
}
186186

187+
############################################################
188+
# Remove apps that we installed as part of setup
189+
############################################################
190+
function remove_app(){
191+
local app=""
192+
193+
while [[ "$#" -gt 0 ]]; do
194+
case $1 in
195+
--app)
196+
shift
197+
app=$1
198+
;;
199+
*) echo "Unknown parameter '$1'"; show_help ;;
200+
esac
201+
shift
202+
done
203+
204+
run_a_script "which -a ${app}" app_paths --ignore_error
205+
for app_path in $app_paths; do
206+
if [[ -f "$app_path" ]]; then
207+
debug_log "Removing ${app} at $app_path"
208+
run_a_script "sudo rm -f $app_path"
209+
debug_log "...successfull removed old version of ${app} at $app_path"
210+
fi
211+
done
212+
}
213+
187214
############################################################
188215
# Remove k3s data directory if its been changed
189216
############################################################
@@ -214,17 +241,25 @@ function main() {
214241
show_header
215242

216243
check_and_disable_k3s
217-
218244
stop_all_docker_containers
219245
remove_k3s
220246
prune_docker
221247
prune_registry
248+
222249
remove_k3s_data_dir
223250

224251
info_log "Removing '${SPACEFX_DIR:?}'..."
225252
run_a_script "rm -rf ${SPACEFX_DIR:?}"
226253
info_log "...successfully removed '${SPACEFX_DIR:?}'"
227254

255+
remove_app --app "yq"
256+
remove_app --app "jq"
257+
remove_app --app "regctl"
258+
remove_app --app "cfssl"
259+
remove_app --app "cfssljson"
260+
remove_app --app "helm"
261+
262+
228263
info_log "------------------------------------------"
229264
info_log "END: ${SCRIPT_NAME}"
230265
}

0 commit comments

Comments
 (0)