#!/usr/sbin/sh # # Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. # . /lib/svc/share/smf_include.sh cur=$(/usr/sbin/virtinfo -c current list -Ho name 2>/dev/null) # Only write out the hostid for non-sparc non-kernel-zone global-zones. if [[ `uname -p` != "sparc" && $cur != "kernel-zone" && $cur != "non-global-zone" ]]; then if [ -s /etc/hostid ]; then exit $SMF_EXIT_OK fi host=`/usr/bin/hostid` echo "# DO NOT EDIT" > /etc/hostid r=`echo "0x${host}" | /usr/bin/perl -e \ 'while(){chop;tr/!-~/P-~!-O/;print $_,"\n";}exit 0;'` printf "\"%s\"\n" $r >> /etc/hostid fi exit $SMF_EXIT_OK