Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/appliance/systemvmtemplate/http/preseed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
d-i apt-setup/local0/source boolean false
d-i apt-setup/multiarch string i386
d-i apt-setup/backports boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/multiverse boolean true
d-i apt-setup/universe boolean true

### Clock and time zone setup
d-i clock-setup/utc boolean true
Expand All @@ -56,13 +60,13 @@ d-i partman-auto/disk string /dev/vda
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
boot-root :: \
100 60 100 ext2 \
400 60 400 ext2 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
mountpoint{ /boot } \
. \
2240 40 2500 ext4 \
2240 40 4000 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
Expand Down
5 changes: 5 additions & 0 deletions tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ function apt_upgrade() {

rm -fv /root/*.iso
apt-get -q -y update

apt-get -q -y upgrade
apt-get -q -y dist-upgrade
apt-get -q -y upgrade -t buster-backports
apt-get -q -y dist-upgrade -t buster-backports

apt-get -y autoremove --purge
apt-get autoclean
apt-get clean
reboot
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd might 'reboot' be an issue in packer processing ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No see template.json


return 2>/dev/null || apt_upgrade
3 changes: 3 additions & 0 deletions tools/appliance/systemvmtemplate/scripts/configure_grub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ set -e
set -x

function configure_grub() {
# Remove the old/unused kernel
dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get remove -y --purge || true
apt-get -y autoremove --purge
echo "blacklist floppy" > /etc/modprobe.d/blacklist-floppy.conf
rmmod floppy || true
update-initramfs -u
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -x
function install_vhd_util() {
[[ -f /bin/vhd-util ]] && return

wget --no-check-certificate https://github.com/shapeblue/cloudstack-nonoss/raw/master/vhd-util -O /bin/vhd-util
wget --no-check-certificate https://github.com/shapeblue/cloudstack-nonoss/raw/main/vhd-util -O /bin/vhd-util
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jfyi @sureshanaparti - fixed this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted, thanks @rhtyd

chmod a+x /bin/vhd-util
}

Expand All @@ -42,7 +42,7 @@ function install_packages() {

debconf_packages

local apt_get="apt-get --no-install-recommends -q -y"
local apt_get="apt-get --no-install-recommends -q -y -t buster-backports"

${apt_get} install grub-legacy \
rsyslog logrotate cron net-tools ifupdown tmux vim-tiny htop netbase iptables nftables \
Expand Down Expand Up @@ -76,8 +76,6 @@ function install_packages() {
apt-get clean
apt-get autoclean

${apt_get} install links

#32 bit architecture support for vhd-util: not required for 32 bit template
if [ "${arch}" != "i386" ]; then
dpkg --add-architecture i386
Expand Down
11 changes: 9 additions & 2 deletions tools/appliance/systemvmtemplate/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"type": "shell",
"execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}",
"scripts": [
"scripts/apt_upgrade.sh",
"scripts/apt_upgrade.sh"
],
"expect_disconnect": true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weizhouapache this handles for reboot case. You can read more about it here https://www.packer.io/docs/provisioners/shell

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd good. thanks for the info.

},
{
"type": "shell",
"execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}",
"scripts": [
"scripts/configure_grub.sh",
"scripts/configure_locale.sh",
"scripts/configure_networking.sh",
Expand All @@ -33,7 +40,7 @@
[ "-smp", "1" ]
],
"format": "qcow2",
"disk_size": 2500,
"disk_size": 3000,
"disk_interface": "virtio",
"net_device": "virtio-net",
"iso_url": "https://cdimage.debian.org/debian-cd/10.9.0/amd64/iso-cd/debian-10.9.0-amd64-netinst.iso",
Expand Down