Assistance with Installation Script.

MrBingham917
New Contributor II

Hi there everyone - I am attempting to streamline one of my scripts to install Centrify using path variables. I am able to run the commands by themselves but when I assign them as variables, failure city.

I will have a dmg file sitting in /private/var/Centrify5.5.1/CentrifyDC-5.5.1-x86_64.dmg that I would like to mount using hdiutil. Then I would install the contained pkg.

I'm attempting to make a variable, and I would assume that it is going to be

DMGPath="/private/var/Centrify5.5.1/CenrifyDC-5.5.1-x86_64.dmg" PKGPath="/Volumes/Centrify5.5.1/CentrifyDC-5.5.1.pkg"

I would like to have it be

mount DMG

hdiutil attach $DMGPath -nobrowse (don't need to see the mounted DMG)

Install Centrify pkg

installer -pkg $PKGPath

I keep getting hdiutil errors asking for an <image>

I would be grateful for any and all assistance.

2 REPLIES 2

MrBingham917
New Contributor II

Ugh formatting. I meant to comment out the bolded lines. Sorry :p

ShaunRMiller83
Contributor III

I have a similar script for Bomgar Jump Client and modified it for this use case.

Unfortunately, I can test it beyond that since I don't use Centrify but the script should work.

#!/bin/bash

dmgpath=/private/var/Centrify5.5.1/CenrifyDC-5.5.1-x86_64.dmg
pkgpath=/Volumes/Centrify5.5.1/CentrifyDC-5.5.1.pkg

if  [ -f "$dmgpath" ]; then

        echo "Centrify has been cached on the system"

        # Attach the Disk Image
        hdiutil attach -noverify -quiet "$dmgpath"

        # Run the installer
        if [ -d "$pkgpath" ]; then
            installer -pkg "$pkgpath" -target /
        else
            echo "Problem mounting the Centrify DMG"
        fi 
else
    echo "Centrify has not been cached on the system"
fi