diff --git a/bin/build_image.sh b/bin/build_image.sh index 0b479d3d..a2ace1a1 100755 --- a/bin/build_image.sh +++ b/bin/build_image.sh @@ -46,7 +46,7 @@ if [ -e chef/${TEMPLATE_NAME}/Berksfile ] ; then rm -rf $BERKSHELF_PATH chef/${TEMPLATE_NAME}/cookbooks chef/${TEMPLATE_NAME}/Berksfile.lock berks vendor --delete -b chef/${TEMPLATE_NAME}/Berksfile chef/${TEMPLATE_NAME}/cookbooks fi -packer build -color=false -force $(basename $TEMPLATE) +packer build -on-error=abort -color=false -force $(basename $TEMPLATE) qemu-img convert -O qcow2 -c ${DIR_NAME}/${IMAGE_NAME} $FINAL_QCOW_FILE_NAME qemu-img convert -O raw ${DIR_NAME}/${IMAGE_NAME} $FINAL_RAW_FILE_NAME diff --git a/http/opensuse-leap-15.0/autoinst.xml b/http/opensuse-leap-15.0/autoinst.xml new file mode 100644 index 00000000..9f6c5980 --- /dev/null +++ b/http/opensuse-leap-15.0/autoinst.xml @@ -0,0 +1,216 @@ + + + + + + + + + false + true + false + + + + + false + 10 + true + + + false + 10 + true + + + false + 10 + true + + + + + english-us + + + en_US + en_US + + + UTC + Etc/UTC + + + + true + + + true + false + false + false + device + 65 + 1 + false + 8225280 + + + true + false + ext4 + true + acl,user_xattr + false + / + uuid + 131 + 2 + false + max + + + + CT_DISK + all + + + + + + true + splash=silent quiet showopts + false + /dev/sda1 + false + false + false + false + auto + false + false + console + 0 + false + + grub2 + + + + false + true + + true + true + unassigned-domain + unassigned-hostname + + + + dhcp + eth0 + onboot + + + + + + false + false + + + + + + + autoyast2 + curl + e2fsprogs + glibc-locale + glibc + grub2 + iputils + kernel-default + kexec-tools + ntp + openssh + openSUSE-release + rsync + sudo + wget + yast2-firstboot + yast2 + yast2-trans-en_US + zypper + + + sw_management + yast2_install_wf + minimal_base + + + telnet + + + + multi-user + + + + sshd + + + + + + 100 + users + + + + + + 100 + + /home + -1 + true + /bin/bash + /etc/skel + 022 + + + + + opensuse + root + + + opensuse + 100 + /home/opensuse + + + + -1 + 99999 + 0 + 7 + + /bin/bash + 1000 + opensuse + opensuse + + + + false + + + + + + + diff --git a/opensuse-leap-15.0-ppc64le-openstack.json b/opensuse-leap-15.0-ppc64le-openstack.json new file mode 100644 index 00000000..ce5c8b95 --- /dev/null +++ b/opensuse-leap-15.0-ppc64le-openstack.json @@ -0,0 +1,57 @@ +{ + "builders": [ + { + "boot_command": [ + "c", + "linux /boot/ppc64le/linux netsetup=dhcp install=cd:/ ", + "lang=en_US autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/opensuse-leap-15.0/autoinst.xml ", + "install=http://download.opensuse.org/ports/ppc/distribution/leap/15.0/repo/oss/ ", + "textmode=1 ", + "initrd /boot/ppc64le/initrd ", + "boot " + ], + "boot_wait": "6s", + "disk_size": "3072", + "disk_interface": "virtio-scsi", + "headless": true, + "vnc_bind_address":"0.0.0.0", + "http_directory": "http", + "iso_checksum": "e5af64c33b8d2ba4e7a266653459a74e12bd0f0f7a87c10e71a885d9446e8e9e", + "iso_checksum_type": "sha256", + "iso_url": "{{user `mirror`}}/ports/ppc/distribution/leap/15.0/iso/openSUSE-Leap-15.0-DVD-ppc64le-Build69.2-Media.iso", + "output_directory": "packer-opensuse-leap-15.0-ppc64le-openstack", + "shutdown_command": "echo 'opensuse'|sudo -S /sbin/halt -h -p", + "ssh_password": "opensuse", + "ssh_port": 22, + "ssh_username": "opensuse", + "ssh_wait_timeout": "10000s", + "qemuargs": [ + [ "-m", "2048M" ], + [ "-boot", "strict=on" ] + ], + "qemu_binary": "/usr/libexec/qemu-kvm", + "machine_type": "pseries", + "type": "qemu", + "vm_name": "packer-opensuse-leap-15.0-ppc64le-openstack" + } + ], + "provisioners": [ + { + "execute_command": "echo 'opensuse' | {{.Vars}} sudo -S -E sh '{{.Path}}'", + "scripts": [ + "scripts/common/sshd.sh", + "scripts/common/vmtools.sh", + "scripts/opensuse/sudoers.sh", + "scripts/opensuse/zypper-locks.sh", + "scripts/opensuse/remove-dvd-source.sh", + "scripts/opensuse/openstack.sh", + "scripts/common/minimize.sh" + ], + "type": "shell" + } + ], + "variables": { + "mirror": "http://download.opensuse.org", + "image_name": "OpenSUSE Leap 15.0 LE" + } +} diff --git a/scripts/opensuse/cleanup.sh b/scripts/opensuse/cleanup.sh new file mode 100644 index 00000000..e05f9d72 --- /dev/null +++ b/scripts/opensuse/cleanup.sh @@ -0,0 +1,11 @@ +#!/bin/bash -eux +# These were only needed for building VMware/Virtualbox extensions: + +zypper -n rm -u gcc make kernel-default-devel kernel-devel + +# Clean up network interface persistence +rm -f /etc/udev/rules.d/70-persistent-net.rules; +touch /etc/udev/rules.d/75-persistent-net-generator.rules; + +# delete any logs that have built up during the install +find /var/log/ -name *.log -exec rm -f {} \; diff --git a/scripts/opensuse/openstack.sh b/scripts/opensuse/openstack.sh index 86a4de9d..130580dc 100644 --- a/scripts/opensuse/openstack.sh +++ b/scripts/opensuse/openstack.sh @@ -1,7 +1,9 @@ #!/bin/bash -eux zypper -n up -zypper -n in cloud-init +zypper -n in vim less cloud-init +sed -i -e 's/^After=systemd-networkd-wait-online.service/After=systemd-networkd-wait-online.service\nAfter=wicked.service\nRequires=wicked.service/g' /usr/lib/systemd/system/cloud-init.service +systemctl enable cloud-config cloud-final cloud-init-local cloud-init # do some cleanup zypper -n rm rpcbind postfix Mesa* libX11-data libxcb1 @@ -11,12 +13,11 @@ if [ $(uname -m)=="ppc64" -o $(uname -m)=="ppc64le" ] ; then systemctl enable rtas_errd fi -systemctl enable cloud-init - # Create opensuse user sed -i -e ':a;N;$!ba;s/users:\n - root/users:\n - default/g' /etc/cloud/cloud.cfg # Disable root and password logins sed -i -e ':a;N;$!ba;s/disable_root: false\n/disable_root: 1\nssh_pwauth: 0\n/g' /etc/cloud/cloud.cfg +sed -i -e 's/distro: ubuntu/distro: opensuse/' /etc/cloud/cloud.cfg sed -i -e \ 's/GRUB_CMDLINE_LINUX=\"\(.*\)/GRUB_CMDLINE_LINUX=\"console=ttyS0,115200n8 console=tty0 \1/g' \ diff --git a/scripts/opensuse/remove-dvd-source.sh b/scripts/opensuse/remove-dvd-source.sh index af6f1c99..2ed2ad09 100644 --- a/scripts/opensuse/remove-dvd-source.sh +++ b/scripts/opensuse/remove-dvd-source.sh @@ -4,23 +4,9 @@ version=`grep VERSION= /etc/os-release | cut -f2 -d\" | cut -f1 -d\ ` zypper removerepo "openSUSE-${version}-0" -if [[ $version =~ "13" ]]; then - zypper ar http://download.opensuse.org/distribution/${version}/repo/oss/ openSUSE-${version}-Oss - zypper ar http://download.opensuse.org/distribution/${version}/repo/non-oss/ openSUSE-${version}-Non-Oss - zypper ar http://download.opensuse.org/update/${version}/ openSUSE-${version}-Update - zypper ar http://download.opensuse.org/update/${version}-non-oss/ openSUSE-${version}-Update-Non-Oss -fi - -if [[ $version =~ "4" ]]; then - if [ "$(uname -m)" == "ppc64le" ] ; then - zypper ar http://download.opensuse.org/ports/ppc/distribution/leap/${version}/repo/oss/ openSUSE-Leap-${version}-Oss - zypper ar http://download.opensuse.org/ports/update/leap/${version}/oss/ openSUSE-Leap-${version}-Update - else - zypper ar http://download.opensuse.org/distribution/leap/${version}/repo/oss/ openSUSE-Leap-${version}-Oss - zypper ar http://download.opensuse.org/distribution/leap/${version}/repo/non-oss/ openSUSE-Leap-${version}-Non-Oss - zypper ar http://download.opensuse.org/update/leap/${version}/oss/ openSUSE-Leap-${version}-Update - zypper ar http://download.opensuse.org/update/leap/${version}/non-oss/ openSUSE-Leap-${version}-Update-Non-Oss - fi -fi +zypper ar http://download.opensuse.org/distribution/leap/${version}/repo/oss/ openSUSE-Leap-${version}-Oss +zypper ar http://download.opensuse.org/distribution/leap/${version}/repo/non-oss/ openSUSE-Leap-${version}-Non-Oss +zypper ar http://download.opensuse.org/update/leap/${version}/oss/ openSUSE-Leap-${version}-Update +zypper ar http://download.opensuse.org/update/leap/${version}/non-oss/ openSUSE-Leap-${version}-Update-Non-Oss zypper refresh