Cleanup and bug fixes
This commit is contained in:
parent
7996ced5f5
commit
61215ebde8
1 changed files with 8 additions and 5 deletions
13
arkdep
13
arkdep
|
@ -36,7 +36,7 @@ source $(readlink -m $arkdep_dir/config)
|
|||
# Cleanup and quit if error
|
||||
cleanup_and_quit () {
|
||||
|
||||
# If any paramters are passed we will assume it to be an error
|
||||
# If any paramters are passed we will assume it to be an error message
|
||||
[[ -n $1 ]] && printf "\e[1;31m<#>\e[0m $*\e[0m\n" >&2
|
||||
|
||||
# Remove the subvolume we were working on
|
||||
|
@ -180,13 +180,16 @@ teardown () {
|
|||
|
||||
}
|
||||
|
||||
# TODO: Make it accept multiple deployments
|
||||
remove_deployment () {
|
||||
|
||||
# Ensure required vars are set
|
||||
[[ ! -n $1 ]] && \
|
||||
[[ -z $2 ]] && \
|
||||
printf 'No deployment defined\n' && exit 1
|
||||
|
||||
# Ensure user only provided a single target
|
||||
[[ ! -z $3 ]] && \
|
||||
printf 'Multiple targets provided, remove only accepts a single target at a time\n' && exit 1
|
||||
|
||||
declare -r hits=($(grep -v $1 $arkdep_dir/tracker))
|
||||
|
||||
if [[ ${#hits[@]} -gt 1 ]]; then
|
||||
|
@ -213,7 +216,7 @@ remove_deployment () {
|
|||
rm -rf $(readlink -m $arkdep_dir/deployments/$target)
|
||||
|
||||
# Remove from tracker
|
||||
grep -v $1 $arkdep_dir/tracker > $arkdep_dir/tracker_tmp
|
||||
grep -v $2 $arkdep_dir/tracker > $arkdep_dir/tracker_tmp
|
||||
mv $arkdep_dir/tracker_tmp $arkdep_dir/tracker
|
||||
|
||||
exit 0
|
||||
|
@ -454,4 +457,4 @@ deploy () {
|
|||
[[ $1 == 'get-available' ]] && get_available
|
||||
[[ $1 == 'deploy' ]] && deploy $1 $2 $3
|
||||
[[ $1 == 'list' ]] && list_deployed
|
||||
[[ $1 == 'remove' ]] && remove_deployment $1
|
||||
[[ $1 == 'remove' ]] && remove_deployment $1 $2 $3
|
||||
|
|
Loading…
Add table
Reference in a new issue