/
Build zone creation script
Build zone creation script
#!/bin/bash
TYPE_ZONE=$1
IP=$2
SER=$3
cat > ${HOME}/${TYPE_ZONE}.cmd <<EOT
create
set zonename=${TYPE_ZONE}
set zonepath=/zones/${TYPE_ZONE}
set autoboot=false
set ip-type=exclusive
add net
set physical=iz${SER}
set global-nic=vsw0
add property (name=ip,value="${IP}.${SER}")
add property (name=gateway,value="${IP}.254")
add property (name=netmask,value="255.255.255.0")
add property (name=primary,value="true")
end
add attr
set name=resolvers
set type=string
set value=8.8.8.8
end
add fs
set dir="/export/home/admin"
set special="/export/home/admin"
set type="lofs"
end
add fs
set dir="/export/builds"
set special="/export/builds"
set type="lofs"
end
add fs
set dir="/data/repo"
set special="/data/repo"
set type="lofs"
end
verify
commit
exit
EOT
zonecfg -z ${TYPE_ZONE} -f ${HOME}/${TYPE_ZONE}.cmd 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log
zoneadm -z ${TYPE_ZONE} install 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log
zoneadm -z ${TYPE_ZONE} boot 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log
res=$(grep -e 'WARNING:' -e 'warning:' -e 'W:' -e 'error:' -e 'E:' -e 'cannot' /var/tmp/${TYPE_ZONE}-bts.log | sort -u)
if [[ "$res" == "" ]]; then
echo " =========== Zone ${TYPE_ZONE} is successfully created and ready to use ============="
else
echo " =========== Zone ${TYPE_ZONE} creation log ============="
echo "$res"
echo "$res" | sed '/W: --force-yes is deprecated/d; /\/man\//d'
if [[ "$res" != "" ]]; then
echo " ========================================================"
echo "Please stop and report about zone bootstrap errors!"
fi
fi
Related content
How to make local build DU4 on VM environment
How to make local build DU4 on VM environment
Read with this
Zone configuration for NET test script
Zone configuration for NET test script
More like this
How to Prepare VM for Testing in SPB Labs
How to Prepare VM for Testing in SPB Labs
Read with this
How setup dhcp in zone:
How setup dhcp in zone:
More like this
DHCP zone creation script
DHCP zone creation script
More like this
NET test script
NET test script
More like this