-
Notifications
You must be signed in to change notification settings - Fork 58
/
Boot.st
94 lines (73 loc) · 3.54 KB
/
Boot.st
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
"Check for update to DBOOT itself"
(SessionManager current argv at: 3 ifAbsent: [nil]) = 'UpdateBoot' ifTrue: [
SourceManager default fileIn: 'Core\Object Arts\Dolphin\Base\Boot\Boot.st'.
]!
"Apply any patches not yet consolidated into the boot image that are required to load the system package"
SourceManager default fileIn: 'PreBoot.st'!
"Reload the base package constituents to reflect any changes since the boot image was created."
SourceManager default fileIn: 'Core\Object Arts\Dolphin\Base\Kernel.BootSessionManager.cls'!
SessionManager current updateBootImage!
"Install some bare bones packages to get the Installation Management system working"
Package manager install: 'Core\Object Arts\Dolphin\Registry\Dolphin Registry Access.pax'!
"We need this to install any packages containing binaries"
Package manager install: 'Core\Object Arts\Dolphin\System\Base64\Dolphin Base64.pax'!
"Set Dolphin package version and about operation"
Object owningPackage
packageVersion: VMLibrary default versionString!
Package manager install: 'Core\Object Arts\Dolphin\System\SemVer\Dolphin SemVer.pax'!
"Load standard Dolphin products"
Package manager install: 'Core\Object Arts\Dolphin\Installation Manager\Dolphin Products.pax'!
"If required, prompt to boot the desired end product"
| productName product isPrompted |
productName := SessionManager current argv at: 3 ifAbsent: [ | p |
"We'll need MVP bits in order to be able to display the choice prompter for the image version to boot"
Package manager install: 'Core\Object Arts\Dolphin\MVP\Presenters\Prompters\Dolphin Choice Prompter.pax'.
p := (Smalltalk at: #ChoicePrompter)
choices: (Tools.DolphinProduct allSubclasses reject: [:each | each isAbstract])
caption: 'Product to boot...'.
p isNil ifTrue: [SessionManager current quit: -1].
isPrompted := true.
p name].
[product := Tools at: productName asSymbol ifAbsent: [ | path |
path := SessionManager current argv at: 4.
Package manager install: path.
Tools at: productName asSymbol].
SessionManager current saveImage: (File fullPathOf: product shortProductName).
Notification signal: 'Booting ', product name.
product boot] on: Error do: [:ex |
"isPrompted==true ifFalse: [SessionManager current quit: -2]."
ex pass ] !
"Ensure all structures have calculated size to avoid recompilation messages later"
ExternalStructure allSubclasses do: [:e | e ensureDefined]!
SessionManager current bootFinished!
Tools.DevelopmentSessionManager installNew!
SessionManager current defaultResourceLibrary loadFlags: 0!
| semver sesh |
semver := [ | process outputPipe |
process := ExternalProcess new.
process commandLine: 'git describe --tags --long --always'.
outputPipe := process stdoutPipe.
process executeSync.
[process isTerminated] whileFalse: [].
SemVer fromGitDescription: outputPipe readStream contents
] on: ExternalProcessExecuteError do: [:ex | nil].
DolphinProduct current version: semver.
sesh := SessionManager current.
sesh bootInfo: semver.
"Patch up the messed up version inserted by DolphinProduct classes"
sesh productDetails at: #productVersionString put: (VMLibrary default defaultProductDetails at: #productVersionString)!
"Mark all the booted packages as base"
Package manager markAllPackagesAsBase!
"Save the booted image"
| devsesh |
SourceManager default flushChanges.
devsesh := SessionManager current.
devsesh onPreSaveImage.
[devsesh primSnapshot: devsesh imageFileName
backup: false
type: 0
maxObjects: 24576*1024
] ensure: [devsesh onPostSaveImage]!
"Remove unnecessary .chg files"
File delete: 'DBOOT.chg'!
SessionManager current onExit; primQuit: 0!