From 039a47bd5b85d4860ddc482c67065f5187876056 Mon Sep 17 00:00:00 2001 From: Leo Simons Date: Mon, 21 Jul 2014 10:36:11 +0200 Subject: [PATCH] CLOUDSTACK-7143: merge systemvm templates, step 1: remove differences --- .../systemvm64template/definition.rb | 111 ++++++++++-------- .../systemvm64template/postinstall.sh | 25 ++-- .../systemvm64template/preseed.cfg | 4 +- .../systemvmtemplate/definition.rb | 111 ++++++++++-------- .../systemvmtemplate/postinstall.sh | 22 +++- .../definitions/systemvmtemplate/preseed.cfg | 5 +- 6 files changed, 168 insertions(+), 110 deletions(-) diff --git a/tools/appliance/definitions/systemvm64template/definition.rb b/tools/appliance/definitions/systemvm64template/definition.rb index d1aeb28972e..594b7a8b47c 100644 --- a/tools/appliance/definitions/systemvm64template/definition.rb +++ b/tools/appliance/definitions/systemvm64template/definition.rb @@ -1,3 +1,5 @@ +arch = ENV['VM_ARCH'] || 'amd64' + # # NOTE: Before changing the version of the debian image make # sure it is added to the userContent of jenkins.buildacloud.org @@ -5,50 +7,65 @@ # This will prevent the inevitable build failure once the iso is # removed from the debian mirrors # -Veewee::Definition.declare({ - :cpu_count => '1', - :memory_size=> '256', - :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off', - :os_type_id => 'Debian_64', - :iso_file => "debian-7.6.0-amd64-netinst.iso", - :iso_src => "http://cdimage.debian.org/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-netinst.iso", - :iso_md5 => "8a3c2ad7fd7a9c4c7e9bcb5cae38c135", - :iso_download_timeout => "1000", - :boot_wait => "10", :boot_cmd_sequence => [ - '', - 'install ', - 'preseed/url=http://%IP%:%PORT%/preseed.cfg ', - 'debian-installer=en_US ', - 'auto ', - 'locale=en_US ', - 'kbd-chooser/method=us ', - 'netcfg/get_hostname=systemvm ', - 'netcfg/get_domain=apache.org ', - 'fb=false ', - 'debconf/frontend=noninteractive ', - 'console-setup/ask_detect=false ', - 'console-keymaps-at/keymap=us ', - 'keyboard-configuration/xkb-keymap=us ', - '' - ], - :kickstart_port => "7122", - :kickstart_timeout => "10000", - :kickstart_file => "preseed.cfg", - :ssh_login_timeout => "10000", - :ssh_user => "root", - :ssh_password => "password", - :ssh_key => "", - :ssh_host_port => "7222", - :ssh_guest_port => "22", - :sudo_cmd => "echo '%p'|sudo -S sh '%f'", - :shutdown_cmd => "halt -p", - :postinstall_files => [ - "apt_upgrade.sh", - "configure_grub.sh", - "postinstall.sh", - "cleanup.sh", - "configure_networking.sh", - "zerodisk.sh" - ], - :postinstall_timeout => "10000" -}) +architectures = { + :i386 => { + :os_type_id => 'Debian', + :iso_file => "debian-7.6.0-i386-netinst.iso", + :iso_src => "http://cdimage.debian.org/debian-cd/7.6.0/i386/iso-cd/debian-7.6.0-i386-netinst.iso", + :iso_md5 => "528e1a7315da1bbf50bd4d187880a519", + }, + :amd64 => { + :os_type_id => 'Debian_64', + :iso_file => 'debian-7.6.0-amd64-netinst.iso', + :iso_src => 'http://cdimage.debian.org/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-netinst.iso', + :iso_md5 => '8a3c2ad7fd7a9c4c7e9bcb5cae38c135' + } +} + +config = { + :cpu_count => '1', + :memory_size=> '256', + :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off', + :iso_download_timeout => "1000", + :boot_wait => "10", :boot_cmd_sequence => [ + '', + 'install ', + 'preseed/url=http://%IP%:%PORT%/preseed.cfg ', + 'debian-installer=en_US ', + 'auto ', + 'locale=en_US ', + 'kbd-chooser/method=us ', + 'netcfg/get_hostname=systemvm ', + 'netcfg/get_domain=apache.org ', + 'fb=false ', + 'debconf/frontend=noninteractive ', + 'console-setup/ask_detect=false ', + 'console-keymaps-at/keymap=us ', + 'keyboard-configuration/xkb-keymap=us ', + '' + ], + :kickstart_port => "7122", + :kickstart_timeout => "10000", + :kickstart_file => "preseed.cfg", + :ssh_login_timeout => "10000", + :ssh_user => "root", + :ssh_password => "password", + :ssh_key => "", + :ssh_host_port => "7222", + :ssh_guest_port => "22", + :sudo_cmd => "echo '%p'|sudo -S sh '%f'", + :shutdown_cmd => "halt -p", + :postinstall_files => [ + "apt_upgrade.sh", + "configure_grub.sh", + "postinstall.sh", + "cleanup.sh", + "configure_networking.sh", + "zerodisk.sh" + ], + :postinstall_timeout => "10000" +} + +config.merge! architectures[arch.to_sym] + +Veewee::Definition.declare(config) diff --git a/tools/appliance/definitions/systemvm64template/postinstall.sh b/tools/appliance/definitions/systemvm64template/postinstall.sh index 32e59d91b88..d246bbdb2b4 100644 --- a/tools/appliance/definitions/systemvm64template/postinstall.sh +++ b/tools/appliance/definitions/systemvm64template/postinstall.sh @@ -30,6 +30,7 @@ add_backports () { install_packages() { DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical + local arch=`dpkg --print-architecture` # Basic packages apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables @@ -76,11 +77,13 @@ install_packages() { apt-get --no-install-recommends -q -y --force-yes install iptables-persistent # Hyperv kvp daemon - 64bit only - # Download the hv kvp daemon - wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb - dpkg -i hv-kvp-daemon_3.1_amd64.deb + if [ "${arch}" == "amd64" ]; then + # Download the hv kvp daemon + wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb + dpkg -i hv-kvp-daemon_3.1_amd64.deb + fi - #libraries required for rdp client (Hyper-V) + #libraries required for rdp client (Hyper-V) apt-get --no-install-recommends -q -y --force-yes install libtcnative-1 libssl-dev libapr1-dev # vmware tools @@ -102,9 +105,11 @@ install_packages() { apt-get --no-install-recommends -q -y --force-yes install haproxy #32 bit architecture support:: not required for 32 bit template - dpkg --add-architecture i386 - apt-get update - apt-get --no-install-recommends -q -y --force-yes install links:i386 libuuid1:i386 + if [ "${arch}" != "i386" ]; then + dpkg --add-architecture i386 + apt-get update + apt-get --no-install-recommends -q -y --force-yes install links:i386 libuuid1:i386 + fi apt-get --no-install-recommends -q -y --force-yes install radvd } @@ -226,6 +231,7 @@ configure_apache2() { } configure_services() { + local arch=`dpkg --print-architecture` mkdir -p /var/www/html mkdir -p /opt/cloud/bin mkdir -p /var/cache/cloud @@ -258,7 +264,10 @@ configure_services() { chkconfig --add cloud chkconfig cloud off chkconfig xl2tpd off - chkconfig hv_kvp_daemon off + # Hyperv kvp daemon - 64bit only + if [ "${arch}" == "amd64" ]; then + chkconfig hv_kvp_daemon off + fi chkconfig radvd off } diff --git a/tools/appliance/definitions/systemvm64template/preseed.cfg b/tools/appliance/definitions/systemvm64template/preseed.cfg index d11b625e44d..6a10e777de9 100644 --- a/tools/appliance/definitions/systemvm64template/preseed.cfg +++ b/tools/appliance/definitions/systemvm64template/preseed.cfg @@ -334,11 +334,9 @@ d-i finish-install/reboot_in_progress note # debconf-get-selections --installer > file # debconf-get-selections >> file -libssl1.0.0 libssl1.0.0/restart-services string -libssl1.0.0:amd64 libssl1.0.0/restart-services string +libssl1.0.0 libssl1.0.0/restart-services string libssl1.0.0 libssl1.0.0/restart-failed error -libssl1.0.0:amd64 libssl1.0.0/restart-failed error #### Advanced options ### Running custom commands during the installation diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb index 21210f06ec8..c57bf237b33 100644 --- a/tools/appliance/definitions/systemvmtemplate/definition.rb +++ b/tools/appliance/definitions/systemvmtemplate/definition.rb @@ -1,3 +1,5 @@ +arch = ENV['VM_ARCH'] || 'i386' + # # NOTE: Before changing the version of the debian image make # sure it is added to the userContent of jenkins.buildacloud.org @@ -5,50 +7,65 @@ # This will prevent the inevitable build failure once the iso is # removed from the debian mirrors # -Veewee::Definition.declare({ - :cpu_count => '1', - :memory_size=> '256', - :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off', - :os_type_id => 'Debian', - :iso_file => "debian-7.6.0-i386-netinst.iso", - :iso_src => "http://cdimage.debian.org/debian-cd/7.6.0/i386/iso-cd/debian-7.6.0-i386-netinst.iso", - :iso_md5 => "528e1a7315da1bbf50bd4d187880a519", - :iso_download_timeout => "1000", - :boot_wait => "10", :boot_cmd_sequence => [ - '', - 'install ', - 'preseed/url=http://%IP%:%PORT%/preseed.cfg ', - 'debian-installer=en_US ', - 'auto ', - 'locale=en_US ', - 'kbd-chooser/method=us ', - 'netcfg/get_hostname=systemvm ', - 'netcfg/get_domain=apache.org ', - 'fb=false ', - 'debconf/frontend=noninteractive ', - 'console-setup/ask_detect=false ', - 'console-keymaps-at/keymap=us ', - 'keyboard-configuration/xkb-keymap=us ', - '' - ], - :kickstart_port => "7122", - :kickstart_timeout => "10000", - :kickstart_file => "preseed.cfg", - :ssh_login_timeout => "10000", - :ssh_user => "root", - :ssh_password => "password", - :ssh_key => "", - :ssh_host_port => "7222", - :ssh_guest_port => "22", - :sudo_cmd => "echo '%p'|sudo -S sh '%f'", - :shutdown_cmd => "halt -p", - :postinstall_files => [ - "apt_upgrade.sh", - "configure_grub.sh", - "postinstall.sh", - "cleanup.sh", - "configure_networking.sh", - "zerodisk.sh" - ], - :postinstall_timeout => "10000" -}) +architectures = { + :i386 => { + :os_type_id => 'Debian', + :iso_file => "debian-7.6.0-i386-netinst.iso", + :iso_src => "http://cdimage.debian.org/debian-cd/7.6.0/i386/iso-cd/debian-7.6.0-i386-netinst.iso", + :iso_md5 => "528e1a7315da1bbf50bd4d187880a519", + }, + :amd64 => { + :os_type_id => 'Debian_64', + :iso_file => 'debian-7.6.0-amd64-netinst.iso', + :iso_src => 'http://cdimage.debian.org/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-netinst.iso', + :iso_md5 => '8a3c2ad7fd7a9c4c7e9bcb5cae38c135' + } +} + +config = { + :cpu_count => '1', + :memory_size=> '256', + :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off', + :iso_download_timeout => "1000", + :boot_wait => "10", :boot_cmd_sequence => [ + '', + 'install ', + 'preseed/url=http://%IP%:%PORT%/preseed.cfg ', + 'debian-installer=en_US ', + 'auto ', + 'locale=en_US ', + 'kbd-chooser/method=us ', + 'netcfg/get_hostname=systemvm ', + 'netcfg/get_domain=apache.org ', + 'fb=false ', + 'debconf/frontend=noninteractive ', + 'console-setup/ask_detect=false ', + 'console-keymaps-at/keymap=us ', + 'keyboard-configuration/xkb-keymap=us ', + '' + ], + :kickstart_port => "7122", + :kickstart_timeout => "10000", + :kickstart_file => "preseed.cfg", + :ssh_login_timeout => "10000", + :ssh_user => "root", + :ssh_password => "password", + :ssh_key => "", + :ssh_host_port => "7222", + :ssh_guest_port => "22", + :sudo_cmd => "echo '%p'|sudo -S sh '%f'", + :shutdown_cmd => "halt -p", + :postinstall_files => [ + "apt_upgrade.sh", + "configure_grub.sh", + "postinstall.sh", + "cleanup.sh", + "configure_networking.sh", + "zerodisk.sh" + ], + :postinstall_timeout => "10000" +} + +config.merge! architectures[arch.to_sym] + +Veewee::Definition.declare(config) diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh index a292203c7fc..e00d259ec8a 100644 --- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh +++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh @@ -30,6 +30,7 @@ add_backports () { install_packages() { DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical + local arch=`dpkg --print-architecture` # Basic packages apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables @@ -75,7 +76,14 @@ install_packages() { echo "iptables-persistent iptables-persistent/autosave_v6 boolean true" | debconf-set-selections apt-get --no-install-recommends -q -y --force-yes install iptables-persistent - #libraries required for rdp client (Hyper-V) + # Hyperv kvp daemon - 64bit only + if [ "${arch}" == "amd64" ]; then + # Download the hv kvp daemon + wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb + dpkg -i hv-kvp-daemon_3.1_amd64.deb + fi + + #libraries required for rdp client (Hyper-V) apt-get --no-install-recommends -q -y --force-yes install libtcnative-1 libssl-dev libapr1-dev # vmware tools @@ -96,6 +104,13 @@ install_packages() { apt-get --no-install-recommends -q -y --force-yes install haproxy + #32 bit architecture support:: not required for 32 bit template + if [ "${arch}" != "i386" ]; then + dpkg --add-architecture i386 + apt-get update + apt-get --no-install-recommends -q -y --force-yes install links:i386 libuuid1:i386 + fi + apt-get --no-install-recommends -q -y --force-yes install radvd } @@ -216,6 +231,7 @@ configure_apache2() { } configure_services() { + local arch=`dpkg --print-architecture` mkdir -p /var/www/html mkdir -p /opt/cloud/bin mkdir -p /var/cache/cloud @@ -248,6 +264,10 @@ configure_services() { chkconfig --add cloud chkconfig cloud off chkconfig xl2tpd off + # Hyperv kvp daemon - 64bit only + if [ "${arch}" == "amd64" ]; then + chkconfig hv_kvp_daemon off + fi chkconfig radvd off } diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg index 1e4fb4ef8c4..6a10e777de9 100644 --- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg +++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg @@ -334,12 +334,9 @@ d-i finish-install/reboot_in_progress note # debconf-get-selections --installer > file # debconf-get-selections >> file - -libssl1.0.0 libssl1.0.0/restart-services string -libssl1.0.0:i386 libssl1.0.0/restart-services string +libssl1.0.0 libssl1.0.0/restart-services string libssl1.0.0 libssl1.0.0/restart-failed error -libssl1.0.0:i386 libssl1.0.0/restart-failed error #### Advanced options ### Running custom commands during the installation