From 52122b28451ec441e037e4003dfecf5ecc21853c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 4 Nov 2013 07:00:25 +0100 Subject: Moving python stubs to their own subdirectory within the source tree. --- scripts/build/chroot_hooks | 108 --------------------------------------------- 1 file changed, 108 deletions(-) delete mode 100755 scripts/build/chroot_hooks (limited to 'scripts/build/chroot_hooks') diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks deleted file mode 100755 index ce2287a57..000000000 --- a/scripts/build/chroot_hooks +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2013 Daniel Baumann -## -## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -## This is free software, and you are welcome to redistribute it -## under certain conditions; see COPYING for details. - - -import argparse -import configparser -import glob -import os -import shutil -import subprocess -import sys - - -# TODO: -# * logfile output -# * lockfile handling -# * use gettext for i18n - -def main(): - ## Parsing Arguments - arguments = argparse.ArgumentParser( - prog = 'lb chroot_hooks', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The chroot_hooks command executes hooks after the chroot stage.''', - epilog = 'See \'man lb_chroot_hooks\' for more information.', - version = 'live-build 4', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Executing hooks - - # stagefile - if os.path.isfile('.build/chroot_hooks'): - if verbose: - print('I: chroot_hooks already done - nothing to do') - - sys.exit(0) - - # dependencies - if not os.path.isfile('.build/bootstrap'): - print('E: bootstrap stage missing - aborting', file=sys.stderr) - - if verbose: - print('I: use \'lb bootstrap\' to bootstrap system') - - sys.exit(1) - - # hooks - if not glob.glob('config/hooks/*.hook') and not glob.glob('config/hooks/*.hook.chroot'): - if verbose: - print ('I: no chroot hooks found at config/hooks/*.hook{,.chroot} - nothing to do') - - sys.exit(0) - - # bind mount configuration directory - if verbose: - print('I: Mounting config to chroot/live-build/config') - - os.makedirs('chroot/live-build/config', exist_ok=True) - - mount = subprocess.call('mount -o bind config chroot/live-build/config', shell=True) - remount = subprocess.call('mount -o remount,ro,bind chroot/live-build/config', shell=True) - - # process hooks - os.makedirs('chroot/live-build', exist_ok=True) - - hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.chroot') - - for hook in hooks: - if verbose: - print('I: Copying config/hooks/*.hook.chroot to chroot/live-build') - - os.link(hook, os.path.join('chroot/live-build/' + os.path.basename(hook)), follow_symlinks=True) - - if verbose: - print('I: Executing \' ' + hook + '\'') - - os.chmod(hook, 0o755) - exec_hook = subprocess.call('chroot chroot /live-build/' + os.path.basename(hook), shell=True) - os.remove('chroot/live-build/' + os.path.basename(hook)) - - # unmount coniguration directory - umount = subprocess.call('umount chroot/live-build/config', shell=True) - - os.rmdir('chroot/live-build/config') - os.rmdir('chroot/live-build') - - ## stagefile - os.makedirs('.build', exist_ok=True) - open('.build/chroot_hooks', 'w').close() - - -if __name__ == '__main__': - main() -- cgit v1.2.3