-
Notifications
You must be signed in to change notification settings - Fork 0
/
hpclick.sh
70 lines (56 loc) · 2.57 KB
/
hpclick.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
#!/bin/sh
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
# hpclick.sh -- Installs HPClick
#
# SYNOPSIS
# sudo hpclick.sh
#
####################################################################################################
#
####################################################################################################
#
downloadUrl='https://ftp.hp.com/pub/softlib/software13/hpdesignjetclick/HPClick-3.5.263.dmg'
dnldfile='HPClick.dmg'
appName='HP Click'
forceQuit='N'
logfile="/Library/Caches/com.purplecomputing.mdm/Logs/$appName-InstallScript.log"
deplog="/var/tmp/depnotify.log"
OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )
userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"
scriptver="1.0"
# Making Purple Cache directories for in the event that the helper script hasn't been run
mkdir -p /Library/Caches/com.purplecomputing.mdm/
mkdir -p /Library/Caches/com.purplecomputing.mdm/Logs/
mkdir -p /Library/Caches/com.purplecomputing.mdm/Apps/
rm -rf /Library/Caches/com.purplecomputing.mdm/Apps/*
/bin/echo "Status: Installing ${appName}" >> ${deplog}
/bin/echo "Status: Installing ${appName}" >> ${logfile}
if [[ $@ == "openconsole" ]]; then
open ${logfile}
open ${deplog}
fi
/bin/echo "Script Version: ${scriptver}" >> ${logfile}
/bin/echo "`date`: Downloading." >> ${logfile}
/bin/echo "Downloading."
/usr/bin/curl -L -o /Library/Caches/com.purplecomputing.mdm/Apps/${dnldfile} ${downloadUrl}
if [[ "${forceQuit}" = "Y" ]]; then
killall ${appName}
fi
cd /Library/Caches/com.purplecomputing.mdm/Apps/
# unzip ${dnldfile}
/bin/echo "`date`: Mounting installer disk image." >> ${logfile}
/usr/bin/hdiutil attach /Library/Caches/com.purplecomputing.mdm/Apps/${dnldfile} -nobrowse -quiet
/bin/echo "`date`: Installing..." >> ${logfile}
ditto -rsrc "/Volumes/$appName/$appName.app" "/Applications/$appName.app"
/bin/sleep 10
/bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep appName | awk '{print $1}') -quiet
/bin/sleep 10
/bin/sleep 5
/bin/echo "`date`: Deleting the downloaded file." >> ${logfile}
/bin/rm /Library/Caches/com.purplecomputing.mdm/Apps/${dnldfile}
/bin/echo "Command: DeterminateManualStep: 1" >> ${deplog}