Merge pull request #545 from 4nd3r/__timezone
__timezone: check current timezone before doing anything
This commit is contained in:
commit
6b9ec1d3ce
2 changed files with 28 additions and 2 deletions
21
cdist/conf/type/__timezone/explorer/timezone_is
Executable file
21
cdist/conf/type/__timezone/explorer/timezone_is
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
#
|
||||||
|
# 2017 Ander Punnar (cdist at kvlt.ee)
|
||||||
|
#
|
||||||
|
# This file is part of cdist.
|
||||||
|
#
|
||||||
|
# cdist is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# cdist is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
[ -f /etc/timezone ] && cat /etc/timezone
|
|
@ -20,11 +20,16 @@
|
||||||
#
|
#
|
||||||
# This type allows to configure the desired localtime timezone.
|
# This type allows to configure the desired localtime timezone.
|
||||||
|
|
||||||
timezone="$__object_id"
|
timezone_is=$(cat "$__object/explorer/timezone_is")
|
||||||
|
timezone_should="$__object_id"
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
|
if [ "$timezone_is" = "$timezone_should" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
ubuntu|debian|devuan)
|
ubuntu|debian|devuan)
|
||||||
echo "echo \"$timezone\" > /etc/timezone"
|
echo "echo \"$timezone_should\" > /etc/timezone"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue