home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / bin / liveusb-creator < prev    next >
Encoding:
Text File  |  2012-12-13  |  4.7 KB  |  96 lines

  1. #!/usr/bin/python -tt
  2. # coding: utf-8
  3. #
  4. # Copyright ┬⌐ 2008-2010  Red Hat, Inc. All rights reserved.
  5. #
  6. # This copyrighted material is made available to anyone wishing to use, modify,
  7. # copy, or redistribute it subject to the terms and conditions of the GNU
  8. # General Public License v.2.  This program is distributed in the hope that it
  9. # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
  10. # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. # See the GNU General Public License for more details.  You should have
  12. # received a copy of the GNU General Public License along with this program; if
  13. # not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  14. # Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks that are
  15. # incorporated in the source code or documentation are not subject to the GNU
  16. # General Public License and may only be used or replicated with the express
  17. # permission of Red Hat, Inc.
  18. #
  19. # Author(s): Luke Macken <lmacken@redhat.com>
  20.  
  21. __version__ = '3.11.6'
  22.  
  23. def parse_args():
  24.     from optparse import OptionParser
  25.     parser = OptionParser(version=__version__)
  26.     parser.add_option('-c', '--console', dest='console', action='store_true',
  27.                       help='Use console mode instead of the GUI')
  28.     parser.add_option('-f', '--force', dest='force', action='store',
  29.                       type='string', help='Force the use of a given drive',
  30.                       metavar='DRIVE')
  31.     parser.add_option('-s', '--safe', dest='safe', action='store_true',
  32.                       help='Use the "safe, slow and stupid" bootloader')
  33.     parser.add_option('-n', '--noverify', dest='noverify', action='store_true',
  34.                       help='Skip checksum verification')
  35.     parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
  36.                       help='Output extra debugging messages')
  37.     parser.add_option('-u', '--unprivileged', dest='unprivileged',
  38.                       action='store_true', help='Allow not being root')
  39.     parser.add_option('-k', '--extra-kernel-args', dest='kernel_args',
  40.                       action='store', metavar='ARGS', 
  41.                       help='Supply extra kernel arguments'
  42.                            ' (eg: -k noswap,selinux=0,elevator=noop)')
  43.     parser.add_option('-x', '--no-xo', dest='xo', action='store_false',
  44.                       default=True, help='Disable OLPC support')
  45.     parser.add_option('-m', '--reset-mbr', dest='reset_mbr',
  46.                       action='store_true', default=False,
  47.                       help='Reset the Master Boot Record')
  48.     parser.add_option('-C', '--device-checksum', dest='device_checksum',
  49.                       action='store_true', default=False,
  50.                       help='Calculate the SHA1 of the device')
  51.     parser.add_option('-L', '--liveos-checksum', dest='liveos_checksum',
  52.                       action='store_true', default=False,
  53.                       help='Calculate the SHA1 of the Live OS')
  54.     parser.add_option('-H', '--hash', dest='hash',
  55.                       action='store', metavar='HASH', default='sha1',
  56.                       help='Use a specific checksum algorithm (default: sha1)')
  57.     parser.add_option('--clone', dest='clone', action='store_true',
  58.                       help='Clone the currently running Live system')
  59.     #parser.add_option('-F', '--format', dest='format', action='store_true', default=False,
  60.     #                  help='Format the device as FAT32 (WARNING: destructive)')
  61.     parser.add_option('-P', '--partition', dest='partition', action='store_true', default=False,
  62.                       help='Partition the device')
  63.     #parser.add_option('-z', '--usb-zip', dest='zip', action='store_true',
  64.     #                  help='Initialize device with zipdrive-compatible geometry'
  65.     #                        ' for booting in USB-ZIP mode with legacy BIOSes. '
  66.     #                        'WARNING:  This will erase everything on your '
  67.     #                        'device!')
  68.     return parser.parse_args() # (opts, args)
  69.  
  70.  
  71. def main():
  72.     opts, args = parse_args()
  73.     if opts.console:
  74.         from liveusb import LiveUSBCreator
  75.         try:
  76.             live = LiveUSBCreator(opts)
  77.             live.detect_removable_drives()
  78.             live.verify_filesystem()
  79.             live.extract_iso()
  80.             live.update_configs()
  81.             live.install_bootloader()
  82.         except Exception, e:
  83.             print str(e)
  84.         x = raw_input("\nDone!  Press any key to exit")
  85.     else:
  86.         ## Start our graphical interface
  87.         import sys
  88.         from liveusb.gui import LiveUSBApp
  89.         try:
  90.             LiveUSBApp(opts, sys.argv)
  91.         except KeyboardInterrupt:
  92.             pass
  93.  
  94. if __name__ == '__main__':
  95.     main()
  96.