Created
June 1, 2014 09:25
-
-
Save zsim0n/ba1a25e87e81e9eb04a5 to your computer and use it in GitHub Desktop.
Provision timezone in vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.vm.provision :shell, :inline => "echo \"Europe/Copenhagen\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: http://www.jaimegago.com/dynamic-guestrhel6-and-cousinshostos-x-time-zone-sync-in-vagrant-virtualbox-provider/ | |
$script = <<SCRIPT | |
CurrentTimeZone=$(cat /etc/sysconfig/clock |cut -d'=' -f'2') | |
if [ ! $CurrentTimeZone == $1 ];then | |
cat << EOF > /etc/sysconfig/clock | |
ZONE=$1 | |
EOF | |
ln -sf /usr/share/zoneinfo/$1 /etc/localtime | |
fi | |
SCRIPT | |
Vagrant.configure("2") do |config| | |
config.vm.provision "shell", inline: $script | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment