1209513Simp#!/bin/sh 2209513Simp#- 3209552Simp# Copyright (c) 2010 iXsystems, Inc. All rights reserved. 4209513Simp# 5209513Simp# Redistribution and use in source and binary forms, with or without 6209513Simp# modification, are permitted provided that the following conditions 7209513Simp# are met: 8209513Simp# 1. Redistributions of source code must retain the above copyright 9209513Simp# notice, this list of conditions and the following disclaimer. 10209513Simp# 2. Redistributions in binary form must reproduce the above copyright 11209513Simp# notice, this list of conditions and the following disclaimer in the 12209513Simp# documentation and/or other materials provided with the distribution. 13209513Simp# 14209513Simp# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15209513Simp# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16209513Simp# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17209513Simp# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18209513Simp# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19209513Simp# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20209513Simp# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21209513Simp# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22209513Simp# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23209513Simp# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24209513Simp# SUCH DAMAGE. 25209513Simp# 26209513Simp# $FreeBSD$ 27209513Simp 28209513Simp# Script which creates a gzipped log and optionally mails it to the specified address 29209513Simp############################################################################ 30209513Simp 31209513Simp. ${PROGDIR}/backend/functions.sh 32209513Simp. ${PROGDIR}/conf/pc-sysinstall.conf 33209513Simp. ${BACKEND}/functions-networking.sh 34209513Simp. ${BACKEND}/functions-parse.sh 35209513Simp 36209513Simp# Bring up all NICS under DHCP 37209513Simpenable_auto_dhcp 38209513Simp 39209513SimpMAILTO="$1" 40209513SimpMAILRESULT="0" 41209513Simp 42209513Simp# Set the location of our compressed log 43209513SimpTMPLOG="/tmp/pc-sysinstall.log" 44209513Simp 45209513Simpecho "# PC-SYSINSTALL LOG" >${TMPLOG} 46209513Simpcat ${LOGOUT} >> ${TMPLOG} 47209513Simp 48209513Simp# Check if we have a GUI generated install cfg 49209513Simpif [ -e "/tmp/sys-install.cfg" ] 50209513Simpthen 51209513Simp echo "" >>${TMPLOG} 52209513Simp echo "# PC-SYSINSTALL CFG " >>${TMPLOG} 53217173Sjpaetzel cat /tmp/sys-install.cfg | grep -vE 'rootPass|userPass' >> ${TMPLOG} 54209513Simpfi 55209513Simp 56209513Simp# Save dmesg output 57209513Simpecho "" >>${TMPLOG} 58209513Simpecho "# DMESG OUTPUT " >>${TMPLOG} 59209513Simpdmesg >> ${TMPLOG} 60209513Simp 61209513Simp# Get gpart info on all disks 62217173Sjpaetzelfor i in `pc-sysinstall disk-list | cut -d ':' -f 1` 63209513Simpdo 64209513Simp echo "" >>${TMPLOG} 65209513Simp echo "# DISK INFO $i " >>${TMPLOG} 66209513Simp ls /dev/${i}* >>${TMPLOG} 67209513Simp gpart show ${i} >> ${TMPLOG} 68209513Simpdone 69209513Simp 70209513Simp# Show Mounted volumes 71209513Simpecho "" >>${TMPLOG} 72209513Simpecho "# MOUNT OUTPUT " >>${TMPLOG} 73209513Simpmount >> ${TMPLOG} 74209513Simp 75209513Simpecho "Log file saved to ${TMPLOG}" 76209513Simpecho "Warning: This file will be lost once the system is rebooted." 77209513Simp 78209513Simpecho "Do you wish to view this logfile now? (Y/N)" 79209513Simpread tmp 80209513Simpif [ "$tmp" = "Y" -o "$tmp" = "y" ] 81209513Simpthen 82209513Simp more ${TMPLOG} 83209513Simpfi 84