README.md / samba.sh cleanup timezone setting and docs

This commit is contained in:
David Personette 2015-08-15 17:10:17 -04:00
parent db6583b997
commit 0fb22c1930
2 changed files with 14 additions and 6 deletions

View File

@ -52,17 +52,21 @@ OR set local storage:
ENVIROMENT VARIABLES (only available with `docker run`) ENVIROMENT VARIABLES (only available with `docker run`)
* `TIMEZONE` - As above, set a zoneinfo timezone, IE `EST5EDT` * `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT`
## Examples ## Examples
### Start an instance and set the timezone:
Any of the commands can be run at creation with `docker run` or later with Any of the commands can be run at creation with `docker run` or later with
`docker exec samba.sh` (as of version 1.3 of docker). `docker exec samba.sh` (as of version 1.3 of docker).
### Setting the Timezone
sudo docker run -p 139:139 -p 445:445 -d dperson/samba -t EST5EDT sudo docker run -p 139:139 -p 445:445 -d dperson/samba -t EST5EDT
OR using `environment variables`
sudo docker run -e TZ=EST5EDT -p 139:139 -p 445:445 -d dperson/samba
Will get you the same settings as Will get you the same settings as
sudo docker run --name samba -p 139:139 -p 445:445 -d dperson/samba sudo docker run --name samba -p 139:139 -p 445:445 -d dperson/samba

View File

@ -57,11 +57,15 @@ share() { local share="$1" path="$2" browse=${3:-yes} ro=${4:-yes}\
# Return: the correct zoneinfo file will be symlinked into place # Return: the correct zoneinfo file will be symlinked into place
timezone() { local timezone="${1:-EST5EDT}" timezone() { local timezone="${1:-EST5EDT}"
[[ -e /usr/share/zoneinfo/$timezone ]] || { [[ -e /usr/share/zoneinfo/$timezone ]] || {
echo "ERROR: invalid timezone specified" >&2 echo "ERROR: invalid timezone specified: $timezone" >&2
return return
} }
ln -sf /usr/share/zoneinfo/$timezone /etc/localtime if [[ $(cat /etc/timezone) != $timezone ]]; then
echo "$timezone" > /etc/timezone
ln -sf /usr/share/zoneinfo/$timezone /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
fi
} }
### user: add a user ### user: add a user
@ -120,7 +124,7 @@ while getopts ":hi:t:u:s:" opt; do
done done
shift $(( OPTIND - 1 )) shift $(( OPTIND - 1 ))
[[ "${TIMEZONE:-""}" ]] && timezone "$TIMEZONE" [[ "${TZ:-""}" ]] && timezone "$TZ"
if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then
exec "$@" exec "$@"