Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "InstallLog: Create/Append installation log"
5echo "**********************************************"
6
7# Creates text file named 'Chameleon_Installer_Log.txt'
8# at the root of the target volume. This is to help show the
9# user why the installation process failed (even though the
10# package installer ends reading 'Installation Successful'.
11
12# Receives two parameters
13# $1 = selected volume for location of the install log
14# $2 = text to write to the installer log
15
16if [ "$#" -eq 2 ]; then
17logLocation="$1"
18verboseText="$2"
19echo "DEBUG: passed argument = ${logLocation}"
20echo "DEBUG: passed argument = ${verboseText}"
21else
22echo "Error - wrong number of values passed"
23exit 9
24fi
25
26logName="Chameleon_Installer_Log.txt"
27logFile="${logLocation}"/$logName
28
29# On first run, create a file named .ChameleonLogFlag at
30# the root of the target volume. Then check for this file
31# on subsequent runs to know the initialisation sequence
32# has been done.
33
34if [ ! -f "${logLocation}"/.ChameleonLogFlag ]; then
35# This is the first run, so setup
36# Chameleon_Installer_Log.txt file
37# by writing header.
38
39# Also include the first message that this script
40# would be called with which will be version/revision
41# of Chameleon package.
42
43echo "Chameleon installer log - $( date )
44${verboseText}
45======================================================" >"${logFile}"
46
47# Create /.ChameleonLogFlag file.
48echo "Log" >"${logLocation}"/.ChameleonLogFlag
49else
50# Append messages to the log as passed by other scripts.
51if [ "${verboseText}" = "Diskutil" ]; then
52diskutil list >>"${logFile}"
53echo "======================================================" >>"${logFile}"
54fi
55
56if [ "${verboseText}" = "LineBreak" ]; then
57echo "======================================================" >>"${logFile}"
58fi
59
60if [[ "${verboseText}" == *fdisk* ]]; then
61targetDiskRaw="${verboseText#fdisk *}"
62fdisk $targetDiskRaw >>"${logFile}"
63echo " " >>"${logFile}"
64fi
65
66if [ "${verboseText}" != "LineBreak" ] && [[ "${verboseText}" != *fdisk* ]] && [[ "${verboseText}" != "Diskutil" ]]; then
67echo "${verboseText}" >> "${logFile}"
68fi
69fi
70
71exit 0

Archive Download this file

Revision: 1621