README.md / samba.sh cleanup timezone setting and docs
This commit is contained in:
parent
db6583b997
commit
0fb22c1930
10
README.md
10
README.md
@ -52,17 +52,21 @@ OR set local storage:
|
||||
|
||||
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
|
||||
|
||||
### Start an instance and set the timezone:
|
||||
|
||||
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).
|
||||
|
||||
### Setting the Timezone
|
||||
|
||||
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
|
||||
|
||||
sudo docker run --name samba -p 139:139 -p 445:445 -d dperson/samba
|
||||
|
10
samba.sh
10
samba.sh
@ -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
|
||||
timezone() { local timezone="${1:-EST5EDT}"
|
||||
[[ -e /usr/share/zoneinfo/$timezone ]] || {
|
||||
echo "ERROR: invalid timezone specified" >&2
|
||||
echo "ERROR: invalid timezone specified: $timezone" >&2
|
||||
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
|
||||
@ -120,7 +124,7 @@ while getopts ":hi:t:u:s:" opt; do
|
||||
done
|
||||
shift $(( OPTIND - 1 ))
|
||||
|
||||
[[ "${TIMEZONE:-""}" ]] && timezone "$TIMEZONE"
|
||||
[[ "${TZ:-""}" ]] && timezone "$TZ"
|
||||
|
||||
if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then
|
||||
exec "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user