This file is indexed.

/usr/sbin/drobom is in drobo-utils 0.6.1+repack-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
#!/usr/bin/python


import sys
import Drobo
import time
import getopt
import string
import os
import types
import textwrap

toprint = ("config", "capacity", "protocol", "settings", "slots",
           "firmware", "status", "options", "luns")

def usage():
   print "\nUsage: drobom [options] <command> [ arguments... ] \n"
   print " drobo management interface, version: %s\n" % Drobo.VERSION
   print "options may be one of: "
   print " -c, --command <command>\tcommand to run."
   print " -d, --device <device>\tpick a specific disk, rather than scan"
   print " -h, --help \t\tprint this help text"
   print " -v, --verbose <debug_code>\t bit-field, default is 0 (off) "
   print "\t1  - General"
   print "\t2  - Hardware Dialog"
   print "\t4  - Initiation"
   print "\t8  - DMP layer"
   print "\t16 - Detection"
   print "\t63 - All of the above"
   print "\t128- Simulate presence of Drobo for testing\n"
   print " -V, --version\treport version of drobo-utils."
   print "\ncommand is one of: "
   print "\tblink\tidentify the drobo by making the lights blink"
   print "\tdiag \tdump diagnostics file into /tmp directory"
   print "\tdiagprint <file>  - print diagnostic file to stdout"
   print "\tformat\tPrepares a script to format LUNS from a device. Arguments:"
   print "\t\t<fstype>\tfile system type.  One of: ext3, ntfs, FAT32"
   print "\t\t<confirmation>\tSpecify 'PleaseEraseMyData' if you"
   print "\t\t\t\treally mean it"
   print "\t\tNote: This places a script in /tmp, which you must run."
   print "\tfwcheck\tquery drobo.com for updates to firmware for the given Drobo"
   print "\tfwload\tload a specific firmware for the given Drobo. Arguments:"
   print "\t\t<fwimage>\tthe firmware file to load."
   print "\tfwupgrade\tupgrade the firmware to the latest and greatest,"
   print "\t\t\trecommended by DRI"
   print "\tinfo <options>\tprint information on a Drobo"
   print "\t\t<options>\tcomma separated list of:"
   opt_str = ', '.join(toprint)
   for line in textwrap.wrap(opt_str, 40):
      print "\t\t\t\t" + line
   print "\tlist \tshow device files for all Drobos found."
   print "\tname <name> \tSet Drobo name"
   print "\tsettime\tsync Drobo's clock to UTC"
   print "\tsetlunsize\tSet the size of LUNS on device. Arguments:"
   print "\t\t<sz>\tinteger number of TiB to set the lunsize to"
   print "\t\t<confirmation>\tSpecify 'PleaseEraseMyData' if you"
   print "\t\t\t\treally mean it"
   print "\t\tNote: After execution, Drobo reboots, wait a few minutes"
   print "\t\t\tbefore accessing again"
   print "\tshutdown\tShutdown drobo"
   print "\t\t\t(DRI calls this 'standby'. Shutdown also umounts.)"
   print "\tstatus\treport how is the Drobo doing"
   print "\tview\tstart up a management dashboard GUI"


def printconfig(d):
  config=d.GetSubPageConfig()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query config result: '
    print config
    print 'max lun size is: ', config[2]
    print
  else:
    print config

def printcapacity(d):
  c=d.GetSubPageCapacity()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query capacity result:'
    print c
    print 'Physical space... used: ',  c[1] , ' free: ' , c[0],  ' Total: ', c[2]
    print
  else:
    print c


def printprotocol(d):
  protocol=d.GetSubPageProtocol()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query protocol version result: '
    print protocol 
    print
  else:
    print protocol

def printsettings(d):
  settings=d.GetSubPageSettings()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query settings result:' 
    print settings
    print 'Drobo time is', time.ctime(settings[0])
    print
  else:
    print settings
  
def printslots(d):
  slotinfo=d.GetSubPageSlotInfo()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query slotinfo result:  number of slots:', d.slot_count
  print slotinfo
  
def printfirmware(d):
  firmware=d.GetSubPageFirmware()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query firmware result:' 
    print firmware
    print 'drobo says firmware revision: ', str(firmware[0]), '.', str(firmware[1]), '(', str(firmware[2]), ') was built: ', firmware[5]
    print
  else:
    print firmware
  
def printstatus(d):
  status=d.GetSubPageStatus()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query status result:' 
    print status
    print
  else:
    print status
  
def printoptions(d):
  options=d.GetSubPageOptions()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query options result:'
    print options
  else:
    print options
  
def printluns(d):
  luninfo=d.GetSubPageLUNs()
  if Drobo.DEBUG & Drobo.DBG_Chatty:
    print 'query luninfo result:'
    for i in luninfo:
       print i
    print
  else:
    for i in luninfo:
       print i
 
def info(d,choices):
  if debug & Drobo.DBG_Chatty:
    print '---------------------------------------------------------'
    print 'Info about Drobo ' ,
    print '   Name:', d.GetSubPageSettings()[2],
    print '      Devices:', ':'.join(d.char_devs)
    print '---------------------------------------------------------'

  for c in choices:
     eval( "print" + c + "(d)"  )

  if debug & Drobo.DBG_Chatty:
    print '---------------------------------------------------------'

def update(pct):
  print "write is %2d%% done." % ( pct )


# Mainline...

if ( len(sys.argv) == 1 ) or (sys.argv[1] == 'help'):
  usage()
  sys.exit()

device=None
cmd=None
#default is chatty
debug=1

try:
   opts, args = getopt.getopt(sys.argv[1:], "c:d:hv:V", \
       ["command=", "device=", "help", "verbosity=", "version"])
