forked from hyphanet/pyFreenet
-
Notifications
You must be signed in to change notification settings - Fork 4
/
freedisk
executable file
·912 lines (713 loc) · 23.8 KB
/
freedisk
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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
#!/usr/bin/env python2
#@+leo-ver=4
#@+node:@file freedisk
#@@first
#@@language python
#@+others
#@+node:freedisk app
"""
freedisk is a command-line utility for creating,
mounting and synchronising freenet freedisks
Invoke with -h for help
"""
#@+others
#@+node:imports
import sys, os
import getopt
import traceback
import time
import sha
import getpass
try:
import fcp as fcp
from fcp import node, freenetfs
from fcp.xmlobject import XMLFile, XMLNode
except:
print "** PyFreenet core module 'fcp' not installed."
print "** Please refer to the INSTALL file within the pyFreenet source package"
sys.exit(1)
try:
import SSLCrypto
except:
SSLCrypto = None
print "** WARNING! SSLCrypto module not installed"
print "** Please refer to the INSTALL file within the pyFreenet source package"
#@-node:imports
#@+node:globals
# args shorthand
argv = sys.argv
argc = len(argv)
progname = argv[0]
# default config file stuff
homedir = os.path.expanduser("~")
configFile = os.path.join(homedir, ".freediskrc")
defaultMountpoint = os.path.join(homedir, "freedisk")
#@-node:globals
#@+node:class FreediskMgr
class FreediskMgr:
"""
Freedisk manager class
"""
#@ @+others
#@+node:__init__
def __init__(self, *args, **kw):
self.args = args
self.kw = kw
configFile = self.configFile = kw['configFile']
conf = self.conf = FreediskConfig(configFile)
#ipython(conf)
# validate args
nargs = len(args)
if nargs == 0:
usage("No command given")
cmd = self.cmd = args[0]
# barf if not 'init' and no config
if cmd != 'init' and not os.path.isfile(configFile):
usage("Config file %s does not exist\nRun '%s init' to create it" % (
configFile, progname))
# validate args count for cmds needing diskname arg
if cmd in ['new', 'add', 'del', 'update', 'commit']:
if nargs < 2:
usage("%s: Missing argument <freediskname>" % cmd)
diskname = self.diskname = args[1]
# get paths to freedisk dir and pseudo-files
self.diskPath = os.path.join(conf.mountpoint, "usr", diskname)
self.pubKeyPath = os.path.join(self.diskPath, ".publickey")
self.privKeyPath = os.path.join(self.diskPath, ".privatekey")
self.passwdPath = os.path.join(self.diskPath, ".passwd")
self.cmdPath = os.path.join(self.diskPath, ".cmd")
self.statusPath = os.path.join(self.diskPath, ".status")
# implement command synonyms
self.cmd_setup = self.cmd_init
self.cmd_mount = self.cmd_start
self.cmd_unmoutn = self.cmd_umount = self.cmd_stop
#@-node:__init__
#@+node:run
def run(self):
"""
Executes the given command
"""
cmd = self.cmd
method = getattr(self, "cmd_"+cmd, None)
if not method:
usage("Unrecognised command '%s'" % cmd)
result = method(*self.args[1:]) or ""
return result
#@-node:run
#@+node:cmd_init
def cmd_init(self, *args):
conf = self.conf
# initialise/change freedisk config
print "Freedisk configuration"
print
print "Your freedisk config will normally be stored in the file:"
print " %s" % self.configFile
# allow password change
if conf.passwd:
# got a password already
prmt = "Do you wish to change your config password"
else:
# new password
prmt = "Do you wish to encrypt this file"
if getyesno(prmt):
passwd = getpasswd("New Password", True)
conf.setPassword(passwd)
print "Password successfully changed"
# host parms
fcpHost = raw_input("Freenet FCP Hostname: [%s] " % conf.fcpHost).strip()
if fcpHost:
conf.fcpHost = fcpHost
fcpPort = raw_input("Freenet FCP Port: [%s] "% conf.fcpPort).strip()
if fcpPort:
conf.fcpPort = fcpPort
print "Freenet verbosity:"
print " (0=SILENT, 1=FATAL, 2=CRITICAL, 3=ERROR"
print " 4=INFO, 5=DETAIL, 6=DEBUG)"
v = raw_input("[%s] " % conf.fcpVerbosity).strip()
if v:
conf.fcpVerbosity = v
while 1:
m = raw_input("Mountpoint [%s] " % conf.mountpoint).strip() \
or conf.mountpoint
if m:
if not os.path.isdir(m):
print "No such directory '%s'" % m
elif not os.path.exists(m):
print "%s is not a directory" % m
else:
conf.mountpoint = m
mountpoint = m
break
print "Freedisk configuration successfully changed"
#@-node:cmd_init
#@+node:cmd_start
def cmd_start(self, *args):
conf = self.conf
kw = self.kw
# spawn the child
print "Spawning freenetfs filesystem process..."
# bab: Using an absolute path to exactly this file to avoid
# dangers when people take over the PATH environment variable.
os.system(__file__ + " run &")
# wait for child to bring up the fs, via a very crude test
keyDir = os.path.join(conf.mountpoint, "keys")
print "Waiting for disk to come up..."
while not os.path.isdir(keyDir):
time.sleep(1)
disks = conf.getDisks()
if disks:
print "Freenetfs now mounted, adding existing disks..."
else:
print "Freenetfs now mounted, no freedisks at present"
for disk in disks:
#break
diskPath = os.path.join(conf.mountpoint, "usr", disk.name)
# barf if a freedisk of that name is already mounted
if os.path.exists(diskPath):
usage("Freedisk %s seems to be already mounted" % disk.name)
self.doFsCommand("mount %s|%s|%s" % (
disk.name, disk.uri, disk.passwd))
if 0:
# mkdir to create the freedisk dir
os.mkdir(diskPath)
pubKeyPath = os.path.join(diskPath, ".publickey")
privKeyPath = os.path.join(diskPath, ".privatekey")
passwdPath = os.path.join(diskPath, ".passwd")
# wait for the pseudo-files to come into existence
while not os.path.isfile(privKeyPath):
time.sleep(0.1)
# set the key and password
file(pubKeyPath, "w").write(disk.uri)
file(privKeyPath, "w").write(disk.privUri)
file(passwdPath, "w").write(disk.passwd)
#while True:
# time.sleep(1)
#@-node:cmd_start
#@+node:cmd_run
def cmd_run(self, *args):
"""
become the foreground FUSE process.
This is launched by 'freedisk start'
"""
conf = self.conf
kw = self.kw
print "Creating freenetfs filesystem..."
fs = freenetfs.FreenetFuseFS(
conf.mountpoint,
fcpHost=conf.fcpHost,
fcpPort=conf.fcpPort,
verbosity=conf.fcpVerbosity,
debug=kw['debug'],
multithreaded=kw['multithreaded'],
)
# never returns, until fs is unmounted
print "Freenetfs filesystem now alive..."
fs.run()
#@-node:cmd_run
#@+node:cmd_stop
def cmd_stop(self, *args):
"""
Unmount the freenetfs
"""
os.system("umount %s" % self.conf.mountpoint)
#@-node:cmd_stop
#@+node:cmd_new
def cmd_new(self, *args):
"""
Creates a new freedisk with a random key
"""
#print "new: %s: NOT IMPLEMENTED" % diskname
conf = self.conf
diskname = self.diskname
diskPath = self.diskPath
if os.path.exists(diskPath):
usage("Freedisk %s seems to be already mounted" % diskname)
# get a password if desired
passwd = getpasswd("Encrypt disk with password", True)
# get a new private key
keyDir = os.path.join(conf.mountpoint, "keys")
if not os.path.isdir(keyDir):
print "No keys directory %s" % keyDir
print "Is your freenetfs mounted?"
usage("Freenetfs not mounted")
keyName = "freedisk_%s_%s" % (diskname, int(time.time()*1000000))
keyPath = os.path.join(keyDir, keyName)
keys = file(keyPath).read().strip().split("\n")
pubKey, privKey = [k.split("/")[0].split("freenet:")[-1] for k in keys]
print self.doFsCommand("mount %s|%s|%s" % (diskname, privKey, passwd))
# and, of course, update config
conf.addDisk(diskname, privKey, passwd)
return
# deprecated
if 0:
# mkdir to create the freedisk dir
os.mkdir(diskPath)
# wait for the pseudo-files to come into existence
while not os.path.isfile(privKeyPath):
time.sleep(0.1)
#status("About to write to %s" % privKeyPath)
file(self.pubKeyPath, "w").write(pubKey)
file(self.privKeyPath, "w").write(privKey)
file(self.passwdPath, "w").write(passwd)
#@-node:cmd_new
#@+node:cmd_add
def cmd_add(self, *args):
nargs = len(args)
diskname = self.diskname
conf = self.conf
# get uri
if nargs < 2:
usage("add: Missing URI")
uri = args[1]
#print "add: %s: NOT IMPLEMENTED" % diskname
# barf if a freedisk of that name is already mounted
if os.path.exists(self.diskPath):
usage("Freedisk %s seems to be already mounted" % diskname)
# get a password if desired
passwd = getpasswd("Disk's password", True)
print self.doFsCommand("mount %s|%s|%s" % (diskname, uri, passwd))
# and, of course, update config
conf.addDisk(diskname, uri, passwd)
return
# deprecated
if 0:
# mkdir to create the freedisk dir
os.mkdir(self.diskPath)
# wait for the pseudo-files to come into existence
while not os.path.isfile(self.privKeyPath):
time.sleep(0.1)
# set the keys
if fcp.node.uriIsPrivate(uri):
path = privKeyPath
else:
path = pubKeyPath
f = file(path, "w")
f.write(uri)
f.flush()
f.close()
#@nonl
#@-node:cmd_add
#@+node:cmd_del
def cmd_del(self, *args):
"""
unmounts a freedisk
"""
conf = self.conf
diskname = self.diskname
disk = conf.getDisk(diskname)
if not isinstance(disk, XMLNode):
usage("No such disk '%s'" % diskname)
self.doFsCommand("umount %s" % diskname)
conf.delDisk(diskname)
return
# deprecated
path = os.path.join(conf.mountpoint, "usr", diskname)
os.rmdir(path)
#@-node:cmd_del
#@+node:cmd_update
def cmd_update(self, *args):
"""
Updates a freedisk *from* freenet
"""
conf = self.conf
diskname = self.diskname
disk = conf.getDisk(diskname)
if not isinstance(disk, XMLNode):
usage("No such disk '%s'" % diskname)
self.doFsCommand("update %s" % diskname)
return
# deprecated
cmdPath = self.cmdPath
diskname = self.diskname
print "update: %s: NOT IMPLEMENTED" % diskname
f = file(cmdPath, "w")
f.write("update")
f.flush()
f.close()
#@-node:cmd_update
#@+node:cmd_commit
def cmd_commit(self, *args):
"""
commits a freedisk *to* freenet
"""
conf = self.conf
diskname = self.diskname
disk = conf.getDisk(diskname)
if not isinstance(disk, XMLNode):
usage("No such disk '%s'" % diskname)
res = self.doFsCommand("commit %s" % diskname)
return res
# deprecated
cmdPath = self.cmdPath
diskname = self.diskname
print "commit: %s: launching.." % diskname
f = file(cmdPath, "w")
f.write("commit")
f.flush()
f.close()
#@-node:cmd_commit
#@+node:cmd_list
def cmd_list(self, *args):
"""
Produces a list of mounted freedisks
"""
conf = self.conf
disks = conf.getDisks()
if disks:
print "Currently mounted freedisks:"
for d in disks:
print " %s:" % d.name
print " uri=%s" % d.uri
print " passwd=%s" % d.passwd
else:
print "No freedisks mounted"
#@-node:cmd_list
#@+node:cmd_cmd
def cmd_cmd(self, *args):
# arbitrary command, for testing
cmd = args[0] + "|".join(args[1:])
print repr(self.doFsCommand(cmd))
#@-node:cmd_cmd
#@+node:doFsCommand
def doFsCommand(self, cmd):
"""
Executes a command via base64-encoded file
"""
cmdBase64 = fcp.node.base64encode(cmd)
if len(cmdBase64) > 254:
raise Exception("Command too long")
path = self.conf.mountpoint + "/cmds/" + cmdBase64
return file(path).read()
#@-node:doFsCommand
#@-others
#@-node:class FreediskMgr
#@+node:class FreediskConfig
class FreediskConfig:
"""
allows for loading/saving/changing freedisk configs
"""
#@ @+others
#@+node:attribs
_intAttribs = ["fcpPort", "fcpVerbosity"]
_strAttribs = ["fcpHost", "mountpoint"]
#@-node:attribs
#@+node:__init__
def __init__(self, path, passwd=None):
"""
Create a config object from file at 'path', if it exists
"""
#print "FreediskConfig: path=%s" % path
self.path = path
self.passwd = passwd
if os.path.isfile(path):
self.load()
else:
self.create()
self.root = self.xml.root
#@-node:__init__
#@+node:load
def load(self):
"""
Loads config from self.config
"""
# get the raw xml, plain or encrypted
ciphertext = file(self.path, "rb").read()
plaintext = ciphertext
# try to wrap into xml object
try:
xml = self.xml = XMLFile(raw=plaintext)
except:
i = 0
while i < 3:
passwd = self.passwd = getpasswd("Freedisk config password")
plaintext = decrypt(self.passwd, ciphertext)
try:
xml = XMLFile(raw=plaintext)
break
except:
i += 1
continue
if i == 3:
self.abort()
self.xml = xml
self.root = xml.root
#@-node:load
#@+node:create
def create(self):
"""
Creates a new config object
"""
self.xml = XMLFile(root="freedisk")
root = self.root = self.xml.root
self.fcpHost = fcp.node.defaultFCPHost
self.fcpPort = fcp.node.defaultFCPPort
self.fcpVerbosity = fcp.node.defaultVerbosity
self.mountpoint = defaultMountpoint
self.save()
#@-node:create
#@+node:save
def save(self):
plain = self.xml.toxml()
if self.passwd:
cipher = encrypt(self.passwd, plain)
else:
cipher = plain
f = file(self.path, "wb")
f.write(cipher)
f.flush()
f.close()
#@-node:save
#@+node:abort
def abort(self):
print "freedisk: Cannot decrypt freedisk config file '%s'" % self.path
print
print "If you truly can't remember the password, your only"
print "option now is to delete the config file and start again"
sys.exit(1)
#@-node:abort
#@+node:setPassword
def setPassword(self, passwd):
self.passwd = passwd
self.save()
#@-node:setPassword
#@+node:addDisk
def addDisk(self, name, uri, passwd):
d = self.getDisk(name)
if isinstance(d, XMLNode):
raise Exception("Disk '%s' already exists" % name)
diskNode = self.root._addNode("disk")
diskNode.name = name
diskNode.uri = uri
diskNode.passwd = passwd
self.save()
#@-node:addDisk
#@+node:getDisk
def getDisk(self, name):
"""
Returns a record for a freedisk of name <name>
"""
disks = self.root._getChild("disk")
for d in disks:
if d.name == name:
return d
return None
#@-node:getDisk
#@+node:getDisks
def getDisks(self):
"""
Returns all freedisk records
"""
return self.root._getChild("disk")
#@-node:getDisks
#@+node:delDisk
def delDisk(self, name):
"""
Removes disk of given name
"""
d = self.getDisk(name)
if not isinstance(d, XMLNode):
raise Exception("No such freedisk '%s'" % name)
self.root._delChild(d)
self.save()
#@-node:delDisk
#@+node:__getattr__
def __getattr__(self, attr):
if attr in self._intAttribs:
try:
return int(getattr(self.root, attr))
except:
raise AttributeError(attr)
elif attr in self._strAttribs:
try:
return str(getattr(self.root, attr))
except:
raise AttributeError(attr)
else:
raise AttributeError(attr)
#@-node:__getattr__
#@+node:__setattr__
def __setattr__(self, attr, val):
if attr in self._intAttribs:
val = str(val)
setattr(self.root, attr, val)
self.save()
elif attr in self._strAttribs:
setattr(self.root, attr, val)
self.save()
else:
self.__dict__[attr] = val
#@-node:__setattr__
#@-others
#@-node:class FreediskConfig
#@+node:usage
def usage(msg=None, ret=1):
"""
Prints usage message then exits
"""
if msg:
sys.stderr.write(msg+"\n")
sys.stderr.write("Usage: %s [options] [<command> [<args>]]\n" % progname)
sys.stderr.write("Type '%s -h' for help\n" % progname)
sys.exit(ret)
#@-node:usage
#@+node:help
def help():
"""
Display help info then exit
"""
print "%s: manage a freenetfs filesystem" % progname
print "Usage: %s [<options>] <command> [<arguments>]" % progname
print "Options:"
print " -h, --help Display this help"
print " -c, --config= Specify config file, default ~/.freediskrc"
print "Commands:"
print " init Edit configuration interactively"
print " mount Mount the freenetfs"
print " unmount Unmount the freenetfs"
print " new <name> Create a new freedisk of name <name>"
print " A new keypair will be generated."
print " add <name> <URI> Add an existing freedisk of name <name>"
print " and public key URI <URI>"
print " del <name> Remove freedisk of name <name>"
print " update <name> Sync freedisk <name> from freenet"
print " commit <name> Commit freedisk <name> into freenet"
print
print "Environment variables:"
print " FREEDISK_CONFIG - set this in place of '-c' argument"
sys.exit(0)
#@-node:help
#@+node:removeDirAndContents
def removeDirAndContents(path):
files = os.listdir(path)
for f in files:
fpath = os.path.join(path, f)
if os.path.isfile(fpath):
os.unlink(fpath)
elif os.path.isdir(fpath):
removeDirAndContents(fpath)
os.rmdir(path)
#@-node:removeDirAndContents
#@+node:status
def status(msg):
sys.stdout.write(msg + "...")
time.sleep(1)
print
#@-node:status
#@+node:encrypt
def encrypt(passwd, s):
passwd = sha.new(passwd).digest()
if SSLCrypto:
# encrypt with blowfish 256, key=sha(password), IV=00000000
return SSLCrypto.blowfish(passwd).encrypt(s)
else:
# no encyrption available, return plaintext
return s
#@-node:encrypt
#@+node:decrypt
def decrypt(passwd, s):
passwd = sha.new(passwd).digest()
if SSLCrypto:
# decrypt with blowfish 256, key=sha(password), IV=00000000
return SSLCrypto.blowfish(passwd).decrypt(s)
else:
# no encyrption available, return plaintext
return s
#@-node:decrypt
#@+node:getpasswd
def getpasswd(prompt="Password", confirm=False):
if not confirm:
return getpass.getpass(prompt+": ").strip()
while 1:
passwd = getpass.getpass(prompt+": ").strip()
if passwd:
passwd1 = getpasswd("Verify password").strip()
if passwd == passwd1:
break
print "passwords do not match, please try again"
else:
break
return passwd
#@-node:getpasswd
#@+node:ipython
def ipython(o=None):
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell() # this call anywhere in your program will start IPython
#@-node:ipython
#@+node:getyesno
def getyesno(prmt, dflt=True):
if dflt:
ynprmt = "[Y/n] "
else:
ynprmt = "[y/N] "
resp = raw_input(prmt + "? " + ynprmt).strip()
if not resp:
return dflt
resp = resp.lower()[0]
return resp == 'y'
#@-node:getyesno
#@+node:main
def main():
"""
Front end
"""
#@ <<set defaults>>
#@+node:<<set defaults>>
# create defaults
opts = {
'debug' : False,
'multithreaded' : False,
'configFile' : configFile,
'verbosity' : fcp.ERROR,
'Verbosity' : 1023,
}
#@-node:<<set defaults>>
#@nl
#@ <<process args>>
#@+node:<<process args>>
# process args
try:
cmdopts, args = getopt.getopt(
sys.argv[1:],
"?hvc:dm",
["help", "verbose",
"multithreaded",
"config=", "debug",
]
)
except getopt.GetoptError:
# print help information and exit:
usage()
sys.exit(2)
#print cmdopts
for o, a in cmdopts:
if o in ("-?", "-h", "--help"):
help()
if o in ("-v", "--verbose"):
opts['verbosity'] = fcp.node.DETAIL
opts['Verbosity'] = 1023
verbose = True
if o in ("-c", "--config"):
opts['configFile'] = a
if o in ("-d", "--debug"):
opts['debug'] = True
if o in ("-m", "--multithreaded"):
opts['multithreaded'] = True
#@-node:<<process args>>
#@nl
#@ <<execute command>>
#@+node:<<execute command>>
mgr = FreediskMgr(*args, **opts)
print mgr.run()
#@-node:<<execute command>>
#@nl
#@-node:main
#@+node:mainline
if __name__ == '__main__':
main()
#@-node:mainline
#@-others
#@-node:freedisk app
#@-others
#@-node:@file freedisk
#@-leo