Skip to content

Instantly share code, notes, and snippets.

@keeleysam

keeleysam/preflight.sh Secret

Created Mar 13, 2013
Embed
What would you like to do?
#!/bin/sh
# $1 has the path to the source package
# $2 has the path to the target folder
# $3 has the path to the target volume
# $USER has the name of the user who launched the installer
echo ". . . . . running the postflight script . . . . ."
echo " source path is: $1"
echo " target path is: $2"
echo " target volume path is: $3"
export LCC36P=`dirname "$1"`
echo " path to tools is: $LCC36P"
if [ -f "/tmp/LGT_region.plist" ]; then
echo " User has already chosen keyboard, exiting"
exit 0
else
echo " User has not chosen keyboard yet"
fi
if [ -f "$LCC36P/KeyboardChooser.app/Contents/MacOS/KeyboardChooser" ]; then
/usr/bin/sudo -u $USER "$LCC36P/KeyboardChooser.app/Contents/MacOS/KeyboardChooser"
fi
if [ -e "$LCC36P/LCC Uninstaller Tool" ] ; then
"$LCC36P/LCC Uninstaller Tool" --preinstall
fi
# "$1/Contents/Resources/RMover" "$1" --preflight
echo "try to run RMover from Scripts"
# "$1/logitechControlCenter.pkg/Scripts/RMover" "$1" --preflight
"$LCC36P/RMover" "$LCC36P" --preflight
# enforce permissions
if [ -e "/System/Library/Extensions/LogitechHIDDevices.kext" ] ; then
/usr/sbin/chown -R root:wheel "/System/Library/Extensions/LogitechHIDDevices.kext"
/bin/chmod -R ug+r,go-w "/System/Library/Extensions/LogitechHIDDevices.kext"
elif [ -e "/System/Library/Extensions/LogicoolHIDDevices.kext" ] ; then
/usr/sbin/chown -R root:wheel "/System/Library/Extensions/LogicoolHIDDevices.kext"
/bin/chmod -R ug+r,go-w "/System/Library/Extensions/LogicoolHIDDevices.kext"
fi
echo "pausing for 3 seconds"
sleep 3
if [ -f "/tmp/LGT_region.plist" ]; then
echo "Check2: found keyboard flag file"
else
echo "Check2: keyboard flag file not found"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.