except getopt.GetoptError, err:
   usage()
   sys.exit(2)


for o, a in opts:
        if o in ("-c", "--command"):
	    cmd = a
        elif o in ("-d", "--device"):
	    device=a
        elif o in ("-h", "--help"):
            usage()
            sys.exit()
        elif o in ("-v", "--verbosity", "--verbose") :
            debug = int(a)
        elif o in ("-V", "--version" ):
            print Drobo.VERSION
            sys.exit()
        else:
            assert False, "unhandled option"

if cmd==None :
  if (len(args) == 0):
     usage()
     sys.exit()
  cmd=args[0]

if (os.geteuid() != 0) and (debug & Drobo.DBG_Simulation == 0):
   print "Please try again as root."
   sys.exit()

l = Drobo.DiscoverLUNs(debug)
if not l:
   print "No Drobos discovered"
   sys.exit()

# find the requested Drobo...
match=False
if device != None:
   for i in l:
      if type(i) == types.ListType:
         for j in i:
            if device in j:
               l=[i]
               match=True
      elif device in i:
         l=[i]
         match=True

if device != None and not match:
   print "given device: %s, is not a Drobo" % d
   sys.exit()
 
if cmd == 'list':
   print ' '.join(map(lambda x: ':'.join(x) , l ))
   sys.exit()

if debug & Drobo.DBG_Detection:
   print "found ", l

for u in l:
  d=Drobo.Drobo(u,debug)
  #assert d is a valid drobo object...

  if cmd == "blink":
     d.Blink() 

  elif cmd == "diag":
     f=d.dumpDiagnostics()
     print "diagnostics in ", f

  elif cmd == "diagprint":
     print d.decodeDiagnostics( args[1] )

  elif cmd == "format":
     if len(args) < 3 :
        print 'This is guaranteed to erase your disk, so you must say: PleaseEraseMyData'
        sys.exit()

     if args[2] != 'PleaseEraseMyData':
        print 'This is guaranteed to erase your disk, so you must say: PleaseEraseMyData'
        sys.exit()

     print 'You asked nicely, so I will format %s as you requested' % args[1]
     d.format_script(args[1])
     print 'OK, I built the script but nothing is erased yet...'
     print 'If you are really sure, go ahead and do: sh /tmp/fmtscript'

  elif cmd == 'fwcheck':
     tuple=d.PickLatestFirmware()
     print tuple[3]

  elif cmd == 'fwload':
     if d.PickFirmware(args[1]):
       d.writeFirmware(update)
     d.Sync()

  elif cmd == 'fwupgrade':
     if d.updateFirmwareRepository():
       d.writeFirmware(update)
       d.Sync()

  elif cmd == 'info':
     if len(args) > 1:
       toprint=args[1].split(',')
     info(d,toprint)

  elif cmd == "name": 
    d.Sync(args[1])          

  elif cmd == "setlunsize": 
     lunsize=int(args[1])

     if lunsize not in (1, 2, 4, 8, 16):
        print 'lun size needs to be 1, 2, 4, 8, or 16 TiB; %d is invalid' % lunsize
        sys.exit()

     if lunsize > 2:
        print 'WARNING: lun size > 2 TiB known not work in many cases under Linux' 

     if len(args) < 3 :
        print 'This is guaranteed to erase your disk, so you must say: PleaseEraseMyData'
        sys.exit()

     if args[2] != 'PleaseEraseMyData':
        print 'This is guaranteed to erase your disk, so you must say: PleaseEraseMyData'
        sys.exit()

     print 'You asked nicely, so I will set the lunsize to %d as you requested' % lunsize
     d.SetLunSize(lunsize)
     print 'Done... Drobo is likely now rebooting.  In a few minutes, it will come back with the new LUN size.'

  elif cmd == "set": 
     what = args[1]
     if what == "time" :
        d.Sync()
     else:
        options=d.GetSubPageOptions()
        if args[1] in options.keys():
           # TODO: are all options integers? no..
           if args[2] == 'True':
               value=True
           elif args[2] == 'False':
               value=False
           elif args[1] == 'IPAddress' or args[1] == 'NetMask':
               value=args[2]
           else:
               value=int(args[2])

           options[args[1]]=value
        else:
           print 'option not present: ', args[1]

        d.SetOptions( options ) 

  elif cmd == "settime": 
     d.Sync()          

  elif cmd == "shutdown":
     d.Standby() 
   
  elif cmd == "status":
     c=d.GetSubPageCapacity()
     n=d.GetSubPageSettings()
     if c[2] > 0 :
         pfull = 100 * ((c[1]+1.0)/c[2])
     else:
         print "firmware too old to report capacity properly... or the drobo is empty..."
         pfull = -1

     m=':'.join(d.DiscoverMounts())
     if m == "":
       m="-"
     if n[2] == "":
       n[2] = "-"
     print "%s %s %s %02d%% full - %s" % ( ':'.join(d.char_devs), m, n[2], \
          pfull, d.GetSubPageStatus() )

  elif cmd == "time":
     settings=d.GetSubPageSettings()
     print "Drobo says it is:", time.ctime(settings[0])

  elif cmd == "view":
     import sys,subprocess
     try: 
       from PyQt4 import QtGui
       from PyQt4 import QtCore
       from DroboGUI import DroboGUI
     except:
       print "QT support missing, no GUI possible"

     # fire up a GUI for the given LUN, stays foreground...
     app = QtGui.QApplication(sys.argv)
     tb = DroboGUI(d)
     tb.show()
     app.exec_()

  else:
     usage()
     print "Unknown Command: ", cmd