Dash:
[t2.git] / package / base / stone / stone_mod_hardware.sh
blob060c2ae3d8d48d4d3c4564807bd61f02239cfb2e
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../stone/stone_mod_hardware.sh
5 # Copyright (C) 2004 - 2020 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 # [MAIN] 20 hardware Kernel Drivers and Hardware Configuration
18 store_clock() {
19 if [ -f /etc/conf/clock ] ; then
20 sed -e "s/clock_tz=.*/clock_tz=$clock_tz/" \
21 -e "s/clock_rtc=.*/clock_rtc=$clock_rtc/" \
22 < /etc/conf/clock > /etc/conf/clock.tmp
23 grep -q clock_tz= /etc/conf/clock.tmp || \
24 echo clock_tz=$clock_tz >> /etc/conf/clock.tmp
25 grep -q clock_rtc= /etc/conf/clock.tmp || \
26 echo clock_rtc=$clock_rtc >> /etc/conf/clock.tmp
27 mv /etc/conf/clock.tmp /etc/conf/clock
28 else
29 echo -e "clock_tz=$clock_tz\nclock_rtc=$clock_rtc\n" \
30 > /etc/conf/clock
32 if [ -w /proc/sys/dev/rtc/max-user-freq -a "$clock_rtc" ] ; then
33 echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq
37 set_zone() {
38 clock_tz=$1
39 hwclock --hctosys --$clock_tz
40 store_clock
43 set_rtc() {
44 gui_input "Set new enhanced real time clock precision" \
45 "$clock_rtc" "clock_rtc"
46 store_clock
49 main() {
50 while
51 clock_tz=utc
52 clock_rtc="`cat /proc/sys/dev/rtc/max-user-freq 2> /dev/null`"
53 if [ -f /etc/conf/clock ]; then
54 . /etc/conf/clock
57 cmd="gui_menu hw 'Kernel Drivers and Hardware Configuration'"
59 if [ "$clock_tz" = localtime ] ; then
60 cmd="$cmd '[*] Use localtime instead of utc' 'set_zone utc'"
61 else
62 cmd="$cmd '[ ] Use localtime instead of utc' 'set_zone localtime'"
63 clock_tz=utc
65 cmd="$cmd 'Set enhanced real time clock precision ($clock_rtc)' set_rtc"
67 eval "$cmd"
68 do : ; done
70 return