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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
#!/bin/sh -e
test -n "${NMAP_VERSION}" || exit 1
export title="nmap-${NMAP_VERSION}"
export disk="/Volumes/${title}"
export backgroundPictureName="nmap.png"
export finalDMGName="${title}.dmg"
export applicationName="${title}.mpkg"
RES="True"
NB_FILES=7
hdiutil attach ${finalDMGName}
# Try to list files in the Volume, if we can't, its because its not ready yet
# so we should sleep while its mounted before trying to check if everything is ok
stop=false
while [ "$stop" = false ]; do
test=`ls -l /Volumes/${title}/ | wc -l`
if [ "$test" -eq $NB_FILES ]; then
stop=true
fi
sleep 1
done
echo "\nDisk: ${disk}"
echo "Checking positions...\n"
export MPKG=`echo '
tell application "Finder"
set f to POSIX file "'${disk}'/'${applicationName}'" as alias
get properties of f
end tell
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
export README=`echo '
tell application "Finder"
set f to POSIX file "'${disk}'/'$1'" as alias
get properties of f
end tell
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
export LICENSE=`echo '
tell application "Finder"
set f to POSIX file "'${disk}'/'$2'" as alias
get properties of f
end tell
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
export LICENSES_3RD=`echo '
tell application "Finder"
set f to POSIX file "'${disk}'/'$3'" as alias
get properties of f
end tell
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
export LICENSES=`echo '
tell application "Finder"
set f to POSIX file "'${disk}'/'$4'" as alias
get properties of f
end tell
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
if [ "$MPKG" = "$MPKG_POS_X, $MPKG_POS_Y" ]; then
echo "${applicationName}: OK"
else
echo "${applicationName}: Wrong"
RES="False"
fi;
if [ "$README" = "$README_POS_X, $README_POS_Y" ]; then
echo "README.md: OK"
else
echo "README.md: Wrong"
RES="False"
fi;
if [ "$LICENSE" = "$LICENSE_POS_X, $LICENSE_POS_Y" ]; then
echo "LICENSE: OK"
else
echo "LICENSE: Wrong"
RES="False"
fi;
if [ "$LICENSES_3RD" = "$THIRD_P_POS_X, $THIRD_P_POS_Y" ]; then
echo "3rd-party-licenses.txt: OK"
else
echo "3rd-party-licenses.txt: Wrong"
RES="False"
fi;
if [ "$LICENSES" = "$LICENSES_POS_X, $LICENSES_POS_Y" ]; then
echo "licenses: OK"
else
echo "licenses: Wrong"
RES="False"
fi;
export BG=`echo '
tell application "Finder"
set f to POSIX file "'${disk}'/.background/'${backgroundPictureName}'" as alias
if exists file f then
return true
else
return false
end if
end tell
' | osascript`
if [ "$BG" = "true" ]; then
echo "\nBackground exists: Yes\n"
else
echo "\nBackground exists: No\n"
RES="False"
fi;
hdiutil detach ${disk}
if [ "$RES" = "True" ]; then
echo "\nTest passed?: Yes\n"
exit 0
else
echo "\nTest passed?: No\nThere are some errors that should be corrected\n"
exit 1
fi;
|