diff options
| author | CoprDistGit <infra@openeuler.org> | 2024-10-15 06:24:53 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2024-10-15 06:24:53 +0000 |
| commit | 2fb6e0cf79df2056e9750e29669c4633555e74b8 (patch) | |
| tree | a1ad5fd201e579ad1245110c036501053a8794b3 /remove-country-selection-from-tzselect.patch | |
| parent | 711949a2ac2288db2115787d9d9cca9cef093ccf (diff) | |
automatic import of glibcopeneuler22.03_LTS_SP3
Diffstat (limited to 'remove-country-selection-from-tzselect.patch')
| -rw-r--r-- | remove-country-selection-from-tzselect.patch | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/remove-country-selection-from-tzselect.patch b/remove-country-selection-from-tzselect.patch new file mode 100644 index 0000000..5b00087 --- /dev/null +++ b/remove-country-selection-from-tzselect.patch @@ -0,0 +1,151 @@ +From dff0000cc458d6d4993b821f2badcf31ea28062e Mon Sep 17 00:00:00 2001 +From: MarsChan <cmm8293@163.com> +Date: Sun, 6 Sep 2020 09:42:44 +0800 +Subject: [PATCH] remove country selection from tzselect.ksh + +--- + timezone/tzselect.ksh | 98 +++++++++---------------------------------- + 1 file changed, 20 insertions(+), 78 deletions(-) + +diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh +index 18fce27e..7e31798c 100755 +--- a/timezone/tzselect.ksh ++++ b/timezone/tzselect.ksh +@@ -51,7 +51,7 @@ say() { + + coord= + location_limit=10 +-zonetabtype=zone1970 ++zonetabtype=zone + + usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT] + Select a timezone interactively. +@@ -398,94 +398,37 @@ while + '` + ;; + *) +- # Get list of names of countries in the continent or ocean. +- countries=`$AWK \ ++ # Get list of regions in the continent or ocean. ++ timezones=`$AWK \ + -v continent="$continent" \ + -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ + ' + BEGIN { FS = "\t" } + /^#/ { next } + $3 ~ ("^" continent "/") { +- ncc = split($1, cc, /,/) ++ ncc = split($3, cc, /,/) + for (i = 1; i <= ncc; i++) + if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i] + } + END { +- while (getline <TZ_COUNTRY_TABLE) { +- if ($0 !~ /^#/) cc_name[$1] = $2 +- } + for (i = 1; i <= ccs; i++) { +- country = cc_list[i] +- if (cc_name[country]) { +- country = cc_name[country] +- } +- print country ++ print cc_list[i] + } + } + ' <"$TZ_ZONE_TABLE" | sort -f` +- +- +- # If there's more than one country, ask the user which one. +- case $countries in +- *"$newline"*) +- echo >&2 'Please select a country' \ +- 'whose clocks agree with yours.' +- doselect $countries +- country=$select_result;; +- *) +- country=$countries +- esac +- +- +- # Get list of timezones in the country. +- regions=`$AWK \ +- -v country="$country" \ +- -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ +- ' +- BEGIN { +- FS = "\t" +- cc = country +- while (getline <TZ_COUNTRY_TABLE) { +- if ($0 !~ /^#/ && country == $2) { +- cc = $1 +- break +- } +- } +- } +- /^#/ { next } +- $1 ~ cc { print $4 } +- ' <"$TZ_ZONE_TABLE"` +- +- +- # If there's more than one region, ask the user which one. +- case $regions in +- *"$newline"*) +- echo >&2 'Please select one of the following timezones.' +- doselect $regions +- region=$select_result;; +- *) +- region=$regions +- esac ++ regions=[] ++ index=0 ++ for item in $timezones; do ++ regions[$index]=`echo $item | awk -F '/' '{print $2}'` ++ index=$(($index+1)) ++ done ++ echo >&2 'Please select a timezone' \ ++ 'whose clocks agree with yours.' ++ doselect ${regions[@]} ++ region=$select_result + + # Determine TZ from country and region. +- TZ=`$AWK \ +- -v country="$country" \ +- -v region="$region" \ +- -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ +- ' +- BEGIN { +- FS = "\t" +- cc = country +- while (getline <TZ_COUNTRY_TABLE) { +- if ($0 !~ /^#/ && country == $2) { +- cc = $1 +- break +- } +- } +- } +- /^#/ { next } +- $1 ~ cc && $4 == region { print $3 } +- ' <"$TZ_ZONE_TABLE"` ++ TZ=$continent/$region + esac + + # Make sure the corresponding zoneinfo file exists. +@@ -523,11 +466,10 @@ Universal Time is now: $UTdate." + echo >&2 "" + echo >&2 "The following information has been given:" + echo >&2 "" +- case $country%$region%$coord in +- ?*%?*%) say >&2 " $country$newline $region";; +- ?*%%) say >&2 " $country";; +- %?*%?*) say >&2 " coord $coord$newline $region";; +- %%?*) say >&2 " coord $coord";; ++ case $region%$coord in ++ ?*%) say >&2 " $region";; ++ ?*%?*) say >&2 " coord $coord$newline $region";; ++ %?*) say >&2 " coord $coord";; + *) say >&2 " TZ='$TZ'" + esac + say >&2 "" +-- +2.24.3 (Apple Git-128) + |
