Re: Installation Check script
Re: Installation Check script
- Subject: Re: Installation Check script
- From: Conor Schutzman <email@hidden>
- Date: Thu, 15 Oct 2015 19:12:52 -0700
Redirecting to an existing log file, such as install.log, for various reasons. An easier solution, and arguably a better habit, would be to create log files for everything “you” are doing outside of the normal installation process. In such a case, you likely want to create your own files based on the operations that are generating the log messages (pro tip would be to still find a way to list the source operation in the message, so that when users start copying and pasting log messages you don’t have to start wondering where they came from).
What I do is create a folder for my company in /Library/Logs, then redirect to a file in that folder. The drawback is that you then need to do certain things, like make sure that folder exists before trying to create the file, in *every* script you write. My solution to this is a using the “source” command to import a fairly static list of variables and functions, including all of the code to support my logging.
For sake of conversation, the function I use for logging to both syslog and my log file is:
writeLog(){ /usr/bin/logger -s -t "[${consoleUser}] [${softwareTitle}] [${sectionTitle}]" -p "user.${1}" "$2" 2>> "$logFile"; }
Then throughout my script I just have lines like:
writeLog info “Installation was successful”
or
writeLog warning “File not found: $variableName”
If you aren’t familiar with the syslog syntax, between the logger man page and the wikipedia for syslog, most of the basics get covered.
Conor
> On Oct 15, 2015, at 6:36 PM, Br. Samuel Springuel <email@hidden> wrote:
>
> I've tried manually redirecting to a log file in the past, and couldn't make it work (I could never find the log file). However, I was unaware of the logger command, so thanks for pointing it out. I tried it and it seems to send the message to system.log. Is there anyway to tell it to send the message to install.log instead so that I don't have to look in more than one place for information related to the installation process?
>
> You're revised logic, however, does seem to be working. I still have to finish rewriting the postflight script and then test the installer against several system configuration permutations to check, but I did get past the Installation Check on El Capitan and Yosemite using your revisions. Thanks.
>
> ✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
> Br. Samuel, OSB
> (R. Padraic Springuel)
>
> PAX ☧ ΧΡΙΣΤΟΣ
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden