File: clock-setup.postinst

package info (click to toggle)
clock-setup 0.15
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 300 kB
  • ctags: 1
  • sloc: sh: 55; makefile: 25
file content (50 lines) | stat: -rwxr-xr-x 874 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

db_progress START 0 1 clock-setup/progress/title
db_progress INFO clock-setup/progress/working

os_needs_local_clock () {
	while read line; do
		shortname=$(echo "$line" | cut -d : -f 3)
		case $shortname in
		MS-DOS*|Windows*|FreeDOS*) # keep in sync with os-prober
			return 0
		;;
		esac
	done
	return 1
}

pri=high

if db_fget clock-setup/utc seen && [ "$RET" = true ]; then
	# keep preseeded value
	:
else
	probed=$(os-prober)

	if echo "$probed" | os_needs_local_clock; then
		# default to localtime for some OSes
		db_set clock-setup/utc false
		pri=low
	fi

	if [ -z "$probed" ]; then
		# installing the only OS, so use UTC
		db_set clock-setup/utc true
		pri=low
	fi
fi

db_progress STEP 1

db_input $pri clock-setup/utc || true
if ! db_go; then
	db_progress stop
	exit 10 # back to main menu
fi

db_progress stop