#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Dell Recovery Media Launcher Script
#
# Copyright (C) 2008 Dell Inc,
#   Author: Mario Limonciello
#
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this application; if not, write to the Free Software Foundation, Inc., 51
# Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
##################################################################################

from Dell.recovery_frontend import Frontend
import optparse
import os
import sys

usage = '%prog [options]'
parser = optparse.OptionParser(usage=usage)
parser.set_defaults(
    up=None,
    rp=None,
    media="dvd",
    target=os.getenv('HOME'),
    overwrite=False,
    automatic=False
    )
parser.add_option('-u', '--up', dest='up',
                  help='Override detected utility partition with this file.')
parser.add_option('-r', '--rp', dest='rp',
                  help='Override detected recovery partition with this file.')
parser.add_option('-m', '--media', dest='media',
                  help='Set type of recovery media to create [dvd, usb, iso].')
parser.add_option('-t', '--target', dest='target',
                  help='Set target directory to store ISO in when completed.')
parser.add_option('-o', '--overwrite', dest='overwrite', action='store_true',
                  help='Force overwrite of any existing file')
(options, args) = parser.parse_args()

if __name__ == '__main__':
    script = Frontend(options.up,
                      options.rp,
                      options.media,
                      options.target,
                      options.overwrite)
    script.run()
    sys.exit(0)
