lib/dev-lxc.rb in dev-lxc-1.2.2 vs lib/dev-lxc.rb in dev-lxc-1.3.0

- old
+ new

@@ -40,21 +40,38 @@ if File.exist?("#{platform_image.config_item('lxc.rootfs')}/etc/sysctl.d/10-console-messages.conf") FileUtils.mv("#{platform_image.config_item('lxc.rootfs')}/etc/sysctl.d/10-console-messages.conf", "#{platform_image.config_item('lxc.rootfs')}/etc/sysctl.d/10-console-messages.conf.orig") end platform_image.run_command("apt-get update") - platform_image.run_command("apt-get install -y standard^ server^ vim-nox emacs23-nox curl tree") + platform_image.run_command("apt-get install -y standard^ server^ vim-nox emacs23-nox curl tree openssh-server") + IO.write("#{platform_image.config_item('lxc.rootfs')}/etc/rc.local", "/usr/sbin/dpkg-reconfigure openssh-server\n") + FileUtils.chmod(0755, "#{platform_image.config_item('lxc.rootfs')}/etc/rc.local") when "p-ubuntu-1204", "p-ubuntu-1404" platform_image.run_command("apt-get update") - platform_image.run_command("apt-get install -y standard^ server^ vim-nox emacs23-nox tree") + platform_image.run_command("apt-get install -y standard^ server^ vim-nox emacs23-nox tree openssh-server") + IO.write("#{platform_image.config_item('lxc.rootfs')}/etc/rc.local", "/usr/sbin/dpkg-reconfigure openssh-server\n") + FileUtils.chmod(0755, "#{platform_image.config_item('lxc.rootfs')}/etc/rc.local") when "p-centos-5" # downgrade openssl temporarily to overcome an install bug # reference: http://www.hack.net.br/blog/2014/02/12/openssl-conflicts-with-file-from-package-openssl/ platform_image.run_command("yum downgrade -y openssl") - platform_image.run_command("yum install -y @base @core vim-enhanced emacs-nox tree") + platform_image.run_command("yum install -y @base @core vim-enhanced emacs-nox tree openssh-server") + FileUtils.mkdir_p("#{platform_image.config_item('lxc.rootfs')}/etc/sudoers.d") + FileUtils.chmod(0750, "#{platform_image.config_item('lxc.rootfs')}/etc/sudoers.d") + append_line_to_file("#{platform_image.config_item('lxc.rootfs')}/etc/sudoers", "\n#includedir /etc/sudoers.d\n") when "p-centos-6" - platform_image.run_command("yum install -y @base @core vim-enhanced emacs-nox tree") + platform_image.run_command("yum install -y @base @core vim-enhanced emacs-nox tree openssh-server") end + platform_image.run_command("useradd --create-home --shell /bin/bash --password $6$q3FDMpMZ$zfahCxEWHbzuEV98QPzhGZ7fLtGcLNZrbKK7OAYGXmJXZc07WbcxVnDwrMyX/cL6vSp4/IjlrVUZFBp7Orhyu1 dev-lxc") + + FileUtils.mkdir_p("#{platform_image.config_item('lxc.rootfs')}/home/dev-lxc/.ssh") + FileUtils.chmod(0700, "#{platform_image.config_item('lxc.rootfs')}/home/dev-lxc/.ssh") + FileUtils.touch("#{platform_image.config_item('lxc.rootfs')}/home/dev-lxc/.ssh/authorized_keys") + FileUtils.chmod(0600, "#{platform_image.config_item('lxc.rootfs')}/home/dev-lxc/.ssh/authorized_keys") + platform_image.run_command("chown -R dev-lxc:dev-lxc /home/dev-lxc/.ssh") + + IO.write("#{platform_image.config_item('lxc.rootfs')}/etc/sudoers.d/dev-lxc", "dev-lxc ALL=NOPASSWD:ALL\n") + FileUtils.chmod(0440, "#{platform_image.config_item('lxc.rootfs')}/etc/sudoers.d/dev-lxc") platform_image.stop return platform_image end def self.assign_ip_address(ipaddress, container_name, hwaddr)