From e2f1740de59032087c9761f0586655bcf5ffbb06 Mon Sep 17 00:00:00 2001 From: Leo Simons Date: Mon, 21 Jul 2014 09:55:37 +0200 Subject: [PATCH] CLOUDSTACK-7143: split base.sh into its two functions. --- .../systemvm64template/apt_upgrade.sh | 8 +++++ .../definitions/systemvm64template/base.sh | 29 ------------------- .../systemvm64template/configure_grub.sh | 13 +++++++++ .../systemvm64template/definition.rb | 3 +- .../systemvmtemplate/apt_upgrade.sh | 8 +++++ .../definitions/systemvmtemplate/base.sh | 29 ------------------- .../systemvmtemplate/configure_grub.sh | 13 +++++++++ .../systemvmtemplate/definition.rb | 3 +- 8 files changed, 46 insertions(+), 60 deletions(-) create mode 100644 tools/appliance/definitions/systemvm64template/apt_upgrade.sh delete mode 100644 tools/appliance/definitions/systemvm64template/base.sh create mode 100644 tools/appliance/definitions/systemvm64template/configure_grub.sh create mode 100644 tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh delete mode 100644 tools/appliance/definitions/systemvmtemplate/base.sh create mode 100644 tools/appliance/definitions/systemvmtemplate/configure_grub.sh diff --git a/tools/appliance/definitions/systemvm64template/apt_upgrade.sh b/tools/appliance/definitions/systemvm64template/apt_upgrade.sh new file mode 100644 index 00000000000..69acc1a9c6b --- /dev/null +++ b/tools/appliance/definitions/systemvm64template/apt_upgrade.sh @@ -0,0 +1,8 @@ +# Update the box + +export DEBIAN_FRONTEND=noninteractive +export DEBIAN_PRIORITY=critical + +apt-get -q -y --force-yes update +apt-get -q -y --force-yes install curl unzip +apt-get clean diff --git a/tools/appliance/definitions/systemvm64template/base.sh b/tools/appliance/definitions/systemvm64template/base.sh deleted file mode 100644 index 8166081cdce..00000000000 --- a/tools/appliance/definitions/systemvm64template/base.sh +++ /dev/null @@ -1,29 +0,0 @@ -# Update the box - -export DEBIAN_FRONTEND=noninteractive -export DEBIAN_PRIORITY=critical - -apt-get -q -y --force-yes update -apt-get -q -y --force-yes install curl unzip -apt-get clean - -# Set up sudo, TODO: Check security concerns -echo 'vagrant ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/vagrant -echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/cloud - -# Tweak sshd to prevent DNS resolution (speed up logins) -echo 'UseDNS no' >> /etc/ssh/sshd_config - -# Remove 5s grub timeout to speed up booting -cat < /etc/default/grub -# If you change this file, run 'update-grub' afterwards to update -# /boot/grub/grub.cfg. - -GRUB_DEFAULT=0 -GRUB_TIMEOUT=0 -GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` -GRUB_CMDLINE_LINUX_DEFAULT="quiet" -GRUB_CMDLINE_LINUX="debian-installer=en_US" -EOF - -update-grub diff --git a/tools/appliance/definitions/systemvm64template/configure_grub.sh b/tools/appliance/definitions/systemvm64template/configure_grub.sh new file mode 100644 index 00000000000..d530bb93bf9 --- /dev/null +++ b/tools/appliance/definitions/systemvm64template/configure_grub.sh @@ -0,0 +1,13 @@ +# Remove 5s grub timeout to speed up booting +cat < /etc/default/grub +# If you change this file, run 'update-grub' afterwards to update +# /boot/grub/grub.cfg. + +GRUB_DEFAULT=0 +GRUB_TIMEOUT=0 +GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` +GRUB_CMDLINE_LINUX_DEFAULT="quiet" +GRUB_CMDLINE_LINUX="debian-installer=en_US" +EOF + +update-grub diff --git a/tools/appliance/definitions/systemvm64template/definition.rb b/tools/appliance/definitions/systemvm64template/definition.rb index 2aaac04fdd2..de776f38bfb 100644 --- a/tools/appliance/definitions/systemvm64template/definition.rb +++ b/tools/appliance/definitions/systemvm64template/definition.rb @@ -43,7 +43,8 @@ Veewee::Definition.declare({ :sudo_cmd => "echo '%p'|sudo -S sh '%f'", :shutdown_cmd => "halt -p", :postinstall_files => [ - "base.sh", + "apt_upgrade.sh", + "configure_grub.sh", "postinstall.sh", "cleanup.sh", "zerodisk.sh" diff --git a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh new file mode 100644 index 00000000000..69acc1a9c6b --- /dev/null +++ b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh @@ -0,0 +1,8 @@ +# Update the box + +export DEBIAN_FRONTEND=noninteractive +export DEBIAN_PRIORITY=critical + +apt-get -q -y --force-yes update +apt-get -q -y --force-yes install curl unzip +apt-get clean diff --git a/tools/appliance/definitions/systemvmtemplate/base.sh b/tools/appliance/definitions/systemvmtemplate/base.sh deleted file mode 100644 index 8166081cdce..00000000000 --- a/tools/appliance/definitions/systemvmtemplate/base.sh +++ /dev/null @@ -1,29 +0,0 @@ -# Update the box - -export DEBIAN_FRONTEND=noninteractive -export DEBIAN_PRIORITY=critical - -apt-get -q -y --force-yes update -apt-get -q -y --force-yes install curl unzip -apt-get clean - -# Set up sudo, TODO: Check security concerns -echo 'vagrant ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/vagrant -echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/cloud - -# Tweak sshd to prevent DNS resolution (speed up logins) -echo 'UseDNS no' >> /etc/ssh/sshd_config - -# Remove 5s grub timeout to speed up booting -cat < /etc/default/grub -# If you change this file, run 'update-grub' afterwards to update -# /boot/grub/grub.cfg. - -GRUB_DEFAULT=0 -GRUB_TIMEOUT=0 -GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` -GRUB_CMDLINE_LINUX_DEFAULT="quiet" -GRUB_CMDLINE_LINUX="debian-installer=en_US" -EOF - -update-grub diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh new file mode 100644 index 00000000000..d530bb93bf9 --- /dev/null +++ b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh @@ -0,0 +1,13 @@ +# Remove 5s grub timeout to speed up booting +cat < /etc/default/grub +# If you change this file, run 'update-grub' afterwards to update +# /boot/grub/grub.cfg. + +GRUB_DEFAULT=0 +GRUB_TIMEOUT=0 +GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` +GRUB_CMDLINE_LINUX_DEFAULT="quiet" +GRUB_CMDLINE_LINUX="debian-installer=en_US" +EOF + +update-grub diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb index 6173f419a70..d2e25df2d53 100644 --- a/tools/appliance/definitions/systemvmtemplate/definition.rb +++ b/tools/appliance/definitions/systemvmtemplate/definition.rb @@ -43,7 +43,8 @@ Veewee::Definition.declare({ :sudo_cmd => "echo '%p'|sudo -S sh '%f'", :shutdown_cmd => "halt -p", :postinstall_files => [ - "base.sh", + "apt_upgrade.sh", + "configure_grub.sh", "postinstall.sh", "cleanup.sh", "zerodisk.sh"