modify check

This commit is contained in:
AustrianToast 2024-07-13 00:19:42 +02:00
parent 6593f087c4
commit 3198a02081
Signed by: AustrianToast
GPG Key ID: 378A29F999424B1C

21
update
View File

@ -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