Skip to content

Instantly share code, notes, and snippets.

@trentster trentster/gist:4b1fd2fa775200a455f4 Secret
Last active Dec 16, 2015

Embed
What would you like to do?
[root@web-nginx ~]# DEBUG=1 sm-prepare-image -y
+ '[' -y == -y ']'
+ yn_start=y
+ yn_nfs=y
+ yn_subips=y
+ yn_halt=y
+ zoneinit_source=/opt/local/lib/zoneinit
+ zoneinit_home=/var/zoneinit
+ zoneinit_files=(zoneinit zoneinit.json zoneinit.xml includes)
+ mdata_home=/var/svc
+ mdata_files=(mdata-fetch mdata-execute mdata.xml)
+ delete_files=(/etc/ssh/ssh_*key* /var/ssh/ssh_*key* /etc/defaultrouter /etc/hostname.net* /var/adm /var/cron /var/db/pkgin /var/spool/postfix/defer* /var/spool/postfix/hold /var/spool/postfix/incoming /var/svc/log /var/svc/provision* /var/log:*log.*)
+ blank_files=(/var/log)
+ touch_files=(/var/adm/messages /var/adm/sulog /var/adm/wtmpx /var/cron/log /var/log/syslog)
+ users=(root admin)
+ delete_users_files=(.*history .gnupg .lesshst .subversion .viminfo .ssh/known_hosts)
+ cat
*** WARNING: PLEASE READ CAREFULLY! THIS SCRIPT WILL ALTER YOUR SYSTEM ***
This script cleans up the file system of your machine, and makes it ready
for turning into a provisionable image. Irreversible changes are made to this
machine's filesystem for the sake of the image preparation, so if you intend
to continue to use this machine, make sure you have a sanity snapshot created
first that you can roll back to when you're done. If you made this machine for
the image purposes only and are fine discarding it later on, you do not
need a snapshot.
This script will:
Change hard coded IP addresses to variables [optional]
Delete transient files and log files
Unset passwords for 'root' and 'admin' users
Reset network information
If you are at all unsure, stop now and check the script.
+ '[' y ']'
+ echo
+ [[ ! y =~ [Yy] ]]
++ id -u
+ '[' 0 -ne 0 ']'
+ echo
+ echo '=> Removing volatile files'
=> Removing volatile files
+ for file in '${delete_files[@]}'
+ each_file_in '/etc/ssh/ssh_*key*' delete
+ local 'item=/etc/ssh/ssh_*key*'
+ local 'pattern=/etc/ssh/ssh_*key*'
+ local action=delete
+ local file
+ '[' '/etc/ssh/ssh_*key*' == '/etc/ssh/ssh_*key*' ']'
+ unset pattern
+ '[' -e '/etc/ssh/ssh_*key*' ']'
+ '[' delete == touch ']'
+ for file in '${delete_files[@]}'
+ each_file_in /var/ssh/ssh_host_dsa_key delete
+ local item=/var/ssh/ssh_host_dsa_key
+ local pattern=/var/ssh/ssh_host_dsa_key
+ local action=delete
+ local file
+ '[' /var/ssh/ssh_host_dsa_key == /var/ssh/ssh_host_dsa_key ']'
+ unset pattern
+ '[' -e /var/ssh/ssh_host_dsa_key ']'
++ find /var/ssh/ssh_host_dsa_key -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/ssh/ssh_host_dsa_key
+ for file in '${delete_files[@]}'
+ each_file_in /var/ssh/ssh_host_dsa_key.pub delete
+ local item=/var/ssh/ssh_host_dsa_key.pub
+ local pattern=/var/ssh/ssh_host_dsa_key.pub
+ local action=delete
+ local file
+ '[' /var/ssh/ssh_host_dsa_key.pub == /var/ssh/ssh_host_dsa_key.pub ']'
+ unset pattern
+ '[' -e /var/ssh/ssh_host_dsa_key.pub ']'
++ find /var/ssh/ssh_host_dsa_key.pub -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/ssh/ssh_host_dsa_key.pub
+ for file in '${delete_files[@]}'
+ each_file_in /var/ssh/ssh_host_rsa_key delete
+ local item=/var/ssh/ssh_host_rsa_key
+ local pattern=/var/ssh/ssh_host_rsa_key
+ local action=delete
+ local file
+ '[' /var/ssh/ssh_host_rsa_key == /var/ssh/ssh_host_rsa_key ']'
+ unset pattern
+ '[' -e /var/ssh/ssh_host_rsa_key ']'
++ find /var/ssh/ssh_host_rsa_key -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/ssh/ssh_host_rsa_key
+ for file in '${delete_files[@]}'
+ each_file_in /var/ssh/ssh_host_rsa_key.pub delete
+ local item=/var/ssh/ssh_host_rsa_key.pub
+ local pattern=/var/ssh/ssh_host_rsa_key.pub
+ local action=delete
+ local file
+ '[' /var/ssh/ssh_host_rsa_key.pub == /var/ssh/ssh_host_rsa_key.pub ']'
+ unset pattern
+ '[' -e /var/ssh/ssh_host_rsa_key.pub ']'
++ find /var/ssh/ssh_host_rsa_key.pub -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/ssh/ssh_host_rsa_key.pub
+ for file in '${delete_files[@]}'
+ each_file_in /etc/defaultrouter delete
+ local item=/etc/defaultrouter
+ local pattern=/etc/defaultrouter
+ local action=delete
+ local file
+ '[' /etc/defaultrouter == /etc/defaultrouter ']'
+ unset pattern
+ '[' -e /etc/defaultrouter ']'
++ find /etc/defaultrouter -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /etc/defaultrouter
+ for file in '${delete_files[@]}'
+ each_file_in /etc/hostname.net0 delete
+ local item=/etc/hostname.net0
+ local pattern=/etc/hostname.net0
+ local action=delete
+ local file
+ '[' /etc/hostname.net0 == /etc/hostname.net0 ']'
+ unset pattern
+ '[' -e /etc/hostname.net0 ']'
++ find /etc/hostname.net0 -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /etc/hostname.net0
+ for file in '${delete_files[@]}'
+ each_file_in /var/adm delete
+ local item=/var/adm
+ local pattern=/var/adm
+ local action=delete
+ local file
+ '[' /var/adm == /var/adm ']'
+ unset pattern
+ '[' -e /var/adm ']'
++ find /var/adm -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/adm/utmpx
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/adm/lastlog
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/adm/sulog
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/adm/wtmpx
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/adm/messages
+ for file in '${delete_files[@]}'
+ each_file_in /var/cron delete
+ local item=/var/cron
+ local pattern=/var/cron
+ local action=delete
+ local file
+ '[' /var/cron == /var/cron ']'
+ unset pattern
+ '[' -e /var/cron ']'
++ find /var/cron -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/cron/log
+ for file in '${delete_files[@]}'
+ each_file_in /var/db/pkgin delete
+ local item=/var/db/pkgin
+ local pattern=/var/db/pkgin
+ local action=delete
+ local file
+ '[' /var/db/pkgin == /var/db/pkgin ']'
+ unset pattern
+ '[' -e /var/db/pkgin ']'
++ find /var/db/pkgin -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/pkgin.db
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/sql.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/pkg_install-err.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/mysql-client-5.5.28nb2.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/nano-2.2.6nb1.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-zlib-5.3.19nb1.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-mysql-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/freetype2-2.4.11.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/libmcrypt-2.5.8.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-imap-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/smtools-20130417.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-mysqli-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/jpeg-8d.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/unzip-6.0nb1.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-curl-5.3.19nb1.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-gd-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/nginx-1.2.5.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-json-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-mcrypt-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-mbstring-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-pdo_mysql-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/xmlcatmgr-2.2nb1.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/libxml2-2.9.0nb1.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/png-1.5.13.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/mysql-server-5.5.28.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-pdo-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-bcmath-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-zip-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/php53-fpm-5.3.19.tgz
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/db/pkgin/cache/imap-uw-2007f.tgz
+ for file in '${delete_files[@]}'
+ each_file_in '/var/spool/postfix/defer*' delete
+ local 'item=/var/spool/postfix/defer*'
+ local 'pattern=/var/spool/postfix/defer*'
+ local action=delete
+ local file
+ '[' '/var/spool/postfix/defer*' == '/var/spool/postfix/defer*' ']'
+ unset pattern
+ '[' -e '/var/spool/postfix/defer*' ']'
+ '[' delete == touch ']'
+ for file in '${delete_files[@]}'
+ each_file_in /var/spool/postfix/hold delete
+ local item=/var/spool/postfix/hold
+ local pattern=/var/spool/postfix/hold
+ local action=delete
+ local file
+ '[' /var/spool/postfix/hold == /var/spool/postfix/hold ']'
+ unset pattern
+ '[' -e /var/spool/postfix/hold ']'
+ '[' delete == touch ']'
+ for file in '${delete_files[@]}'
+ each_file_in /var/spool/postfix/incoming delete
+ local item=/var/spool/postfix/incoming
+ local pattern=/var/spool/postfix/incoming
+ local action=delete
+ local file
+ '[' /var/spool/postfix/incoming == /var/spool/postfix/incoming ']'
+ unset pattern
+ '[' -e /var/spool/postfix/incoming ']'
+ '[' delete == touch ']'
+ for file in '${delete_files[@]}'
+ each_file_in /var/svc/log delete
+ local item=/var/svc/log
+ local pattern=/var/svc/log
+ local action=delete
+ local file
+ '[' /var/svc/log == /var/svc/log ']'
+ unset pattern
+ '[' -e /var/svc/log ']'
++ find /var/svc/log -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-extended-accounting:task.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-loopback:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-security-krb5kdc:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ssh:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-hostid:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-coreadm:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-network:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-device-mpxio-upgrade:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-nfs-nlockmgr:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-nfs-client:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-loadbalancer-ilb:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipv6-forwarding:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-legacy-routing:ipv6.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-rdisc:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-devices:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-route:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipsec-policy:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-setup:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-cron:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-pfexec:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-early-manifest-import:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-sysconfig:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-rbac:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-inetd-upgrade:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-autofs:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-sysidtool:system.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-local:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-auditd:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipsec-manual-key:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-manifest-import:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-minimal:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-inetd:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/smartdc-mdata:execute.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-ripng:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-device-allocate:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-rmtmpfiles:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-shares-group:zfs.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-root:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-dns-install:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-netmask:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-nfs-mapid:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-sysidtool:net.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-sar:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipsec-ipsecalgs:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-sac:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-install:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ip-interface-management:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-usr:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:ttya.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-rpc-keyserv:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/smartdc-mdata:fetch.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ldap-client:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/pkgsrc-nginx:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipv4-forwarding:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-utmp:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:vt6.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-cryptosvc:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-vtdaemon:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-boot-archive:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/svc.startd.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-logadm-upgrade:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-smartdc:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-iptun:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-extended-accounting:net.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:vt5.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/pkgsrc-mysql:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-name-services:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:vt2.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-idmap:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-identity:node.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-vrrp:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-hotplug:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-initial:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-nfs-cbd:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-physical:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-datalink-management:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-legacy-routing:ipv4.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-extended-accounting:process.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-filesystem-reparse:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/pkgsrc-postfix:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-rpc-bind:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-shares-group:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-service:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipsec-ike:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:ttyb.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-nis-client:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-identity:domain.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-smb-client:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-security-kadmin:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-device-local:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipqos:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-name-service-cache:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:vt3.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-console-login:vt4.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-multi-user-server:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/pkgsrc-php-fpm:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-extended-accounting:flow.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-svc-global:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-dns-multicast:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-nfs-status:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-system-log:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-slp:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-location:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-keymap:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-single-user:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-ipfilter:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/milestone-multi-user:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-rcap:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-physical:nwam.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-dns-client:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-zoneinit:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/network-routing-ndp:default.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/log/system-consadm:default.log
+ for file in '${delete_files[@]}'
+ each_file_in /var/svc/provision_success delete
+ local item=/var/svc/provision_success
+ local pattern=/var/svc/provision_success
+ local action=delete
+ local file
+ '[' /var/svc/provision_success == /var/svc/provision_success ']'
+ unset pattern
+ '[' -e /var/svc/provision_success ']'
++ find /var/svc/provision_success -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /var/svc/provision_success
+ for file in '${delete_files[@]}'
+ each_file_in '/var/log:*log.*' delete
+ local item=/var/log
+ local 'pattern=*log.*'
+ local action=delete
+ local file
+ '[' /var/log == '*log.*' ']'
+ '[' -e /var/log ']'
++ find /var/log -type f -name '*log.*'
+ for file in '${blank_files[@]}'
+ each_file_in /var/log blank
+ local item=/var/log
+ local pattern=/var/log
+ local action=blank
+ local file
+ '[' /var/log == /var/log ']'
+ unset pattern
+ '[' -e /var/log ']'
++ find /var/log -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/courier.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/zoneinit.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/auth.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/syslog
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/postfix.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/sysidconfig.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/php-fpm.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/nginx/access.log
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ cp /dev/null /var/log/nginx/error.log
+ for file in '${touch_files[@]}'
+ each_file_in /var/adm/messages touch
+ local item=/var/adm/messages
+ local pattern=/var/adm/messages
+ local action=touch
+ local file
+ '[' /var/adm/messages == /var/adm/messages ']'
+ unset pattern
+ '[' -e /var/adm/messages ']'
+ '[' touch == touch ']'
+ touch /var/adm/messages
+ for file in '${touch_files[@]}'
+ each_file_in /var/adm/sulog touch
+ local item=/var/adm/sulog
+ local pattern=/var/adm/sulog
+ local action=touch
+ local file
+ '[' /var/adm/sulog == /var/adm/sulog ']'
+ unset pattern
+ '[' -e /var/adm/sulog ']'
+ '[' touch == touch ']'
+ touch /var/adm/sulog
+ for file in '${touch_files[@]}'
+ each_file_in /var/adm/wtmpx touch
+ local item=/var/adm/wtmpx
+ local pattern=/var/adm/wtmpx
+ local action=touch
+ local file
+ '[' /var/adm/wtmpx == /var/adm/wtmpx ']'
+ unset pattern
+ '[' -e /var/adm/wtmpx ']'
+ '[' touch == touch ']'
+ touch /var/adm/wtmpx
+ for file in '${touch_files[@]}'
+ each_file_in /var/cron/log touch
+ local item=/var/cron/log
+ local pattern=/var/cron/log
+ local action=touch
+ local file
+ '[' /var/cron/log == /var/cron/log ']'
+ unset pattern
+ '[' -e /var/cron/log ']'
+ '[' touch == touch ']'
+ touch /var/cron/log
+ for file in '${touch_files[@]}'
+ each_file_in /var/log/syslog touch
+ local item=/var/log/syslog
+ local pattern=/var/log/syslog
+ local action=touch
+ local file
+ '[' /var/log/syslog == /var/log/syslog ']'
+ unset pattern
+ '[' -e /var/log/syslog ']'
++ find /var/log/syslog -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ touch /var/log/syslog
+ '[' -d /var/ssh ']'
+ echo
+ echo '=> Removing users'\'' volatile information'
=> Removing users' volatile information
+ for user in '${users[@]}'
+ echo '==> Removing files for user root'
==> Removing files for user root
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.bash_history delete
+ local item=/root/.bash_history
+ local pattern=/root/.bash_history
+ local action=delete
+ local file
+ '[' /root/.bash_history == /root/.bash_history ']'
+ unset pattern
+ '[' -e /root/.bash_history ']'
++ find /root/.bash_history -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /root/.bash_history
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.mysql_history delete
+ local item=/root/.mysql_history
+ local pattern=/root/.mysql_history
+ local action=delete
+ local file
+ '[' /root/.mysql_history == /root/.mysql_history ']'
+ unset pattern
+ '[' -e /root/.mysql_history ']'
++ find /root/.mysql_history -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /root/.mysql_history
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.gnupg delete
+ local item=/root/.gnupg
+ local pattern=/root/.gnupg
+ local action=delete
+ local file
+ '[' /root/.gnupg == /root/.gnupg ']'
+ unset pattern
+ '[' -e /root/.gnupg ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.lesshst delete
+ local item=/root/.lesshst
+ local pattern=/root/.lesshst
+ local action=delete
+ local file
+ '[' /root/.lesshst == /root/.lesshst ']'
+ unset pattern
+ '[' -e /root/.lesshst ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.subversion delete
+ local item=/root/.subversion
+ local pattern=/root/.subversion
+ local action=delete
+ local file
+ '[' /root/.subversion == /root/.subversion ']'
+ unset pattern
+ '[' -e /root/.subversion ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.viminfo delete
+ local item=/root/.viminfo
+ local pattern=/root/.viminfo
+ local action=delete
+ local file
+ '[' /root/.viminfo == /root/.viminfo ']'
+ unset pattern
+ '[' -e /root/.viminfo ']'
++ find /root/.viminfo -type f
+ for file in '$(find ${item} -type f ${pattern:+-name ${pattern}})'
+ case ${action} in
+ rm -f /root/.viminfo
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~root; pwd'
+++ cd /root
+++ pwd
+ each_file_in /root/.ssh/known_hosts delete
+ local item=/root/.ssh/known_hosts
+ local pattern=/root/.ssh/known_hosts
+ local action=delete
+ local file
+ '[' /root/.ssh/known_hosts == /root/.ssh/known_hosts ']'
+ unset pattern
+ '[' -e /root/.ssh/known_hosts ']'
+ '[' delete == touch ']'
+ echo '==> Unsetting password for user root'
==> Unsetting password for user root
++ passwd -N root
+ out='passwd: password information changed for root'
+ for user in '${users[@]}'
+ echo '==> Removing files for user admin'
==> Removing files for user admin
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.bash_history delete
+ local item=/home/admin/.bash_history
+ local pattern=/home/admin/.bash_history
+ local action=delete
+ local file
+ '[' /home/admin/.bash_history == /home/admin/.bash_history ']'
+ unset pattern
+ '[' -e /home/admin/.bash_history ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.mysql_history delete
+ local item=/home/admin/.mysql_history
+ local pattern=/home/admin/.mysql_history
+ local action=delete
+ local file
+ '[' /home/admin/.mysql_history == /home/admin/.mysql_history ']'
+ unset pattern
+ '[' -e /home/admin/.mysql_history ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.gnupg delete
+ local item=/home/admin/.gnupg
+ local pattern=/home/admin/.gnupg
+ local action=delete
+ local file
+ '[' /home/admin/.gnupg == /home/admin/.gnupg ']'
+ unset pattern
+ '[' -e /home/admin/.gnupg ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.lesshst delete
+ local item=/home/admin/.lesshst
+ local pattern=/home/admin/.lesshst
+ local action=delete
+ local file
+ '[' /home/admin/.lesshst == /home/admin/.lesshst ']'
+ unset pattern
+ '[' -e /home/admin/.lesshst ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.subversion delete
+ local item=/home/admin/.subversion
+ local pattern=/home/admin/.subversion
+ local action=delete
+ local file
+ '[' /home/admin/.subversion == /home/admin/.subversion ']'
+ unset pattern
+ '[' -e /home/admin/.subversion ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.viminfo delete
+ local item=/home/admin/.viminfo
+ local pattern=/home/admin/.viminfo
+ local action=delete
+ local file
+ '[' /home/admin/.viminfo == /home/admin/.viminfo ']'
+ unset pattern
+ '[' -e /home/admin/.viminfo ']'
+ '[' delete == touch ']'
+ for file in '${delete_users_files[@]}'
++ eval 'cd ~admin; pwd'
+++ cd /home/admin
+++ pwd
+ each_file_in /home/admin/.ssh/known_hosts delete
+ local item=/home/admin/.ssh/known_hosts
+ local pattern=/home/admin/.ssh/known_hosts
+ local action=delete
+ local file
+ '[' /home/admin/.ssh/known_hosts == /home/admin/.ssh/known_hosts ']'
+ unset pattern
+ '[' -e /home/admin/.ssh/known_hosts ']'
+ '[' delete == touch ']'
+ echo '==> Unsetting password for user admin'
==> Unsetting password for user admin
++ passwd -N admin
+ out='passwd: password information changed for admin'
+ echo
+ echo '=> Cleaning up old network configuration'
=> Cleaning up old network configuration
+ cat
+ echo
+ echo '=> Checking for possible NFS configuration'
=> Checking for possible NFS configuration
++ svcs -Ho state nfs/client
+ nfs_state=disabled
+ '[' 0 -eq 0 ']'
+ '[' disabled == online ']'
+ echo
+ echo '=> Looking for hard coded IP addresses'
=> Looking for hard coded IP addresses
+ cat
The script will look for IP addresses associated with this machine, which
won't match those of the machines provisioned from the image you are about
to create. You can have the addresses turned into placeholders that will be
automatically populated by the IP addresses when provisioning.
We recommend you avoid using hardcoded IP addresses in the first place, unless
there is no other alternative.
+ '[' y ']'
+ [[ -z y ]]
+ [[ y =~ [yY] ]]
++ current_ips
++ ifconfig -a
++ awk '{ if ($1=="inet") print $2}'
++ grep -v 127.0.0.1
+ for ip in '$(current_ips)'
++ files_with_ip 10.1.1.210
++ local ip=10.1.1.210
++ find /etc /opt/local/etc -type f
++ sort
++ xargs grep -l 10.1.1.210
++ true
+ files_found=
+ case ${ip} in
+ ip_placeholder=@PRIVATE_IP@
+ echo
+ echo '=> Creating a basic zoneinit instance'
=> Creating a basic zoneinit instance
+ '[' '!' -d /var/zoneinit ']'
+ for zoneinit_file in '${zoneinit_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/zoneinit ']'
+ cp -Rp /opt/local/lib/zoneinit/zoneinit /var/zoneinit/
+ for zoneinit_file in '${zoneinit_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/zoneinit.json ']'
+ cp -Rp /opt/local/lib/zoneinit/zoneinit.json /var/zoneinit/
+ for zoneinit_file in '${zoneinit_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/zoneinit.xml ']'
+ cp -Rp /opt/local/lib/zoneinit/zoneinit.xml /var/zoneinit/
+ for zoneinit_file in '${zoneinit_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/includes ']'
+ cp -Rp /opt/local/lib/zoneinit/includes /var/zoneinit/
+ for mdata_file in '${mdata_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/mdata-fetch ']'
+ cp -Rp /opt/local/lib/zoneinit/mdata-fetch /var/svc/
+ for mdata_file in '${mdata_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/mdata-execute ']'
+ cp -Rp /opt/local/lib/zoneinit/mdata-execute /var/svc/
+ for mdata_file in '${mdata_files[@]}'
+ '[' -e /opt/local/lib/zoneinit/mdata.xml ']'
+ cp -Rp /opt/local/lib/zoneinit/mdata.xml /var/svc/
+ '[' ']'
+ svccfg delete -f mdata
+ svccfg import /var/svc/mdata.xml
+ svccfg import /var/zoneinit/zoneinit.xml
+ svcadm enable zoneinit
+ echo
+ echo '=> File system prepared successfully, finishing'
=> File system prepared successfully, finishing
+ cat
The script is finished now.
This machine should now be powered off, a snapshot taken, and an image created
from the snapshot. Please contact support to have the image created, and refer
to "Creating Your Own SmartMachine Image" in the wiki (http://wiki.joyent.com/wiki/x/zgCC)
for more information.
One reason to not power off now would be to inspect the zoneinit files (start
scripts executed when a new machine is provisioned) at /var/zoneinit and
optionally implement your own ones in /var/zoneinit/includes.
+ '[' y ']'
+ [[ -z y ]]
+ [[ y =~ [Yy] ]]
+ cat
Powering down in 10 seconds... (Ctrl C if not desired)
+ shutdown -y -g10 -i0
[root@web-nginx ~]# Connection to 10.1.1.210 closed by remote host.
Connection to 10.1.1.210 closed.
[root@smartosn2 /opt]# ls -alhs /zones/3850b05a-a3ea-4e20-8b45-dcdc8931d370/root/root/.
total 32
4 drwxr-xr-x 3 root root 11 Apr 18 10:26 .
4 drwxr-xr-x 18 root root 20 Mar 21 22:20 ..
2 -rw------- 1 root root 28 Apr 18 10:26 .bash_history
2 -rw-r--r-- 1 root root 76 Sep 17 2012 .bash_profile
2 -rw-r--r-- 1 root root 435 Sep 21 2012 .bashrc
2 -rw-r--r-- 1 root root 109 Sep 17 2012 .cshrc
2 -rw-r--r-- 1 root root 240 Sep 17 2012 .irbrc
2 -rw-r--r-- 1 root root 40 Sep 17 2012 .login
4 -rw-r--r-- 1 root root 568 Mar 7 12:10 .profile
4 drwxr-xr-x 2 root root 4 Apr 18 07:05 .ssh
4 -rw-r--r-- 1 root root 956 Sep 17 2012 .vimrc
[root@smartosn2 /opt]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.