File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,9 @@ eval set -- $args
44
44
do_run=true
45
45
46
46
mytz=${TZ:- }
47
+ detect_tz=false
47
48
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
56
50
fi
57
51
58
52
while [ -n " ${1:- } " ]; do
@@ -73,6 +67,7 @@ case "${1:-}" in
73
67
cmd=" $1 "
74
68
opts=" ${opts} -it" ;;
75
69
--no-tz)
70
+ detect_tz=false
76
71
mytz=" " ;;
77
72
--name) shift ;
78
73
name=" $1 " ;;
@@ -93,6 +88,17 @@ run() {
93
88
fi
94
89
}
95
90
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
+
96
102
if [ -z " ${data:- } " ]; then
97
103
data=" mtgo-data"
98
104
docker volume inspect $data > /dev/null 2>&1
You can’t perform that action at this time.
0 commit comments