File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -634,12 +634,21 @@ switch_ubuntu_local_mirror(){
634634 ' Warning: Unable to detect the local region code, falling back to the current settings.\n' \
635635 1>&2
636636 return 0
637- else
637+ fi
638+
639+ local regex_region_code=' ^[a-z]{2,3}$'
640+ if ! [[ " ${region_code} " =~ ${regex_region_code} ]]; then
638641 printf \
639- ' Info: Local region code determined to be "%s".\n' \
640- " ${region_code} "
642+ ' Error: Local region code "%s" is not valid.\n' \
643+ " ${region_code} " \
644+ 1>&2
645+ return 2
641646 fi
642647
648+ printf \
649+ ' Info: Local region code determined to be "%s".\n' \
650+ " ${region_code} "
651+
643652 if test -n " ${region_code} " ; then
644653 printf \
645654 ' Info: Checking whether the local Ubuntu archive mirror exists...\n'
You can’t perform that action at this time.
0 commit comments