Skip to content

Commit 1953b10

Browse files
committed
v1.7
1 parent a6c9b03 commit 1953b10

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

HISTORY

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
November 8, 2018 v1.8
2+
- support for a High Sierra or Mojave install stub
3+
14
October 20, 2018 v1.7
25
- use Spotlight to find installers if no argument is given
36

osxapp_vers

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# osxapp_vers 1.7
3+
# osxapp_vers 1.8
44
# Get product name, product version and build version of [Mac] OS X
55
# from "Install*OS X*.app", "Install macOS *.app" or "Mac OS X install DVD"
66
#
@@ -122,32 +122,50 @@ else
122122
fi
123123

124124
if [ -f "$APPNAME/Contents/SharedSupport/BaseSystem.dmg" ]; then
125-
# Starting with High Sierra ...
126-
# Mount the BaseSystem.dmg
125+
# Starting with High Sierra (>= 10.13)
127126
hdiutil attach "$APPNAME/Contents/SharedSupport/BaseSystem.dmg" \
128127
-noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ &> $DEBUG
129-
else
130-
# Anything earlier then High Sierra ...
131-
# Mount the InstallESD.dmg
128+
129+
CONTCODE=1
130+
131+
elif [ -f "$APPNAME/Contents/SharedSupport/InstallESD.dmg" ]; then
132+
# Anything earlier then High Sierra (< 10.13) ...
132133
hdiutil attach "$APPNAME/Contents/SharedSupport/InstallESD.dmg" \
133134
-noverify -nobrowse -mountpoint /Volumes/InstallESD.$$ &> $DEBUG
134135

135-
# Mount the BaseSystem.dmg
136136
hdiutil attach "/Volumes/InstallESD.$$/BaseSystem.dmg" \
137137
-noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ &> $DEBUG
138+
139+
CONTCODE=2
140+
141+
elif [ -f "/macOS Install Data/BaseSystem.dmg" ]; then
142+
printf "INFO: this an install stub and the install stub was running.\n"
143+
# BaseSystem.dmg location is different if we have an install stub and
144+
# the install stub was running
145+
hdiutil attach "/macOS Install Data/BaseSystem.dmg" \
146+
-noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ &> $DEBUG
147+
148+
CONTCODE=1
149+
150+
else
151+
printf "ERROR: this seems to be an install stub only, run it in order to download the required files.\n"
152+
CONTCODE=0
153+
138154
fi
139155

140156
# call sw_vers in the changed root environment
141157
# sudo chroot "/Volumes/BaseSystem.$$" /usr/bin/sw_vers
142158

143-
# Read the xml and print info
144-
print_xml_info "/Volumes/BaseSystem.$$/System/Library/CoreServices/SystemVersion.plist"
159+
if [ $CONTCODE -gt 0 ]; then
160+
# Read the xml and print info
161+
print_xml_info "/Volumes/BaseSystem.$$/System/Library/CoreServices/SystemVersion.plist"
145162

146-
# Unmount again in reverse order
147-
hdiutil detach "/Volumes/BaseSystem.$$" &> $DEBUG
163+
# Unmount again in reverse order
164+
hdiutil detach "/Volumes/BaseSystem.$$" &> $DEBUG
148165

149-
if [ "$OSNAME" != "Mojave" -a "$OSNAME" != "High Sierra" ]; then
150-
hdiutil detach "/Volumes/InstallESD.$$" &> $DEBUG
166+
if [ $CONTCODE -gt 1 ]; then
167+
hdiutil detach "/Volumes/InstallESD.$$" &> $DEBUG
168+
fi
151169
fi
152170
fi
153171
done

0 commit comments

Comments
 (0)