-
Notifications
You must be signed in to change notification settings - Fork 37
/
install_from_vendorDMG.sh
75 lines (61 loc) · 2.23 KB
/
install_from_vendorDMG.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
## postflight
##
## Not supported for flat packages.
pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
######################################################################
# NOTE: Some Vendor Applications do NOT like being packaged
# and insists upon being copied from vendor .dmg to ensure okay usage
# This custom installer by Christopher Miller, Dated: 20150921
# for ITSD-ISS of JHU-APL
# !!!! Modify this script as needed for future vendor .dmg files !!!!
######################################################################
# Specify the name & location of the vendor's .dmg file, the name of the mounted disk, the name of the Application
# Recommend placing the Vendor .DMG file into /private/var/tmp/ location for the payload
VendorDMG="" #The full path to the Vendor .DMG file
VendorDisk="" #The volume name of the mounted .DMG
VendorAPP="" #The name of the Application being installed, for removal of old copies prior to install
# Check for the presence of the Vendor .dmg file
if [ -e "$VendorDMG" ]
then
# Mount the vendor .dmg file
echo "Mounting $VendorDMG"
hdiutil attach "$VendorDMG" -nobrowse
sleep 3
else
echo "Vendor .dmg file not found, look for $VendorDMG"
echo "exiting script, please verify name and location of .dmg"
exit 1 #Stop HERE#
fi
# If present, Remove the earlier copy of the Vendor App from /Applications
if [ -e "/Applications/$VendorAPP" ]
then
echo "Removing original App"
sudo rm -Rf "/Applications/$VendorAPP"
sleep 3
else
echo "Older Application not found, beginning copy"
fi
# Copy the .app from the mounted .dmg volume
cp -Rf "/Volumes/$VendorDisk/$VendorAPP" "/Applications/$VendorAPP"
sleep 3
# Check if the copy completed and .app is present, modify via chown and chmod
if [ -e "/Applications/$VendorAPP" ]
then
echo "Application successfully copied"
sudo chown root:wheel "/Applications/$VendorAPP"
sudo chmod 775 "/Applications/$VendorAPP"
else
echo "Application not found!, check the $VendorDMG file"
fi
# UnMount the vendor .dmg file, remove the vendor.dmg as cleanup
echo "UnMounting $VendorDMG"
hdiutil detach "/Volumes/$VendorDisk"
sleep 3
sudo rm -Rf "$VendorDMG"
echo "Finished! Check status messages above"
exit 0 ## Success
exit 1 ## Failure