Skip to content

Commit 6c1ee74

Browse files
committed
1 parent 0b1a4a1 commit 6c1ee74

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

baseimage/build/opt/init-wrapper/pre-init.d/01-set-lang-and-tz

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ if [ -n "${DEFAULT_LANG}" ]; then
1313
fi
1414

1515
if [ -n "${DEFAULT_TZ}" ]; then
16-
echo "${DEFAULT_TZ}" > /etc/timezone
17-
# workaround: see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813226
18-
[ -L /etc/localtime ] && rm /etc/localtime
19-
dpkg-reconfigure -f noninteractive tzdata 1>/dev/null 2>/dev/null
20-
etckeeper commit "set timezone to ${DEFAULT_TZ}" 1>/dev/null 2>/dev/null
16+
if [ -e /usr/share/zoneinfo/${DEFAULT_TZ} ]; then
17+
TZ_FILE=$(readlink -f /usr/share/zoneinfo/${DEFAULT_TZ})
18+
ln -nsf ${TZ_FILE} /etc/localtime
19+
if etckeeper unclean 1>/dev/null 2>/dev/null; then
20+
etckeeper commit "set timezone to ${DEFAULT_TZ}" 1>/dev/null 2>/dev/null
21+
fi
22+
fi
2123
fi

baseimage/build/scripts/01-setup

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ etckeeper commit "localepurge: purge locales other than en and ja"
5757
##
5858
## configure timezone
5959
##
60-
echo "Asia/Tokyo" > /etc/timezone
61-
# workaround: see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813226
62-
[ -L /etc/localtime ] && rm /etc/localtime
63-
dpkg-reconfigure -f noninteractive tzdata
60+
ln -nsf /usr/share/zoneinfo/Asia/Tokyo /usr/localtime
6461
etckeeper commit "set timezone"
6562

6663
##

spec/baseimage/00base_spec.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@
7171
its(:content){ should match /^ja_JP\.UTF-8\s+UTF-8\s*/ }
7272
end
7373

74-
describe file("/etc/timezone") do
75-
its(:content){ should include 'Asia/Tokyo' }
76-
end
77-
7874
describe file("/etc/localtime") do
7975
it { should be_linked_to '/usr/share/zoneinfo/Asia/Tokyo' }
8076
end
@@ -223,10 +219,6 @@
223219
its(:content){ should include 'LANG=en_US.UTF-8' }
224220
end
225221

226-
describe file("/etc/timezone") do
227-
its(:content){ should include 'Etc/UTC' }
228-
end
229-
230222
describe file("/etc/localtime") do
231223
it { should be_linked_to '/usr/share/zoneinfo/Etc/UTC' }
232224
end

0 commit comments

Comments
 (0)