forked from omniosorg/kayak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request omniosorg#199 from citrus-it/azure
Add azure image build script
- Loading branch information
Showing
6 changed files
with
205 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
# | ||
# {{{ CDDL HEADER | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# }}} | ||
# | ||
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. | ||
# | ||
|
||
SRCDIR=`dirname $0` | ||
[ ${SRCDIR:0:1} = "/" ] || SRCDIR=`pwd`/$SRCDIR | ||
|
||
. $SRCDIR/../lib/hvm_help.sh | ||
|
||
[ -z "$BUILDSEND_MP" ] && BUILDSEND_MP=/kayak_image | ||
|
||
find_zfssend | ||
[ ! -f $ZFSSEND ] && echo "ZFS Image ($ZFSSEND) missing" && exit | ||
|
||
set -e | ||
|
||
customise() { | ||
typeset root="${1?altroot}" | ||
|
||
img_permit_rootlogin $root without-password | ||
img_dedicated_home $root | ||
img_serial_console $root | ||
|
||
log "...installing azure-agent package" | ||
img_install_pkg $root azure-agent | ||
|
||
log "... installing azure profile" | ||
img_install_profile $root $SRCDIR/../etc/azure.xml | ||
img_install_profile $root $SRCDIR/../etc/rsyslog.xml | ||
|
||
img_postboot_block $root << EOM | ||
/sbin/ipadm create-if hv_netvsc0 | tee /dev/msglog | ||
/sbin/ipadm create-addr -T dhcp hv_netvsc0/dhcp | tee /dev/msglog | ||
/bin/cp /etc/nsswitch.{dns,conf} | ||
/usr/sbin/svcadm restart network/service | ||
EOM | ||
} | ||
|
||
HVM_Image_Init 8G rpool azure omnios-r$VERSION | ||
HVM_Image_Build "-fB -o ashift=12" $ZFSSEND omnios customise | ||
HVM_Image_Finalise 1 "/dev/dsk/c1d0s1" "/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0:b" \ | ||
"id1,cmdk@f0000000000000000000000000000/b" -keeplofi | ||
|
||
echo "Creating raw disk image" | ||
|
||
rm -f $BUILDSEND_MP/azure-$VERSION.{raw,vhd} | ||
dd if=$HVMlofi of=$BUILDSEND_MP/azure-$VERSION.raw bs=2048 | ||
lofiadm -d $HVMlofi | ||
zfs destroy -r $HVMdataset | ||
|
||
conv=`mktemp` | ||
wget -O $conv https://mirrors.omnios.org/vhd/raw2vhd.py | ||
echo "Creating vhd disk image" | ||
python2 $conv $BUILDSEND_MP/azure-$VERSION.{raw,vhd} | ||
rm -f $conv | ||
rm -f $BUILDSEND_MP/azure-$VERSION.raw | ||
ls -lh $BUILDSEND_MP/azure-$VERSION.vhd | ||
|
||
# Vim hints | ||
# vim:ts=4:sw=4:et:fdm=marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters