FirstRun script not running

sp_df
New Contributor

Hi,

We have a FirstRun script that makes bootable and hides a recovery partition. However it does not seem to want to run as part of the FirstRun script.

If I run another test script ahead of it, it will run just fine, but on it's own does not run.

Anyone got any ideas?

Cheers
Dan

The script

#!/bin/bash

touch /tmp/hide-recovery-partition.runfile
date "+%Y-%m-%d %H:%M:%S" >> /tmp/hide-recovery-partition.runfile


# Redirect STDERR to STDOUT
exec 2>&1

RECOVERYHD=/dev/$( diskutil list | grep "Recovery HD" | awk '{print $7}' )

if [ ! "${RECOVERYHD}" = "" ]; then

    echo "Changing partition type for ${RECOVERYHD}" 
    diskutil unmount force "${RECOVERYHD}"

    if [ $? = 0 ]; then

        asr adjust --target "${RECOVERYHD}" --settype Apple_Boot

    else

        echo "The volume did not unmount"
        diskutil list
        exit 2

    fi

else

    echo "something's wrong"
    exit 1

fi

The script that allows it to run

#!/bin/bash

file1=$1/tmp/jamf-firstrun-test.txt

touch $file1

echo $( date "+%Y-%m-%d %H:%M:%S" ) >> $file1

tar -cvzf /tmp/jamf-firstrun-dir_$( date "+%Y-%m-%d_%H-%M" ).tgz /Library/Application Support/JAMF/FirstRun
1 REPLY 1

nessts
Valued Contributor II

make your script a package, that has a launch daemon, and run it yourself at firstboot