return self.cmd(args)
- def precmd(self, argv): # check arguments before cmd
- if argv[0] == 'help' or argv[0] == '?':
- return argv
+ def precmd(self, argv): # check help before cmd
if len(argv) == 1:
return ['help', argv[0]]
- elif len(argv) > 2:
- raise errors.Usage("Extra arguments given")
- if not os.path.exists(argv[1]):
- raise errors.CreatorError("Can't find file: %s" % argv[1])
+ if '-h' in argv or '?' in argv or '--help' in argv or 'help' in argv:
+ return argv
if os.geteuid() != 0:
raise msger.error("Root permission is required, abort")
- if configmgr.bootstrap['enable']:
- configmgr._ksconf = argv[1]
- rt_util.bootstrap_mic()
-
return argv
def do_auto(self, subcmd, opts, *args):
return None
+ if len(args) != 1:
+ raise errors.Usage("Extra arguments given")
+
+ if not os.path.exists(args[0]):
+ raise errors.CreatorError("Can't find the file: %s" % args[0])
+
with open(args[0], 'r') as rf:
first_line = rf.readline()
import os
import sys
-from mic import chroot, msger
+from mic import chroot, msger, rt_util
from mic.utils import cmdln, misc, errors, fs_related
from mic.imager import fs
from mic.conf import configmgr
${cmd_option_list}
"""
+ if len(args) != 1:
+ raise errors.Usage("Extra arguments given")
+
creatoropts = configmgr.create
ksconf = args[0]
+ if configmgr.bootstrap['enable']:
+ configmgr._ksconf = ksconf
+ rt_util.bootstrap_mic()
+
recording_pkgs = []
if len(creatoropts['record_pkgs']) > 0:
recording_pkgs = creatoropts['record_pkgs']
import shutil
import tempfile
-from mic import chroot, msger
+from mic import chroot, msger, rt_util
from mic.utils import misc, fs_related, errors
from mic.conf import configmgr
import mic.imager.livecd as livecd
${cmd_option_list}
"""
+ if len(args) != 1:
+ raise errors.Usage("Extra arguments given")
+
creatoropts = configmgr.create
ksconf = args[0]
+ if configmgr.bootstrap['enable']:
+ configmgr._ksconf = ksconf
+ rt_util.bootstrap_mic()
+
if creatoropts['arch'] and creatoropts['arch'].startswith('arm'):
msger.warning('livecd cannot support arm images, Quit')
return
import shutil
import tempfile
-from mic import chroot, msger
+from mic import chroot, msger, rt_util
from mic.utils import misc, fs_related, errors
from mic.utils.partitionedfs import PartitionedMount
from mic.conf import configmgr
${cmd_option_list}
"""
+ if len(args) != 1:
+ raise errors.Usage("Extra arguments given")
+
creatoropts = configmgr.create
ksconf = args[0]
+ if configmgr.bootstrap['enable']:
+ configmgr._ksconf = ksconf
+ rt_util.bootstrap_mic()
+
if creatoropts['arch'] and creatoropts['arch'].startswith('arm'):
msger.warning('liveusb cannot support arm images, Quit')
return
import shutil
import tempfile
-from mic import chroot, msger
+from mic import chroot, msger, rt_util
from mic.utils import misc, fs_related, errors, cmdln
from mic.conf import configmgr
from mic.plugin import pluginmgr
${cmd_option_list}
"""
+ if len(args) != 1:
+ raise errors.Usage("Extra arguments given")
+
creatoropts = configmgr.create
ksconf = args[0]
+ if configmgr.bootstrap['enable']:
+ configmgr._ksconf = ksconf
+ rt_util.bootstrap_mic()
+
recording_pkgs = []
if len(creatoropts['record_pkgs']) > 0:
recording_pkgs = creatoropts['record_pkgs']
import re
import tempfile
-from mic import chroot, msger
+from mic import chroot, msger, rt_util
from mic.utils import misc, fs_related, errors, runner, cmdln
from mic.conf import configmgr
from mic.plugin import pluginmgr
${cmd_option_list}
"""
+ if len(args) != 1:
+ raise errors.Usage("Extra arguments given")
+
creatoropts = configmgr.create
ksconf = args[0]
+ if configmgr.bootstrap['enable']:
+ configmgr._ksconf = ksconf
+ rt_util.bootstrap_mic()
+
recording_pkgs = []
if len(creatoropts['record_pkgs']) > 0:
recording_pkgs = creatoropts['record_pkgs']