Re: Installation Check script
Re: Installation Check script
- Subject: Re: Installation Check script
- From: Conor Schutzman <email@hidden>
- Date: Wed, 14 Oct 2015 18:03:18 -0700
I would change the script so it exits with code 0 unless a failure occurs (an inverse of your current logic).
Coding in my phone, but I would do something like...
#!/usr/bin/env bash
kpsewhichFound=0
possibleLocations=(
'/usr/texbin'
'/Library/TeX/texbin'
)
for eachLocation in "${possibleLocation[@]}"; do
if [[ -e "${eachLocation}/kpsewhich" ]]; then
(( kpsewhichFound++ ))
echo "Found kpsewhich at $eachLocation"
texBinLocation="$eachLocation"
fi
done
if [[ "$kpsewhichFound" = 0 ]]; then
echo "Failed"
exit 1
else
echo "Passed"
foo
fi
exit 0
I'm not familiar with TeX, so replace the foo line with whatever you actually need kpsewhich for.
Also, echo is great (and I use it above for sake of simplicity), but I would suggest possibly redirecting to a log file, or using the command "logger" instead. Either of which makes it easier to see what's going on in this kind of examination.
> On Oct 14, 2015, at 5:07 PM, Br. Samuel Springuel <email@hidden> wrote:
>
> I'm attempting to update an installer for a TeX package that I help develop to account for SIP on El Capitan (in case it's relevant, the installer is built with Packages because I haven't yet figured out how to use the command-line tools that come with XCode). The installer has a Installation Check script which makes sure that the computer has a TeX installation and a post-install script which copies some of the installed files into the TEXMF tree and runs texhash so that TeX is aware of the new files.
>
> On Yosemite and earlier, I could rely on the the tools I needed (to locate the TEXMF tree and run texhas) being on the /usr/texbin/ path, but on El Capitan, they're on /Library/TeX/texbin/ (since /usr is unavailable due to SIP). However, when I attempt to update my scripts to look in that location (in addition to the old location, in order to maintain backwards compatibility), the Installation Check is failing when run by the installer in El Capitan (it still works on Yosemite). When run from the command-line, the check passes (on both versions of OSX). While I haven't built an installer which would bypass the Installation Check, presumably the post-install script will fail too since it requires the same tool that the Installation Check is looking for (and not finding).
>
> Does anyone have any idea why this might happening and what I can do to fix it?
>
> This is the Installation Check script I'm attempting to use:
>> #!/bin/bash
>>
>> # Test to see if we have a valid TeX installation
>>
>> TEXMFLOCAL=`kpsewhich -var-value TEXMFLOCAL`
>> if [ -n "$TEXMFLOCAL" ]; then
>> echo "Passed 1"
>> exit 0
>> fi
>> TEXMFLOCAL=`/usr/texbin/kpsewhich -var-value TEXMFLOCAL`
>> if [ -n "$TEXMFLOCAL" ]; then
>> echo "Passed 2"
>> exit 0
>> fi
>> TEMFLOCAL=`/Library/TeX/texbin/kpsewhich -var-value TEXMFLOCAL`
>> if [ -n "$TEXMFLOCAL" ]; then
>> echo "Passed 3"
>> exit 0
>> fi
>> echo "Failed"
>> exit 1
>
> These are the contents generated for the install.log when running the installer built with this script in El Capitan (a failed installation):
>> Marker - Oct 14, 2015, 7:50:50 PM
>> Oct 14 19:50:52 Developments-iMac Installer[938]: LSExceptions [0x7fede8c2c8f0] loaded
>> Oct 14 19:50:52 Developments-iMac Installer[938]: @(#)PROGRAM:Install PROJECT:Install-1000
>> Oct 14 19:50:52 Developments-iMac Installer[938]: @(#)PROGRAM:Installer PROJECT:Installer-853
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Hardware: iMac9,1 @ 2.65 GHz (x 2), 2048 MB RAM
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Running OS Build: Mac OS X 10.11 (15A284)
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: TMPDIR=/var/folders/8r/yx005szj2j9fk_hs7xzs091w0000gn/T/
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: SHELL=/bin/bash
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: HOME=/Users/development
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.tB9pQsg5ym/Render
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.n9ZUc36LZQ/Listeners
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: LOGNAME=development
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: XPC_SERVICE_NAME=com.apple.installer.1952
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: USER=development
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Env: XPC_FLAGS=0x0
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Gregorio Installation Log
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Opened from: /Users/development/Desktop/Gregorio-4_0_0-rc1.pkg
>> Oct 14 19:50:52 Developments-iMac Installer[938]: Product archive /Users/development/Desktop/Gregorio-4_0_0-rc1.pkg trustLevel=100
>> Oct 14 19:50:55 Developments-iMac Installer[938]: Installation checks failed.
>
> These are the contents generated when running the installer built with this script in Yosemite (a successful installation):
>> Marker - Oct 14, 2015, 8:00:24 PM
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: LSExceptions [0x6000002a5a60] loaded
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: @(#)PROGRAM:Install PROJECT:Install-924.1
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: @(#)PROGRAM:Installer PROJECT:Installer-815
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Hardware: iMac9,1 @ 2.65 GHz (x 2), 2048 MB RAM
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Running OS Build: Mac OS X 10.10.5 (14F27)
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: TMPDIR=/var/folders/pd/b7145tbd68sgm38n824cr7m40000gn/T/
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: SHELL=/bin/bash
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: HOME=/Users/brsamuel
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.2Roq1iPWRv/Render
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.iIpVJit3t4/Listeners
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: LOGNAME=brsamuel
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: XPC_SERVICE_NAME=com.apple.installer.26728
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: USER=brsamuel
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Env: XPC_FLAGS=0x0
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Gregorio Installation Log
>> Oct 14 20:00:27 Brs-iMac.local Installer[343]: Opened from: /Users/brsamuel/Desktop/Gregorio-4_0_0-rc1.pkg
>> Oct 14 20:00:28 Brs-iMac.local Installer[343]: Product archive /Users/brsamuel/Desktop/Gregorio-4_0_0-rc1.pkg trustLevel=100
>> Oct 14 20:00:38 Brs-iMac.local Installer[343]: LSExceptions [0x6000002a5a60] unloaded
>> Oct 14 20:00:40 Brs-iMac.local Installer[343]: InstallerStatusNotifications plugin loaded
>> Oct 14 20:00:46 Brs-iMac.local runner[353]: Administrator authorization granted.
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: ================================================================================
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: User picked Standard Install
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: Choices selected for installation:
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: Install: "Gregorio"
>> Oct 14 20:00:46 --- last message repeated 1 time ---
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: Gregorio-4_0_0-rc1.pkg#gregorio-base.pkg : com.gregorio.pkg.Gregorio : 4.0.0-rc1
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: ================================================================================
>> Oct 14 20:00:46 Brs-iMac.local Installer[343]: It took 0.00 seconds to summarize the package selections.
>> Oct 14 20:00:47 Brs-iMac.local Installer[343]: -[IFDInstallController(Private) _buildInstallPlan]: location = file://localhost
>> Oct 14 20:00:47 Brs-iMac.local Installer[343]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Users/brsamuel/Desktop/Gregorio-4_0_0-rc1.pkg#gregorio-base.pkg
>> Oct 14 20:00:47 Brs-iMac.local Installer[343]: Set authorization level to root for session
>> Oct 14 20:00:47 Brs-iMac.local Installer[343]: Will use PK session
>> Oct 14 20:00:47 Brs-iMac.local Installer[343]: Starting installation:
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: Configuring volume "Macintosh HD"
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: Preparing disk for local booted install.
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: Free space on "Macintosh HD": 52.43 GB (52427366400 bytes).
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: Create temporary directory "/var/folders/pd/b7145tbd68sgm38n824cr7m40000gn/T//Install.343Ewh1aI"
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: IFPKInstallElement (1 packages)
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: Using authorization level of root for IFPKInstallElement
>> Oct 14 20:00:48 Brs-iMac.local installd[357]: installd: Starting
>> Oct 14 20:00:48 Brs-iMac.local installd[357]: installd: uid=0, euid=0
>> Oct 14 20:00:48 Brs-iMac.local installd[357]: PackageKit: Adding client PKInstallDaemonClient pid=343, uid=501 (/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer)
>> Oct 14 20:00:48 Brs-iMac.local Installer[343]: PackageKit: Enqueuing install with framework-specified quality of service (utility)
>> Oct 14 20:00:48 Brs-iMac.local installd[357]: PackageKit: ----- Begin install -----
>> Oct 14 20:00:48 Brs-iMac.local installd[357]: PackageKit: request=PKInstallRequest <1 packages, destination=/>
>> Oct 14 20:00:48 Brs-iMac.local installd[357]: PackageKit: packages=(
>> "PKLeopardPackage <file://localhost/Users/brsamuel/Desktop/Gregorio-4_0_0-rc1.pkg#gregorio-base.pkg>"
>> )
>> Oct 14 20:00:49 Brs-iMac.local installd[357]: PackageKit: Extracting file://localhost/Users/brsamuel/Desktop/Gregorio-4_0_0-rc1.pkg#gregorio-base.pkg (destination=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/72E06719-B17C-4B59-8E19-B8FC8A34286C.activeSandbox/Root, uid=0)
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: PackageKit: prevent user idle system sleep
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: PackageKit: suspending backupd
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: PackageKit: Using trashcan path /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/72E06719-B17C-4B59-8E19-B8FC8A34286C.sandboxTrash for sandbox /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/72E06719-B17C-4B59-8E19-B8FC8A34286C.activeSandbox
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: PackageKit: Shoving /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/72E06719-B17C-4B59-8E19-B8FC8A34286C.activeSandbox/Root (3 items) to /
>> Oct 14 20:00:50 Brs-iMac.local install_monitor[358]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.rJjzx2/Scripts/com.gregorio.pkg.Gregorio.4myURI
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: ./postinstall: /tmp/PKInstallSandbox.rJjzx2/Scripts/com.gregorio.pkg.Gregorio.4myURI/postinstall: line 8: kpsewhich: command not found
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: ./postinstall: /tmp/PKInstallSandbox.rJjzx2/Scripts/com.gregorio.pkg.Gregorio.4myURI/postinstall: line 9: kpsewhich: command not found
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: ./postinstall: /tmp/PKInstallSandbox.rJjzx2/Scripts/com.gregorio.pkg.Gregorio.4myURI/postinstall: line 11: kpsewhich: command not found
>> Oct 14 20:00:50 Brs-iMac.local installd[357]: ./postinstall: /usr/texbin/kpsewhich: option `-expand-path' requires an argument
>> Oct 14 20:01:08 Brs-iMac.local installd[357]: PackageKit: Writing receipt for com.gregorio.pkg.Gregorio to /private/var/db/receipts
>> Oct 14 20:01:08 Brs-iMac.local installd[357]: Installed "Gregorio" ()
>> Oct 14 20:01:08 Brs-iMac.local install_monitor[358]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: releasing backupd
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: allow user idle system sleep
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: ----- End install -----
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: 20.3s elapsed install time
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: Running idle tasks
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: Removing client PKInstallDaemonClient pid=343, uid=501 (/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer)
>> Oct 14 20:01:09 Brs-iMac.local installd[357]: PackageKit: Done with sandbox removals
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: Running install actions
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: Removing temporary directory "/var/folders/pd/b7145tbd68sgm38n824cr7m40000gn/T//Install.343Ewh1aI"
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: Finalize disk "Macintosh HD"
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: Notifying system of updated components
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: **** Summary Information ****
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: Operation Elapsed time
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: -----------------------------
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: disk 0.06 seconds
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: script 0.01 seconds
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: zero 0.25 seconds
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: install 21.83 seconds
>> Oct 14 20:01:10 Brs-iMac.local Installer[343]: -total- 22.14 seconds
>
>
>
> --
> ✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
> 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
_______________________________________________
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