Skip to content

Commit 7c7343a

Browse files
committed
Add prompt for cleanup command
1 parent d58e511 commit 7c7343a

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

hpcts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ log_info() {
44
printf "\n\e[0;35m $1\e[0m\n\n"
55
}
66

7+
log_warn() {
8+
printf "\e[0;33m $1\e[0m\n"
9+
}
10+
711
start() {
812
log_info "Fetching latest HPC Toolset Images.."
913
docker-compose pull
@@ -30,9 +34,18 @@ destroy() {
3034
}
3135

3236
cleanup() {
33-
log_info "Removing HPC Toolset containers and images.."
34-
destroy
35-
docker rmi $(docker images -f "reference=ubccr/hpcts*" -q)
37+
log_warn "** WARNING: This will remove all container images and you'll need to re-download **"
38+
log_warn "You probably want to try running the 'destroy' command first."
39+
echo ""
40+
read -p "Do you want to proceed? (yes/no) " yn
41+
42+
if [[ $yn == y* ]]; then
43+
log_info "Removing HPC Toolset containers and images.."
44+
destroy
45+
docker rmi $(docker images -f "reference=ubccr/hpcts*" -q)
46+
else
47+
log_info "cleanup cancelled. existing.."
48+
fi
3649
}
3750

3851
case "$1" in

0 commit comments

Comments
 (0)