summaryrefslogtreecommitdiffstats
path: root/build_tools/l7/larch0/cli/live_iso.py
diff options
context:
space:
mode:
Diffstat (limited to 'build_tools/l7/larch0/cli/live_iso.py')
-rwxr-xr-xbuild_tools/l7/larch0/cli/live_iso.py154
1 files changed, 0 insertions, 154 deletions
diff --git a/build_tools/l7/larch0/cli/live_iso.py b/build_tools/l7/larch0/cli/live_iso.py
deleted file mode 100755
index e6899c9..0000000
--- a/build_tools/l7/larch0/cli/live_iso.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/env python
-#
-# live_iso.py
-#
-# (c) Copyright 2009 - 2010 Michael Towers (larch42 at googlemail dot com)
-#
-# This file is part of the larch project.
-#
-# larch 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.
-#
-# larch 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 larch; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#----------------------------------------------------------------------------
-# 2010.07.12
-
-# This is a command line script to prepare an 'iso' file from an
-# already larchified Arch Linux installation. Alternatively, another
-# larch medium can be used as source (with the '-S' option).
-# All needed parameters are passed as options.
-
-import os
-from config import *
-from backend import *
-from media_common import *
-
-
-def build_iso(options):
- """Create a bootable iso from the source larch image. If a chroot
- build is used (default unless -S is specified) the resulting iso file
- will be relative to the larch build area (CHROOT_DIR_BUILD) in the
- chroot directory, otherwise as specified to the -o option.
- """
- medium = Medium(options)
- ipath = medium.chrootpath
- build = medium.build
-
- # Write bootloader configuration file
- bootconfig(build, options.syslinux)
-
- if not os.path.isfile(medium.medium_dir + '/larch/larchboot'):
- add_larchboot(build)
-
- # Need to adjust paths to cater for chroot!
- source0 = medium.chroot_medium_dir()
- isopath0 = medium.iso_path()
-
- # Select bootloader
- if options.syslinux:
- # Get fresh isolinux.bin
- runcmd('cp %s/boot/isolinux/isolinux.bin0 %s/boot/isolinux/isolinux.bin'
- % (build, build))
- parms = '-b boot/isolinux/isolinux.bin -c boot/isolinux/isolinux.boot'
- # Select bootloader
- else:
- parms = '-b boot/grub/stage2_eltorito'
-
- # Actually the volume label can be 32 bytes, but 16 is compatible
- # with ext2 (though a little longer than vfat)
- label = check_label(options.label, 16)
- # Build iso
- if not chroot(ipath, ('mkisofs -R -l %s -no-emul-boot -boot-load-size 4'
- ' -boot-info-table -input-charset=UTF-8'
- ' -V "%s"'
- ' -o "%s"'
- ' -x "%s/boot"'
- ' -x "%s/larch/save"'
- ' "%s" "%s"') % (parms, label, isopath0,
- source0, source0, source0, BUILD0),
- filter=mkisofs_filter_gen()):
-
- errout(_("iso build failed"))
-
- # Process iso so that it can be 'dd'ed to a USB-stick
- if options.syslinux and not chroot(ipath, ('isohybrid %s' % isopath0)):
- errout(_("Couldn't perform 'isohybrid' operation on larch 'iso'"
- " (Not Critical!)"), 0)
- medium.unmount()
- runcmd('rm -rf %s' % build)
-
- comment(" *** %s ***" % (_("%s was successfully created")
- % (options.isofile)))
-
-
-
-if __name__ == "__main__":
- start_translator()
-
- from optparse import OptionParser, OptionGroup
- parser = OptionParser(usage=_("usage: %prog [options]"))
-
- parser.add_option("-p", "--profile", action="store", type="string",
- default="", dest="profile",
- help=_("Profile: 'user:profile-name' or path to profile directory"
- " (conflicts with -S)"))
- parser.add_option("-S", "--source", action="store", type="string",
- default="", dest="source",
- help=_("Source: path to larch medium image (conflicts with -p)."
- " It can also be a device ('/dev/...') or an 'iso' file."))
- parser.add_option("-i", "--installation-dir", action="store", type="string",
- default="", dest="idir",
- help=_("Path to larchified directory (default %s)") % INSTALLATION)
- parser.add_option("-s", "--slave", action="store_true", dest="slave",
- default=False, help=_("Run as a slave from a controlling program"
- " (e.g. from a gui)"))
- parser.add_option("-q", "--quiet", action="store_true", dest="quiet",
- default=False, help=_("Suppress output messages, except errors"
- " (no effect if -s specified)"))
-
- parser.add_option("-f", "--force", action="store_true", dest="force",
- default=False, help=_("Don't ask for confirmation"))
-
- parser.add_option("-b", "--isolinux", action="store_true", dest="syslinux",
- default=False, help=_("Use the isolinux bootloader"
- " (the default is GRUB)"))
- parser.add_option("-l", "--label", action="store", type="string",
- default=LABEL, dest="label",
- help=_("Volume label for iso (default '%s')") % LABEL)
- parser.add_option("-o", "--isofile", action="store", type="string",
- default=ISOFILE, dest="isofile",
- help=_("Specify the output file (default '%s'). It will be"
- " generated to the current directory.") % ISOFILE)
- parser.add_option("-D", "--setdir", action="store", type="string",
- dest='setdir', default='',
- help=_("Set current directory,"
- " so that the 'iso' can be placed there"))
- parser.add_option("-C", "--chroot", action="store_true",
- dest="chroot", default=False,
- help=_("Use chroot for build (default when -S not specified)"))
- parser.add_option("-c", "--nochroot", action="store_true",
- dest="nochroot", default=False,
- help=_("Don't use chroot for build (default when -S specified)"))
-
- parser.add_option('-T', '--testmedium', action='store_true',
- dest='testmedium', default=False,
- help=_("Test source medium only (used by gui)"))
-
- (options, args) = parser.parse_args()
-
- if os.getuid() != 0:
- print _("This application must be run as root")
- sys.exit(1)
-
- init('live_iso', options)
- build_iso(options)