Skip to content

Commit 548acc3

Browse files
committed
do not detect TZ on Mac OS X yet (issue #3)
1 parent 0f6a100 commit 548acc3

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

run-mtgo

+14-8
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ eval set -- $args
4444
do_run=true
4545

4646
mytz=${TZ:-}
47+
detect_tz=false
4748
if [ -z "${mytz}" ]; then
48-
if [ -f /etc/timezone ]; then
49-
mytz=$(</etc/timezone)
50-
else
51-
_tz="$(timedatectl | grep "Time zone"|cut -d: -f2|cut -d' ' -f 2)"
52-
if [ -n ${_tz} ] && [[ "${_tz}" != "n/a" ]]; then
53-
mytz=$_tz
54-
fi
55-
fi
49+
detect_tz=true
5650
fi
5751

5852
while [ -n "${1:-}" ]; do
@@ -73,6 +67,7 @@ case "${1:-}" in
7367
cmd="$1"
7468
opts="${opts} -it" ;;
7569
--no-tz)
70+
detect_tz=false
7671
mytz="" ;;
7772
--name) shift;
7873
name="$1" ;;
@@ -93,6 +88,17 @@ run() {
9388
fi
9489
}
9590

91+
if $detect_tz; then
92+
if [ -f /etc/timezonex ]; then
93+
mytz=$(</etc/timezone)
94+
elif [[ $OSTYPE == linux-gnu ]]; then
95+
_tz="$(timedatectl 2>/dev/null|grep "Time zone"|cut -d: -f2|cut -d' ' -f 2)"
96+
if [ -n ${_tz} ] && [[ "${_tz}" != "n/a" ]]; then
97+
mytz=$_tz
98+
fi
99+
fi
100+
fi
101+
96102
if [ -z "${data:-}" ]; then
97103
data="mtgo-data"
98104
docker volume inspect $data >/dev/null 2>&1

0 commit comments

Comments
 (0)