On Thursday 12 November 2009, Frans Pop wrote: > While I agree that the option of selecting UTC is worthwhile, I'm not > sure it's worth the raised priority. My suggestion would be to allow UTC > to be preseeded instead, and/or selectable at medium priority.
Here's an alternative patch that dynamically adds UTC as an option, but *only* at medium/low priority. So you get: Country / Prio high medium/low ------- ------------- ---------------------------------- Netherlands: <No dialog> Europe/Amsterdam Universal Time Coordinated (UTC) Mexico: Central Central Mountain Mountain Pacific Pacific Universal Time Coordinated (UTC) This is an improvement over my earlier patch in #442856, as that created an inconsistency between countries with only one and countries with multiple timezones. As an added bonus, the patch reduces the size of the udeb quite a bit because it avoids all the duplicate translations of the descriptions in the per-country templates. Cheers, FJP P.S. Is there any reason why we include debian/common.templates in the repository? AFAICT it's a generated file...
commit de01799ea36f5f45428d37f6a24a1e5e3dc291ca Author: Frans Pop <f...@debian.org> Date: Thu Nov 12 15:49:20 2009 +0100 Dynamically add UTC as option at medium or low priority diff --git a/packages/tzsetup/debian/common.templates.in b/packages/tzsetup/debian/common.templates.in index 9b70248..74c9b67 100644 --- a/packages/tzsetup/debian/common.templates.in +++ b/packages/tzsetup/debian/common.templates.in @@ -1,135 +1,156 @@ Template: time/zone -Type: string -Description: for internal use; can be preseeded - Time zone code +Type: select +Choices-C: ${CHOICES-C} +Choices: ${CHOICES} +Description: ${DESCRIPTION} + +# The descriptions in the per-country templates specify the type of +# prompt that should be displayed; the actual descriptions are in the +# tzsetup/descriptions/* templates. Template: tzsetup/country/AQ Type: select Choices-C: Antarctica/McMurdo, Antarctica/South_Pole, Antarctica/Rothera, Antarctica/Palmer, Antarctica/Mawson, Antarctica/Davis, Antarctica/Casey, Antarctica/Vostok, Antarctica/DumontDUrville, Antarctica/Syowa __Choices: McMurdo, south pole, Rothera, Palmer, Mawson, Davis, Casey, Vostok, Dumont-d'Urville, Syowa -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/AU Type: select Default: Australia/Sydney Choices-C: Australia/Lord_Howe, Australia/Hobart, Australia/Melbourne, Australia/Sydney, Australia/Broken_Hill, Australia/Brisbane, Australia/Lindeman, Australia/Adelaide, Australia/Darwin, Australia/Perth, Australia/Canberra, Australia/Eucla, Australia/Currie, Australia/Yancowinna __Choices: Lord Howe Island, Hobart, Melbourne, Sydney, Broken Hill, Brisbane, Lindeman, Adelaide, Darwin, Perth, Canberra, Eucla, Currie, Yancowinna -_Description: Select a city in your time zone: +Description: city Template: tzsetup/country/BR Type: select Default: America/Sao_Paulo Choices-C: America/Noronha, America/Belem, America/Fortaleza, America/Recife, America/Araguaina, America/Maceio, America/Bahia, America/Sao_Paulo, America/Campo_Grande, America/Cuiaba, America/Porto_Velho, America/Boa_Vista, America/Manaus, America/Eirunepe, America/Rio_Branco __Choices: Noronha, Belem, Fortaleza, Recife, Araguaina, Maceio, Bahia, Sao Paulo, Campo Grande, Cuiaba, Porto Velho, Boa Vista, Manaus, Eirunepe, Rio Branco -_Description: Select a city in your time zone: +Description: city Template: tzsetup/country/CA Type: select Default: Canada/Eastern Choices-C: Canada/Newfoundland, Canada/Atlantic, Canada/Eastern, Canada/Central, Canada/East-Saskatchewan, Canada/Saskatchewan, Canada/Mountain, Canada/Pacific, Canada/Yukon __Choices: Newfoundland, Atlantic, Eastern, Central, East Saskatchewan, Saskatchewan, Mountain, Pacific, Yukon -_Description: Select your time zone: +Description: zone Template: tzsetup/country/CD Type: select Choices-C: Africa/Kinshasa, Africa/Lubumbashi __Choices: Kinshasa, Lubumbashi -_Description: Select a city in your time zone: +Description: city Template: tzsetup/country/CL Type: select Choices-C: America/Santiago, Pacific/Easter __Choices: Santiago, Easter Island -_Description: Select your time zone: +Description: zone Template: tzsetup/country/EC Type: select Choices-C: America/Guayaquil, Pacific/Galapagos __Choices: Guayaquil, Galapagos -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/ES Type: select Choices-C: Europe/Madrid, Africa/Ceuta, Atlantic/Canary __Choices: Madrid, Ceuta, Canary Islands -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/FM Type: select Choices-C: Pacific/Yap, Pacific/Truk, Pacific/Ponape, Pacific/Kosrae __Choices: Yap, Truk, Ponape, Kosrae -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/GL Type: select Choices-C: America/Godthab, America/Danmarkshavn, America/Scoresbysund, America/Thule __Choices: Godthab, Danmarkshavn, Scoresbysund, Thule -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/ID Type: select Choices-C: Asia/Jakarta, Asia/Pontianak, Asia/Makassar, Asia/Jayapura __Choices: Jakarta, Pontianak, Makassar, Jayapura -_Description: Select a city in your time zone: +Description: city Template: tzsetup/country/KI Type: select Choices-C: Pacific/Tarawa, Pacific/Enderbury, Pacific/Kiritimati __Choices: Tarawa (Gilbert Islands), Enderbury (Phoenix Islands), Kiritimati (Line Islands) -_Description: Select your time zone: +Description: zone Template: tzsetup/country/KZ Type: select Choices-C: Asia/Almaty, Asia/Qyzylorda, Asia/Aqtobe, Asia/Aqtau, Asia/Oral __Choices: Almaty, Qyzylorda, Aqtobe, Atyrau, Oral -_Description: Select a city in your time zone: +Description: city Template: tzsetup/country/MN Type: select Choices-C: Asia/Ulaanbaatar, Asia/Hovd, Asia/Choibalsan __Choices: Ulaanbaatar, Hovd, Choibalsan -_Description: Select a city in your time zone: +Description: city Template: tzsetup/country/MX Type: select Choices-C: Mexico/General, Mexico/BajaSur, Mexico/BajaNorte __Choices: Central, Mountain, Pacific -_Description: Select your time zone: +Description: zone Template: tzsetup/country/NZ Type: select Choices-C: Pacific/Auckland, Pacific/Chatham __Choices: Auckland, Chatham Islands -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/PF Type: select Choices-C: Pacific/Tahiti, Pacific/Marquesas, Pacific/Gambier __Choices: Tahiti (Society Islands), Marquesas Islands, Gambier Islands -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/PT Type: select Choices-C: Europe/Lisbon, Atlantic/Madeira, Atlantic/Azores __Choices: Lisbon, Madeira Islands, Azores -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/RU Type: select Default: Europe/Moscow Choices-C: Europe/Kaliningrad, Europe/Moscow, Europe/Samara, Asia/Yekaterinburg, Asia/Omsk, Asia/Novosibirsk, Asia/Krasnoyarsk, Asia/Irkutsk, Asia/Yakutsk, Asia/Vladivostok, Asia/Sakhalin, Asia/Magadan, Asia/Kamchatka, Asia/Anadyr __Choices: Moscow-01 - Kaliningrad, Moscow+00 - west Russia, Moscow+01 - Samara, Moscow+02 - Urals, Moscow+03 - west Siberia, Moscow+03 - Novosibirsk, Moscow+04 - Yenisei River, Moscow+05 - Lake Baikal, Moscow+06 - Lena River, Moscow+07 - Amur River, Moscow+07 - Sakhalin Island, Moscow+08 - Magadan, Moscow+09 - Kamchatka, Moscow+10 - Bering Sea -_Description: Select your time zone: +Description: zone Template: tzsetup/country/UM Type: select Choices-C: Pacific/Johnston, Pacific/Midway, Pacific/Wake __Choices: Johnston Atoll, Midway Islands, Wake Island -_Description: Select a location in your time zone: +Description: location Template: tzsetup/country/US Type: select Default: US/Eastern Choices-C: US/Eastern, US/Central, US/Mountain, US/Pacific, US/Alaska, US/Hawaii, US/Arizona, US/East-Indiana, US/Samoa __Choices: Eastern, Central, Mountain, Pacific, Alaska, Hawaii, Arizona, East Indiana, Samoa +Description: zone + +Template: tzsetup/text/UTC +Type: text +_Description: Universal Time Coordinated (UTC) + +Template: tzsetup/descriptions/zone +Type: text _Description: Select your time zone: + +Template: tzsetup/descriptions/location +Type: text +_Description: Select a location in your time zone: + +Template: tzsetup/descriptions/city +Type: text +_Description: Select a city in your time zone: diff --git a/packages/tzsetup/debian/tzsetup-udeb.templates b/packages/tzsetup/debian/tzsetup-udeb.templates index 38c26e9..b508420 100644 --- a/packages/tzsetup/debian/tzsetup-udeb.templates +++ b/packages/tzsetup/debian/tzsetup-udeb.templates @@ -3,9 +3,3 @@ Type: text # finish-install progress bar item # :sl1: _Description: Saving the time zone... - -Template: tzsetup/selected -Type: note -# :sl1: -_Description: Selected time zone - Based on your country, your time zone is ${ZONE}. diff --git a/packages/tzsetup/tzsetup b/packages/tzsetup/tzsetup index 57cefd7..ca7f23f 100755 --- a/packages/tzsetup/tzsetup +++ b/packages/tzsetup/tzsetup @@ -10,23 +10,50 @@ if [ "$RET" = true ]; then exit 0 fi +UTC= +db_get debconf/priority +case $RET in + medium|low) UTC=1 ;; +esac + +# Get description for UTC timezone +db_metaget tzsetup/text/UTC description +UTC_CHOICE="$RET" + db_get debian-installer/country CC="$RET" # per-country templates are used for countries with multiple choices +# At medium/low priority UTC is dynamically added to the list at medium/low if db_get "tzsetup/country/$CC"; then - db_register "tzsetup/country/$CC" time/zone - db_input high time/zone || : - if ! db_go; then - exit 10 # back to menu - fi + priority=high + db_metaget tzsetup/country/$CC default + zone=$RET + + db_metaget tzsetup/country/$CC choices-c + db_subst time/zone CHOICES-C "$RET${UTC:+, UTC}" + db_metaget tzsetup/country/$CC choices + db_subst time/zone CHOICES "$RET${UTC:+, $UTC_CHOICE}" + + # First get type of description and use that to get actual description + db_metaget tzsetup/country/$CC description + db_metaget tzsetup/descriptions/$RET description + db_subst time/zone DESCRIPTION "$RET" else - db_register time/zone time/zone # might be registered to something else + priority=medium zone=$(grep "^$CC" /usr/share/tzsetup/tzmap | cut -d ' ' -f 2) + + db_subst time/zone CHOICES-C "$zone${UTC:+, UTC}" + db_subst time/zone CHOICES "$zone${UTC:+, $UTC_CHOICE}" + db_metaget tzsetup/descriptions/zone description + db_subst time/zone DESCRIPTION "$RET" +fi + +db_get time/zone +if [ -z "$RET" ]; then db_set time/zone "$zone" +fi - db_subst tzsetup/selected ZONE $zone - db_input medium tzsetup/selected || true - if ! db_go; then - exit 10 # back to menu - fi +db_input $priority time/zone || : +if ! db_go; then + exit 10 # back to menu fi