aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-04-03 11:59:09 -0700
committerelijah <elijah@riseup.net>2014-04-03 11:59:09 -0700
commit9c30dcfc064bbf62f235282e621708a542e37cfb (patch)
tree817882f7737192a79b9ceb1a7f7b2f9c7700df2c
parent70d0e59223a25ba2e51b8be775d667bbc33f356e (diff)
downloadleap_cli-9c30dcfc064bbf62f235282e621708a542e37cfb.tar.gz
leap_cli-9c30dcfc064bbf62f235282e621708a542e37cfb.tar.bz2
update the server time on `leap node init` (hopefully closes https://leap.se/code/issues/5329)
-rw-r--r--lib/leap_cli/remote/tasks.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/leap_cli/remote/tasks.rb b/lib/leap_cli/remote/tasks.rb
index 21a6cc6..3c52162 100644
--- a/lib/leap_cli/remote/tasks.rb
+++ b/lib/leap_cli/remote/tasks.rb
@@ -31,14 +31,24 @@ task :install_insecure_vagrant_key, :max_hosts => MAX_HOSTS do
end
task :install_prerequisites, :max_hosts => MAX_HOSTS do
+ apt_get = "DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-confold"
leap.mkdirs LeapCli::PUPPET_DESTINATION
+ run "echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen"
leap.log :updating, "package list" do
run "apt-get update"
end
+ leap.log :updating, "server time" do
+ run 'test -f /etc/init.d/ntp && /etc/init.d/ntp stop'
+ run "test -f /usr/sbin/ntpdate || #{apt_get} install ntpdate"
+ leap.log :running, "ntpdate..." do
+ run "test -f /usr/sbin/ntpdate && ntpdate 0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org"
+ end
+ run 'test -f /etc/init.d/ntp && /etc/init.d/ntp start'
+ end
leap.log :installing, "required packages" do
- run "DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-confold install #{leap.required_packages}"
+ run "#{apt_get} install #{leap.required_packages}"
end
- run "echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen; locale-gen"
+ #run "locale-gen"
leap.mkdirs("/etc/leap", "/srv/leap")
leap.mark_initialized
end