2022-04-28 22:09:23 +00:00
|
|
|
#!/bin/zsh
|
2022-05-24 16:26:05 +00:00
|
|
|
_DEPENDENCIES+=()
|
|
|
|
_REQUIRED_ENV+=()
|
2022-04-28 22:09:23 +00:00
|
|
|
source ${0:a:h}/common.zsh
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
_EFS_DISCONNECT() {
|
|
|
|
[ ! -d "$AWS__EFS__LOCAL_MOUNT_POINT" ] && {
|
|
|
|
__STATUS 'no efs currently mounted'
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
local MOUNTED=$(ls "$AWS__EFS__LOCAL_MOUNT_POINT")
|
|
|
|
[ ! $MOUNTED ] && {
|
|
|
|
__STATUS 'no efs currently mounted'
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
__GETSUDO || exit 1
|
|
|
|
|
|
|
|
|
|
|
|
local SELECTED=$(echo $MOUNTED | __FZF 'select a file system to unmount')
|
|
|
|
[ ! $SELECTED ] && __ABORT
|
|
|
|
|
|
|
|
local EFS="$AWS__EFS__LOCAL_MOUNT_POINT/$SELECTED"
|
|
|
|
__STATUS "unmounting '$SELECTED'"
|
|
|
|
sudo umount $EFS >/dev/null 2>&1
|
|
|
|
sudo rmdir $EFS \
|
|
|
|
&& __SUCCESS "done" \
|
|
|
|
|| __FAIL 2 "failed to unmount '$EFS'"
|
|
|
|
}
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
_EFS_DISCONNECT
|