Skip to content

Commit

Permalink
do not detect TZ on Mac OS X yet (issue #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauleve committed Sep 8, 2017
1 parent 0f6a100 commit 548acc3
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions run-mtgo
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,9 @@ eval set -- $args
do_run=true

mytz=${TZ:-}
detect_tz=false
if [ -z "${mytz}" ]; then
if [ -f /etc/timezone ]; then
mytz=$(</etc/timezone)
else
_tz="$(timedatectl | grep "Time zone"|cut -d: -f2|cut -d' ' -f 2)"
if [ -n ${_tz} ] && [[ "${_tz}" != "n/a" ]]; then
mytz=$_tz
fi
fi
detect_tz=true
fi

while [ -n "${1:-}" ]; do
Expand All @@ -73,6 +67,7 @@ case "${1:-}" in
cmd="$1"
opts="${opts} -it" ;;
--no-tz)
detect_tz=false
mytz="" ;;
--name) shift;
name="$1" ;;
Expand All @@ -93,6 +88,17 @@ run() {
fi
}

if $detect_tz; then
if [ -f /etc/timezonex ]; then
mytz=$(</etc/timezone)
elif [[ $OSTYPE == linux-gnu ]]; then
_tz="$(timedatectl 2>/dev/null|grep "Time zone"|cut -d: -f2|cut -d' ' -f 2)"
if [ -n ${_tz} ] && [[ "${_tz}" != "n/a" ]]; then
mytz=$_tz
fi
fi
fi

if [ -z "${data:-}" ]; then
data="mtgo-data"
docker volume inspect $data >/dev/null 2>&1
Expand Down

0 comments on commit 548acc3

Please sign in to comment.