depot3 0.0.0a1 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -1
- data/bin/d3 +323 -0
- data/bin/d3admin +1011 -0
- data/bin/d3helper +354 -0
- data/bin/puppytime +334 -0
- data/data/d3/com.pixar.d3.RepoMan.plist +23 -0
- data/data/d3/d3.conf.example +507 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftAppKit.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCore.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreData.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreGraphics.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreImage.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDarwin.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDispatch.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftFoundation.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftObjectiveC.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Info.plist +56 -0
- data/data/d3/d3RepoMan.app/Contents/MacOS/d3RepoMan +0 -0
- data/data/d3/d3RepoMan.app/Contents/PkgInfo +1 -0
- data/data/d3/d3RepoMan.app/Contents/Resources/Base.lproj/MainMenu.nib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Resources/last-foreground-times-template.plist +5 -0
- data/data/d3/d3RepoMan.app/Contents/_CodeSignature/CodeResources +214 -0
- data/data/d3/puppytime/ImageLicenses.txt +165 -0
- data/data/d3/puppytime/notification_image +1 -0
- data/data/d3/puppytime/opt_out_image +1 -0
- data/data/d3/puppytime/slideshow/2008-07-11_White_German_Shepherd_pup_chilling_at_the_Coker_Arboretum.jpg +0 -0
- data/data/d3/puppytime/slideshow/2009-04-21_APBT_pup_on_deck.jpg +0 -0
- data/data/d3/puppytime/slideshow/A_puppy_Yorkie.jpg +0 -0
- data/data/d3/puppytime/slideshow/Alert_Pug_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Australian_Cattle_Dog_puppies_04.JPG +0 -0
- data/data/d3/puppytime/slideshow/Beagle_puppy_Cadet.jpg +0 -0
- data/data/d3/puppytime/slideshow/Bernese_Mountain_Dog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Bloodhound_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Boston_terrier_with_toy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Boxer_puppy_fawn_portrai.jpg +0 -0
- data/data/d3/puppytime/slideshow/Caracal_kitten.jpg +0 -0
- data/data/d3/puppytime/slideshow/Chihuahua_&_Doberman_Pup.jpg +0 -0
- data/data/d3/puppytime/slideshow/Cuccioli_di_Margot_a_35_gg_Basenjis.jpg +0 -0
- data/data/d3/puppytime/slideshow/Dalmatian_puppy_03.jpg +0 -0
- data/data/d3/puppytime/slideshow/GoldenRetrieverPuppyDaisyParker.JPG +0 -0
- data/data/d3/puppytime/slideshow/Green_eyed_beige_Chihuahua.jpg +0 -0
- data/data/d3/puppytime/slideshow/Let_Sleeping_Dogs_Lie.jpg +0 -0
- data/data/d3/puppytime/slideshow/Meatball_-_French_Bulldog_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Oola_-_9_weeks.jpg +0 -0
- data/data/d3/puppytime/slideshow/Pancho0008.JPG +0 -0
- data/data/d3/puppytime/slideshow/Pomeranian_orange-sable_Coco.jpg +0 -0
- data/data/d3/puppytime/slideshow/Pug_puppy_001.jpg +0 -0
- data/data/d3/puppytime/slideshow/Puggle_puppy_6_weeks.JPG +0 -0
- data/data/d3/puppytime/slideshow/Puli_kan.jpg +0 -0
- data/data/d3/puppytime/slideshow/Puppy_French_Bulldog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Rocco_the_Bulldog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Rottweiler_Face.jpg +0 -0
- data/data/d3/puppytime/slideshow/Saint_Bernard_puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Scottish_froment.jpg +0 -0
- data/data/d3/puppytime/slideshow/Shar_pei_puppy_(age_2_months).jpg +0 -0
- data/data/d3/puppytime/slideshow/Shiba-Inu_beim_Spielen_im_Schnee.JPG +0 -0
- data/data/d3/puppytime/slideshow/Smooth-coat_Border_Collie_puppy..jpg +0 -0
- data/data/d3/puppytime/slideshow/Smooth_Dachshund_puppies.jpg +0 -0
- data/data/d3/puppytime/slideshow/Snow_dog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Taylor_the_Pembroke_Welsh_Corgi.png +0 -0
- data/data/d3/puppytime/slideshow/Weim_Pups_001.jpg +0 -0
- data/data/d3/puppytime/slideshow/Westie_pups.jpg +0 -0
- data/data/d3/puppytime/slideshow/Yellow_Labrador_puppies_(4165737325).jpg +0 -0
- data/lib/d3/admin/add.rb +451 -0
- data/lib/d3/admin/auth.rb +470 -0
- data/lib/d3/admin/edit.rb +297 -0
- data/lib/d3/admin/help.rb +396 -0
- data/lib/d3/admin/interactive.rb +972 -0
- data/lib/d3/admin/options.rb +454 -0
- data/lib/d3/admin/prefs.rb +204 -0
- data/lib/d3/admin/report.rb +727 -0
- data/lib/d3/admin/state.rb +42 -0
- data/lib/d3/admin/validate.rb +413 -0
- data/lib/d3/admin.rb +42 -0
- data/lib/d3/basename.rb +217 -0
- data/lib/d3/client/auth.rb +108 -0
- data/lib/d3/client/class_methods.rb +766 -0
- data/lib/d3/client/class_variables.rb +47 -0
- data/lib/d3/client/cli.rb +187 -0
- data/lib/d3/client/environment.rb +134 -0
- data/lib/d3/client/help.rb +110 -0
- data/lib/d3/client/lists.rb +314 -0
- data/lib/d3/client/receipt.rb +1173 -0
- data/lib/d3/client.rb +45 -0
- data/lib/d3/configuration.rb +319 -0
- data/lib/d3/constants.rb +60 -0
- data/lib/d3/database.rb +488 -0
- data/lib/d3/exceptions.rb +44 -0
- data/lib/d3/log.rb +271 -0
- data/lib/d3/package/aliases.rb +80 -0
- data/lib/d3/package/attributes.rb +97 -0
- data/lib/d3/package/class_methods.rb +817 -0
- data/lib/d3/package/class_variables.rb +46 -0
- data/lib/d3/package/client_actions.rb +293 -0
- data/lib/d3/package/constants.rb +58 -0
- data/lib/d3/package/constructor.rb +191 -0
- data/lib/d3/package/getters.rb +164 -0
- data/lib/d3/package/mixins.rb +39 -0
- data/lib/d3/package/private_methods.rb +227 -0
- data/lib/d3/package/questions.rb +95 -0
- data/lib/d3/package/server_actions.rb +683 -0
- data/lib/d3/package/setters.rb +326 -0
- data/lib/d3/package/validate.rb +448 -0
- data/lib/d3/package.rb +51 -0
- data/lib/d3/puppytime/pending_puppy.rb +108 -0
- data/lib/d3/puppytime/puppy_queue.rb +274 -0
- data/lib/d3/puppytime.rb +68 -0
- data/lib/d3/state.rb +105 -0
- data/lib/d3/utility.rb +325 -0
- data/lib/d3/version.rb +1 -1
- metadata +162 -9
@@ -0,0 +1,297 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
|
26
|
+
module D3
|
27
|
+
module Admin
|
28
|
+
module Edit
|
29
|
+
extend self
|
30
|
+
|
31
|
+
### These are all the options that can be edited for an existing d3 package.
|
32
|
+
# This also defines the order they're presented when editing via walkthru.
|
33
|
+
#
|
34
|
+
# This is defined as an array, separate from the keys of PKG_ATTRIBUTE_CONFIG
|
35
|
+
#
|
36
|
+
EDITING_OPTIONS = %w{
|
37
|
+
version
|
38
|
+
revision
|
39
|
+
package_name
|
40
|
+
filename
|
41
|
+
category
|
42
|
+
oses
|
43
|
+
cpu_type
|
44
|
+
reboot
|
45
|
+
removable
|
46
|
+
remove_first
|
47
|
+
prohibiting_process
|
48
|
+
auto_groups
|
49
|
+
excluded_groups
|
50
|
+
pre_install
|
51
|
+
post_install
|
52
|
+
pre_remove
|
53
|
+
post_remove
|
54
|
+
expiration
|
55
|
+
expiration_path
|
56
|
+
description
|
57
|
+
}.map{|i| i.to_sym}
|
58
|
+
|
59
|
+
### This is how nils and empty strings are displayed to the user
|
60
|
+
NONE = "none"
|
61
|
+
|
62
|
+
### Continuously loop through displaying the editing menu, and getting
|
63
|
+
### new values, until the user types 'x'.
|
64
|
+
###
|
65
|
+
### @param pkg[D3::Package] the package being edited
|
66
|
+
###
|
67
|
+
### @return [Hash] A hash of changes to make to the pkg. Keys are the option
|
68
|
+
### symbols from EDITING_OPTIONS, values are new values
|
69
|
+
###
|
70
|
+
def loop_thru_editing_walkthru (pkg)
|
71
|
+
|
72
|
+
editing_walkthru_state = initial_editing_walkthru_state(pkg)
|
73
|
+
|
74
|
+
walkthru_menu_header = <<-ENDMENU
|
75
|
+
------------------------------------
|
76
|
+
Editing #{pkg.status} d3 package '#{pkg.edition}'
|
77
|
+
JSS Package id: #{pkg.id}
|
78
|
+
JSS Package name: #{pkg.package_name}
|
79
|
+
Installer filename: #{pkg.filename}
|
80
|
+
------------------------------------
|
81
|
+
Current Settings => New Settings
|
82
|
+
ENDMENU
|
83
|
+
|
84
|
+
choice = nil
|
85
|
+
|
86
|
+
# loop until the user types an x
|
87
|
+
while choice != "x"
|
88
|
+
|
89
|
+
choice = D3::Admin::Interactive.get_menu_choice( walkthru_menu_header, walkthru_menu_lines(editing_walkthru_state) )
|
90
|
+
|
91
|
+
break if choice == 'x'
|
92
|
+
|
93
|
+
# the number they chose becomes an option key like :reboot
|
94
|
+
chosen_opt = EDITING_OPTIONS[choice]
|
95
|
+
|
96
|
+
# Here's the definition of the option from the OPTIONS hash
|
97
|
+
opt_def = D3::Admin::OPTIONS[chosen_opt]
|
98
|
+
|
99
|
+
# Here the value we're actually editing
|
100
|
+
orig_opt_value = editing_walkthru_state[chosen_opt][:original_value]
|
101
|
+
orig_opt_value ||= opt_def[:default]
|
102
|
+
|
103
|
+
# prompt for a new value and put it in place
|
104
|
+
editing_walkthru_state[chosen_opt][:new_value] = D3::Admin::Interactive.get_value( chosen_opt, orig_opt_value )
|
105
|
+
|
106
|
+
|
107
|
+
end # while choice != x
|
108
|
+
|
109
|
+
# extract just the changes to make
|
110
|
+
changes_to_make = {}
|
111
|
+
editing_walkthru_state.each do |opt, data|
|
112
|
+
comparer = D3::Admin::OPTIONS[opt][:compare]
|
113
|
+
if comparer
|
114
|
+
next if (comparer.call data[:original_value], data[:new_value])
|
115
|
+
else
|
116
|
+
next if (data[:original_value].to_s == data[:new_value].to_s)
|
117
|
+
end
|
118
|
+
changes_to_make[opt] = data[:new_value]
|
119
|
+
end # editing_walkthru_state.each do |opt, data|
|
120
|
+
|
121
|
+
return changes_to_make
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
### A hash of hashes holding the state of the various options
|
126
|
+
### of a pkg that can be edited during a walkthru.
|
127
|
+
###
|
128
|
+
### For each editable option it holds:
|
129
|
+
### - the original value of the option from the pkg
|
130
|
+
### - the textual-display version of that value, as created by the matching
|
131
|
+
### :display_conversion proc in D3::Admin::EDITING_OPTION_INFO
|
132
|
+
### - The the new value when the user makes a change.
|
133
|
+
###
|
134
|
+
### @param pkg[D3::Package] the pkg being edited
|
135
|
+
###
|
136
|
+
### @return [Hash] the walkthru-editing values for the pkg
|
137
|
+
###
|
138
|
+
def initial_editing_walkthru_state (pkg)
|
139
|
+
editing_walkthru_state = {}
|
140
|
+
EDITING_OPTIONS.each do |o|
|
141
|
+
original_value = pkg.send(o)
|
142
|
+
converter = D3::Admin::OPTIONS[o][:display_conversion]
|
143
|
+
editing_walkthru_state[o] = {
|
144
|
+
:original_value => original_value,
|
145
|
+
:original_value_display => converter ? converter.call(original_value) : original_value,
|
146
|
+
:new_value => original_value
|
147
|
+
} # end hash
|
148
|
+
# set orig value displays that are empty to 'none'
|
149
|
+
editing_walkthru_state[o][:original_value_display] = NONE if editing_walkthru_state[o][:original_value_display].to_s.empty?
|
150
|
+
end # EDITING_OPTIONS.each do |o|
|
151
|
+
return editing_walkthru_state
|
152
|
+
end
|
153
|
+
|
154
|
+
### Regenerate the walkthru menu lines
|
155
|
+
###
|
156
|
+
### @param editing_walkthru_state[Hash] the current state of the values being edited
|
157
|
+
###
|
158
|
+
### @return [Array<String>] the lines of the walkthru menu
|
159
|
+
###
|
160
|
+
def walkthru_menu_lines (editing_walkthru_state)
|
161
|
+
|
162
|
+
display_lines = []
|
163
|
+
EDITING_OPTIONS.each do |opt|
|
164
|
+
# opt is the option symbol, like :reboot
|
165
|
+
opt_def = D3::Admin::OPTIONS[opt]
|
166
|
+
label = opt_def[:label]
|
167
|
+
converter = opt_def[:display_conversion]
|
168
|
+
|
169
|
+
# did the thing change?
|
170
|
+
# compare the old and new either with .to_s and ==
|
171
|
+
# or with the :compare proc defined in EDITING_OPTION_INFO
|
172
|
+
if opt_def[:compare]
|
173
|
+
option_didnt_change = (opt_def[:compare].call editing_walkthru_state[opt][:original_value], editing_walkthru_state[opt][:new_value])
|
174
|
+
else
|
175
|
+
option_didnt_change = (editing_walkthru_state[opt][:original_value].to_s == editing_walkthru_state[opt][:new_value].to_s)
|
176
|
+
end
|
177
|
+
|
178
|
+
# no change, so just display the orig value
|
179
|
+
if option_didnt_change
|
180
|
+
val_to_display = editing_walkthru_state[opt][:original_value_display]
|
181
|
+
|
182
|
+
# But if the new val is different, convert it if needed, then show it as "orig => new"
|
183
|
+
else
|
184
|
+
new_value_display = converter ? converter.call(editing_walkthru_state[opt][:new_value]) : editing_walkthru_state[opt][:new_value]
|
185
|
+
new_value_display = NONE if new_value_display.to_s.empty?
|
186
|
+
val_to_display = "#{editing_walkthru_state[opt][:original_value_display]} => #{new_value_display}"
|
187
|
+
end
|
188
|
+
|
189
|
+
# make the line and add it to the array of lines
|
190
|
+
display_lines << "#{label}: #{val_to_display}"
|
191
|
+
end
|
192
|
+
return display_lines
|
193
|
+
end # def update_editing_display_lines(editing_options)
|
194
|
+
|
195
|
+
### Validate the desired edits from the CLI options
|
196
|
+
###
|
197
|
+
### @param cli_options[OpenStruct] the options from the CLI
|
198
|
+
###
|
199
|
+
### @return [Hash] A hash of changes to make to the pkg. Keys are the option
|
200
|
+
### symbols from EDITING_OPTIONS, values are new values
|
201
|
+
###
|
202
|
+
def validate_cli_edits (cli_options)
|
203
|
+
changes_to_make = {}
|
204
|
+
EDITING_OPTIONS.each do |opt|
|
205
|
+
if cli_options[opt]
|
206
|
+
opt_check = D3::Admin::OPTIONS[opt][:validate]
|
207
|
+
if opt_check
|
208
|
+
changes_to_make[opt] = D3::Admin::Validate.send(opt_check, cli_options[opt])
|
209
|
+
else
|
210
|
+
changes_to_make[opt] = cli_options[opt]
|
211
|
+
end
|
212
|
+
end # if @options[opt]
|
213
|
+
end #.each do |opt|
|
214
|
+
changes_to_make
|
215
|
+
end
|
216
|
+
|
217
|
+
### Before making edits, check the possibly new edition in two ways:
|
218
|
+
### 1) that it doesn't conflict with another edition in d3
|
219
|
+
### 2) if the original package name contained the original edition
|
220
|
+
### and the edition has changed, change the package name to match.
|
221
|
+
###
|
222
|
+
### Raises an exception if there are edition conflicts
|
223
|
+
###
|
224
|
+
### @param pkg[D3::Package] the package we're editing
|
225
|
+
###
|
226
|
+
### @param changes_to_make[Hash] the changes we want to make
|
227
|
+
###
|
228
|
+
### @return [Hash] changes_to_make with a possibly new :name
|
229
|
+
###
|
230
|
+
def check_new_edition (pkg, changes_to_make)
|
231
|
+
new_vers = changes_to_make[:version]
|
232
|
+
new_rev = changes_to_make[:revision]
|
233
|
+
if new_vers or new_rev
|
234
|
+
potential_edition = "#{pkg.basename}-#{new_vers ? new_vers : pkg.version}-#{new_rev ? new_rev : pkg.revision}"
|
235
|
+
unless pkg.edition == potential_edition
|
236
|
+
# edition conflict?
|
237
|
+
if D3::Package.all_editions.include? potential_edition
|
238
|
+
raise JSS::AlreadyExistsError, "Can't change version or revision as requested: edition conflict with #{potential_edition}"
|
239
|
+
end
|
240
|
+
|
241
|
+
# name syncing?
|
242
|
+
if pkg.name.include? pkg.edition
|
243
|
+
changes_to_make[:package_name] = pkg.name.sub(pkg.edition, potential_edition ) unless changes_to_make[:package_name]
|
244
|
+
end
|
245
|
+
end # unless
|
246
|
+
end # if new_vers or new_rev
|
247
|
+
|
248
|
+
return changes_to_make
|
249
|
+
end
|
250
|
+
|
251
|
+
### Before making edits, confirm that the possibly new auto
|
252
|
+
### or excluded groups don't overlap with each other.
|
253
|
+
###
|
254
|
+
### Raises an exception if there are overlaps
|
255
|
+
###
|
256
|
+
### @param pkg[D3::Package] the package we're editing
|
257
|
+
###
|
258
|
+
### @param changes_to_make[Hash] the changes we want to make
|
259
|
+
###
|
260
|
+
### @return [void]
|
261
|
+
###
|
262
|
+
def check_for_new_group_overlaps (pkg, changes_to_make)
|
263
|
+
new_auto_gs = changes_to_make[:auto_groups]
|
264
|
+
new_excl_gs = changes_to_make[:excluded_groups]
|
265
|
+
bad_groups = []
|
266
|
+
if new_excl_gs and new_auto_gs
|
267
|
+
bad_groups = new_excl_gs & new_auto_gs
|
268
|
+
elsif new_excl_gs
|
269
|
+
bad_groups = new_excl_gs & pkg.auto_groups
|
270
|
+
elsif new_auto_gs
|
271
|
+
bad_groups = new_auto_gs & pkg.excluded_groups
|
272
|
+
end
|
273
|
+
raise "Auto and Excluded groups can't overlap!" unless bad_groups.empty?
|
274
|
+
true
|
275
|
+
end
|
276
|
+
|
277
|
+
### Make the changes that have been requested with an edit
|
278
|
+
###
|
279
|
+
### @param pkg[D3::Package] the package we're editing
|
280
|
+
###
|
281
|
+
### @param changes_to_make[Hash] the changes we want to make
|
282
|
+
###
|
283
|
+
### @return [void]
|
284
|
+
###
|
285
|
+
def process_edits (pkg, changes_to_make)
|
286
|
+
changes_to_make.each do |opt, new_val|
|
287
|
+
setter = (opt.to_s + "=").to_sym
|
288
|
+
pkg.send setter, new_val
|
289
|
+
end
|
290
|
+
pkg.save
|
291
|
+
pkg.update_master_filename D3::Admin::Auth.rw_credentials(:dist)[:password] if changes_to_make[:filename]
|
292
|
+
end
|
293
|
+
|
294
|
+
end # module edit
|
295
|
+
end # module Admin
|
296
|
+
end # module D3
|
297
|
+
|
@@ -0,0 +1,396 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
|
26
|
+
module D3
|
27
|
+
module Admin
|
28
|
+
# This just exists to get the very lengthy help texts out of the d3admin and
|
29
|
+
# d3 executables.
|
30
|
+
module Help
|
31
|
+
extend self
|
32
|
+
|
33
|
+
USAGE = "Usage: d3admin action target [options]"
|
34
|
+
|
35
|
+
### Return the d3amin help text
|
36
|
+
###
|
37
|
+
### @return [String] the d3admin help text
|
38
|
+
###
|
39
|
+
def help_text
|
40
|
+
helptxt = <<-ENDHELP
|
41
|
+
|
42
|
+
#{USAGE}
|
43
|
+
|
44
|
+
=== Actions <target> ===
|
45
|
+
|
46
|
+
add <basename> Add a new pilot package
|
47
|
+
edit <basename/edition> Change properties of existing package
|
48
|
+
live <edition> Make existing pilot package live
|
49
|
+
delete <basename/edition> Delete a package
|
50
|
+
info <basename/edition> Show details of an package
|
51
|
+
search <basename/group> List matching pkgs on the server
|
52
|
+
report <basename/computer> Report about receipts on computers
|
53
|
+
config <setting/display> d3admin configutation on this machine
|
54
|
+
help Show this help.
|
55
|
+
|
56
|
+
=== Options ===
|
57
|
+
|
58
|
+
General:
|
59
|
+
-w, --walkthru Interactively prompt for all options.
|
60
|
+
-a, --auto-confirm Don't ask for confirmation before acting
|
61
|
+
-h, --help Show this help text
|
62
|
+
-H, --extended-help Show extended help
|
63
|
+
-D, --debug Show debug info and ruby backtraces
|
64
|
+
|
65
|
+
Action add:
|
66
|
+
-i, --import <name or id> Import an existing JSS package
|
67
|
+
-W, --workspace <path> Folder in which to build .dmgs & .pkgs
|
68
|
+
-I, --no-inherit Don't inherit values from last package
|
69
|
+
-s, --source-path <path> Path to a .pkg, .dmg, or root-folder
|
70
|
+
--dmg Build a .dmg, rather than a .pkg
|
71
|
+
--preserve-owners Keep the ownership of contents in built .pkgs
|
72
|
+
-p, --pkg-id <pkgid> Apple pkg-identifier for built .pkgs
|
73
|
+
|
74
|
+
Action add and edit:
|
75
|
+
-v, --version <version> Version of the thing installed
|
76
|
+
-r, --revision <revision> Sequential packaging of the same version
|
77
|
+
-n, --package-name <name> The JSS 'display name' of the package
|
78
|
+
-f, --filename <name> The filename on the distribution point
|
79
|
+
-d, --description <desc> A textual description of this package
|
80
|
+
-e, --pre-install <script> Name, id, or path to pre-install script
|
81
|
+
-t, --post-install <script> Name, id, or path to post-install script
|
82
|
+
-E, --pre-remove <script> Name, id, or path to pre-remove script
|
83
|
+
-T, --post-remove <script> Name, id, or path to post-remove script
|
84
|
+
-g, --auto-groups <groups> Computer groups to get this pkg automatically
|
85
|
+
-G, --excluded-groups <groups> Computer groups that can't see this pkg
|
86
|
+
-x, --prohibiting-process <proc> Process name that prevents installation
|
87
|
+
-R, --reboot <y/n> Reboot required after install, puppies!
|
88
|
+
-F, --remove-first <y/n> Uninstall older versions before installing
|
89
|
+
-u, --removable <y/n> Can this package be uninstalled?
|
90
|
+
-o, --oses <oses> OS limitations for installation.
|
91
|
+
-c, --cpu <type> Limit installation to 'intel' or 'ppc'
|
92
|
+
-C, --category <category> The JSS Category for this package
|
93
|
+
-X, --expiration <days> Auto-uninstall if unused for <days>
|
94
|
+
-P, --expiration-path <path> Path to executable that must be used
|
95
|
+
|
96
|
+
Action delete:
|
97
|
+
--delete-scripts Delete scripts associated with this pkg
|
98
|
+
--keep-in-jss Delete from d3 but leave in the JSS
|
99
|
+
|
100
|
+
Action search or report:
|
101
|
+
-S, --status <status> Limit package list to this status
|
102
|
+
--groups Target is a group name. Shows packages
|
103
|
+
auto-installed or excluded for group
|
104
|
+
|
105
|
+
Action report:
|
106
|
+
-S, --status <status> Limit receipt list to this status
|
107
|
+
-z, --frozen Limit receipt list to frozen receipts
|
108
|
+
-q, --queue List puppy queue items rather than rcpts
|
109
|
+
--computers Target is a computer name. Reports
|
110
|
+
rcpts/puppies on that computer.
|
111
|
+
|
112
|
+
For details use -H or --extended-help
|
113
|
+
|
114
|
+
See also: https://github.com/PixarAnimationStudios/depot3/wiki/Admin
|
115
|
+
|
116
|
+
ENDHELP
|
117
|
+
end # help text
|
118
|
+
|
119
|
+
|
120
|
+
### Return the d3amin help text
|
121
|
+
###
|
122
|
+
### @return [String] the d3admin help text
|
123
|
+
###
|
124
|
+
def extended_help_text
|
125
|
+
helptxt = <<-ENDHELP
|
126
|
+
|
127
|
+
d3admin is a tool for administering packages in d3, a package/patch
|
128
|
+
management & deployment tool that enhances the package-handling capabilities
|
129
|
+
of the Casper Suite from JAMF Software, LLC.
|
130
|
+
|
131
|
+
For detailed documentation see:
|
132
|
+
https://github.com/PixarAnimationStudios/depot3/wiki/Admin
|
133
|
+
|
134
|
+
Important Terms:
|
135
|
+
|
136
|
+
- basename: A word used to identify all packages that install any version of
|
137
|
+
the same thing. E.g. 'filemaker' or 'transmogrifier' When a
|
138
|
+
basename is used to specify a package, it refers to the currently
|
139
|
+
live package for the basename. (see below)
|
140
|
+
|
141
|
+
- edition: A unique identifier for a package or receipt in d3. It is made of
|
142
|
+
the basename, version, and revision, joined by dashes.
|
143
|
+
E.g. 'transmogrifier-2.2.1-2'
|
144
|
+
Editions specify individual packages regardless of their status.
|
145
|
+
|
146
|
+
- live: Each edition has a status: pilot, live, skipped, deprecated, or
|
147
|
+
missing. Only one edition per basename can be 'live' a a time.
|
148
|
+
When an edition is made live, it's approved for general deployment
|
149
|
+
and is the edition installed with 'd3 install <basename>'. It will
|
150
|
+
also auto-install on computers in the packages auto-groups, and it
|
151
|
+
will auto-update on any computers with older editions of the same
|
152
|
+
basename already installed.
|
153
|
+
|
154
|
+
- walkthru: Any action can take the --walkthru option and you'll be prompted
|
155
|
+
for targets (if needed) and options.
|
156
|
+
Without --walkthru, you must provide all values with command-line
|
157
|
+
options. Anything not on the command-line will use a default or
|
158
|
+
inherited value, or cause an error if the option was required.
|
159
|
+
|
160
|
+
#{USAGE}
|
161
|
+
|
162
|
+
When refering to a package on the server, a basename imples the currently live
|
163
|
+
edition for that basename. Refering to a package by edition specifies an
|
164
|
+
individual package regardless of status.
|
165
|
+
|
166
|
+
|
167
|
+
=== Actions and their required targets & options ===
|
168
|
+
|
169
|
+
add Add a new pilot package to d3
|
170
|
+
Target = basename unless -w
|
171
|
+
Without -w, requires -v, -r, & -s
|
172
|
+
|
173
|
+
edit Change properties of existing package in d3
|
174
|
+
Target = basename or edition unless -w
|
175
|
+
|
176
|
+
live Make existing pilot package live
|
177
|
+
Target = edition unless -w
|
178
|
+
|
179
|
+
delete Delete an existing package from d3
|
180
|
+
Target = basename or edition unless -w
|
181
|
+
|
182
|
+
info Show details of an package in d3
|
183
|
+
Target = basename or edition unless -w
|
184
|
+
|
185
|
+
search Search for and list packages in d3.
|
186
|
+
Target = search text (RegExp matching)
|
187
|
+
No target = list all packages unless -w
|
188
|
+
|
189
|
+
report Report about d3 receipts or puppies on computers.
|
190
|
+
Target = basename, or computer name unless -w
|
191
|
+
|
192
|
+
config Set up server info and default values for d3admin.
|
193
|
+
Target = all, jss, db, dist, workspace,
|
194
|
+
pkg-id-prefix or display. Defaults to all
|
195
|
+
|
196
|
+
Using 'display' prints out the current admin config settings.
|
197
|
+
|
198
|
+
Runs 'all' automatically on first run.
|
199
|
+
|
200
|
+
help Show this help. Use -H for extended help.
|
201
|
+
|
202
|
+
|
203
|
+
NOTE: Any action that requires stored passwords will prompt for your
|
204
|
+
keychain password if your login keychain is currently locked.
|
205
|
+
|
206
|
+
=== Options ===
|
207
|
+
|
208
|
+
Non-required options for add will use inherited or default values if unspecified.
|
209
|
+
|
210
|
+
General:
|
211
|
+
|
212
|
+
-w, --walkthru Interactively prompt for all options.
|
213
|
+
Options provided on the commandline are
|
214
|
+
ignored. Without -w, anything NOT provided
|
215
|
+
on the command-line will use a default or
|
216
|
+
inherited value or will raise an error.
|
217
|
+
|
218
|
+
-a, --auto-confirm Don't ask for confirmation before making
|
219
|
+
changes. For use in automation.
|
220
|
+
BE VERY CAREFUL
|
221
|
+
|
222
|
+
-H, --help Show this help text
|
223
|
+
|
224
|
+
-D, --debug Show LOTS of debugging info about whats
|
225
|
+
happening. If there's a Ruby error,
|
226
|
+
show the backtrace. Useful when reporting
|
227
|
+
problems.
|
228
|
+
|
229
|
+
Action add:
|
230
|
+
|
231
|
+
-i, --import <name or id> When the action is 'add', import an existing
|
232
|
+
JSS package into d3 by display-name or id.
|
233
|
+
Requires -w or -v & -r
|
234
|
+
|
235
|
+
-W, --workspace <path> Folder in which to build .dmgs & .pkgs
|
236
|
+
default is your home folder.
|
237
|
+
Preserved between uses of d3admin.
|
238
|
+
|
239
|
+
-I, --no-inherit Don't inherit default values from most
|
240
|
+
recent package with the same basename.
|
241
|
+
|
242
|
+
-s, --source-path <path> Path to a .pkg, .dmg, or root-folder
|
243
|
+
from which to build one
|
244
|
+
|
245
|
+
--dmg When building from a root folder, build
|
246
|
+
a .dmg, rather than the default .pkg
|
247
|
+
|
248
|
+
--preserve-owners When building .pkgs, keep the ownership of
|
249
|
+
the pkg-root folder. Default is to let
|
250
|
+
the OS set ownership to standards based
|
251
|
+
upon where items are installed.
|
252
|
+
|
253
|
+
-p, --pkg-id <pkgid> When building .pkgs, the apple package
|
254
|
+
identifier, e.g. 'com.mycompany.app'
|
255
|
+
Defaults to a prefix, plus the basename.
|
256
|
+
The prefix is either the the apple_pkg_id_prefix
|
257
|
+
setting from the d3admin config, or
|
258
|
+
'#{D3::Admin::DFT_PKG_ID_PREFIX}'
|
259
|
+
|
260
|
+
Action add and edit:
|
261
|
+
|
262
|
+
-v, --version <version> Version of the thing installed by the
|
263
|
+
package, e.g. "2.5", "1.1a3".
|
264
|
+
May not contain a '-', which will be
|
265
|
+
converted to '_'
|
266
|
+
|
267
|
+
-r, --revision <revision> Package-revision.
|
268
|
+
This integer represents how many times
|
269
|
+
a particular version of a basename has
|
270
|
+
been added to d3.
|
271
|
+
|
272
|
+
-n, --package-name <name> The JSS 'display name' of the package.
|
273
|
+
Must be unique in the JSS
|
274
|
+
Defaults to <edition>.<pkg_type>
|
275
|
+
e.g. myapp-2.3a1-2.pkg
|
276
|
+
|
277
|
+
-f, --filename The name of the installer file on the
|
278
|
+
master distribution point. When uploading,
|
279
|
+
the file will be renamed to this.
|
280
|
+
If the installer is a .pkg bundle, it
|
281
|
+
will be zipped, and '.zip' appended
|
282
|
+
automatically when uploaded.
|
283
|
+
Defaults to <edition>.<pkg_type>
|
284
|
+
e.g. myapp-2.3a1-2.pkg
|
285
|
+
|
286
|
+
-d, --description <desc> A textual description of this package,
|
287
|
+
and any notes or comments about it.
|
288
|
+
|
289
|
+
-e, --pre-install <script> The name or id of an existing JSS script,
|
290
|
+
or the path to a file with a new script.
|
291
|
+
This script is run before installing.
|
292
|
+
Use "n" for 'none'.
|
293
|
+
See the full documentation for details.
|
294
|
+
|
295
|
+
-t, --post-install <script> As for pre-install, but the script to run
|
296
|
+
after installing the package.
|
297
|
+
|
298
|
+
-E, --pre-remove <script> As for pre-install, but the script to run
|
299
|
+
before uninstalling the package.
|
300
|
+
|
301
|
+
-T, --post-remove <script> As for pre-install, but the script to run
|
302
|
+
after uninstalling the package.
|
303
|
+
|
304
|
+
-g, --auto-groups <groups> Comma-separated list of JSS computer groups
|
305
|
+
whose members get this pkg automatically.
|
306
|
+
Use '#{D3::STANDARD_AUTO_GROUP}'
|
307
|
+
to install on all machines.
|
308
|
+
Use "n" for 'none'.
|
309
|
+
|
310
|
+
-G, --excluded-groups <groups> Comma-separated list of JSS computer groups
|
311
|
+
whose members can't install this pkg
|
312
|
+
without using force.
|
313
|
+
Use "n" for 'none'.
|
314
|
+
|
315
|
+
-x, --prohibiting-process <proc> Specify a name to match with process names
|
316
|
+
as output by `/bin/ps -A -c -o comm`.
|
317
|
+
If a match is found at install time,
|
318
|
+
prevents installation. Use "n" for 'none'
|
319
|
+
|
320
|
+
-R, --reboot <y/n> Reboot is required after install.
|
321
|
+
(PuppyTime!)
|
322
|
+
Default is 'n'
|
323
|
+
|
324
|
+
-u, --removable <y/n> Can this package be uninstalled?
|
325
|
+
Default is 'y'
|
326
|
+
|
327
|
+
-F, --remove-first <y/n> Uninstall older versions before installing
|
328
|
+
this one, if they are removable.
|
329
|
+
Default is 'n' (installs over the top)
|
330
|
+
|
331
|
+
-o, --oses <oses> Comma-separated list of OS version to allow
|
332
|
+
installation of this package.
|
333
|
+
e.g. 10.5.8, 10.6.x
|
334
|
+
Use '>=' to set a min. OS version
|
335
|
+
e.g. >=10.6.0
|
336
|
+
Use "n" for no limitation
|
337
|
+
|
338
|
+
-c, --cpu <type> Limit to cpu type: 'ppc' or 'intel'
|
339
|
+
Use "n" for no limitation.
|
340
|
+
|
341
|
+
-C, --category <category> The JSS Category for this package
|
342
|
+
Use "n" for none
|
343
|
+
|
344
|
+
-X, --expiration <days> How many days of no use before this package
|
345
|
+
uninstalls itself. Pkg must be removable,
|
346
|
+
and expiration must be allowed in the
|
347
|
+
client config.
|
348
|
+
|
349
|
+
-P, --expiration-path <path> The path to the executable the must be used
|
350
|
+
within the expiration period to avoid
|
351
|
+
being uninstalled
|
352
|
+
|
353
|
+
Action delete:
|
354
|
+
|
355
|
+
--delete-scripts Delete any scripts associated with this pkg
|
356
|
+
if they aren't in use elsewhere. Those in
|
357
|
+
use will be reported.
|
358
|
+
|
359
|
+
--keep-in-jss Leave the package in the JSS after deleting
|
360
|
+
it from d3
|
361
|
+
|
362
|
+
|
363
|
+
Action search:
|
364
|
+
|
365
|
+
-S, --status <status> Limit the packages listed to those with
|
366
|
+
the given status. Can be used multiple
|
367
|
+
times to see multiple statuses.
|
368
|
+
|
369
|
+
--groups Instead of basenames, search computer
|
370
|
+
group names and report packages scoped
|
371
|
+
by those groups for auto-install or
|
372
|
+
exclusion.
|
373
|
+
|
374
|
+
Action report:
|
375
|
+
|
376
|
+
-S, --status <status> Limit the receipts listed to those with
|
377
|
+
the given status. Can be used multiple
|
378
|
+
times to see multiple statuses.
|
379
|
+
|
380
|
+
-z, --frozen Limit the receipts listed to frozen ones.
|
381
|
+
|
382
|
+
-q, --queue Report pending puppy installs rather than
|
383
|
+
receipts.
|
384
|
+
|
385
|
+
--computers The target of the report is a computer name
|
386
|
+
and the report is about receipts or
|
387
|
+
pending puppy installs on that computer.
|
388
|
+
|
389
|
+
|
390
|
+
ENDHELP
|
391
|
+
end # extended help text
|
392
|
+
|
393
|
+
end # module help
|
394
|
+
end # module admin
|
395
|
+
end # module D3
|
396
|
+
|