modify check
This commit is contained in:
parent
6593f087c4
commit
3198a02081
21
update
21
update
@ -10,21 +10,20 @@ DATE="$(date +"%Y-%m-%dT%H:%M:%S%:z")" # RFC 3339 date-time https://datatracker
|
||||
source "$HOME"/.config/update.conf || exit 1
|
||||
|
||||
check_for_valid_backup_location() {
|
||||
if [ $1 ]; then
|
||||
if [ ! -d $1 ]; then
|
||||
echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}"
|
||||
read -p "Do you want to create the path and continue? [y/N]" input
|
||||
case $input in
|
||||
[Yy]) mkdir --parents "$1" ;;
|
||||
[Nn]) exit 0;;
|
||||
* ) exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
[[ $BACKUP_LOCATION ]] || echo -e "${IYELLOW}BACKUP_LOCATION has not been specified${NO_COLOR}"
|
||||
if [ ! -d $1 ]; then
|
||||
echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}"
|
||||
read -p "Do you want to create the path and continue? [y/N]" input
|
||||
case $input in
|
||||
[Yy]) mkdir --parents "$1" ;;
|
||||
[Nn]) exit 0;;
|
||||
* ) exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
check_for_valid_backup_location "$BACKUP_LOCATION"
|
||||
check_for_valid_backup_location "$SECONDARY_BACKUP_LOCATION"
|
||||
[[ $SECONDARY_BACKUP_LOCATION ]] && check_for_valid_backup_location "$SECONDARY_BACKUP_LOCATION"
|
||||
|
||||
trap interrupt_function INT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user