diff options
Diffstat (limited to 'components')
-rwxr-xr-x | components/binary-hooks | 108 | ||||
-rwxr-xr-x | components/binary-includes | 101 | ||||
-rwxr-xr-x | components/bootstrap-cdebootstrap | 183 | ||||
-rwxr-xr-x | components/bootstrap-debootstrap | 180 | ||||
-rwxr-xr-x | components/bootstrap-hooks | 108 | ||||
-rwxr-xr-x | components/bootstrap-includes | 100 | ||||
-rwxr-xr-x | components/chroot-hooks | 108 | ||||
-rwxr-xr-x | components/chroot-includes | 100 | ||||
-rwxr-xr-x | components/init | 165 | ||||
-rwxr-xr-x | components/source-hooks | 108 | ||||
-rwxr-xr-x | components/source-includes | 101 |
11 files changed, 0 insertions, 1362 deletions
diff --git a/components/binary-hooks b/components/binary-hooks deleted file mode 100755 index 20c5c0190..000000000 --- a/components/binary-hooks +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 binary-hooks', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The binary-hooks command executes hook files after the binary stage.''', - epilog = 'See \'man lb-binary-hooks\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Calling binary hooks - - # stagefile - if os.path.isfile('.build/binary-hooks'): - if verbose: - print('I: binary-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.binary'): - if verbose: - print ('I: no binary hooks found at config/hooks/*.hook{,.binary} - nothing to do') - - sys.exit(0) - - # bind mount configuration directory - if verbose: - print('I: Mounting config to binary/live-build/config') - - os.makedirs('binary/live-build/config', exist_ok=True) - - mount = subprocess.check_call('mount -o bind config binary/live-build/config', shell=True) - remount = subprocess.check_call('mount -o remount,ro,bind binary/live-build/config', shell=True) - - # process hooks - os.makedirs('binary/live-build', exist_ok=True) - - hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.binary') - - for hook in sorted(hooks): - if verbose: - print('I: Copying config/hooks/*.hook.binary to binary/live-build') - - shutil.copy(hook, os.path.join('binary/live-build/' + os.path.basename(hook)), follow_symlinks=True) - - if verbose: - print('I: Executing \' ' + hook + '\'') - - os.chmod(hook, 0o755) - exec_hook = subprocess.check_call('cd binary && live-build/' + os.path.basename(hook), shell=True) - os.remove('binary/live-build/' + os.path.basename(hook)) - - # unmount coniguration directory - umount = subprocess.check_call('umount binary/live-build/config', shell=True) - - os.rmdir('binary/live-build/config') - os.rmdir('binary/live-build') - - ## stagefile - os.makedirs('.build', exist_ok=True) - open('.build/binary-hooks', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/binary-includes b/components/binary-includes deleted file mode 100755 index 5b829aeba..000000000 --- a/components/binary-includes +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 -# * derefence or remove symlinks if binary filesystem does not support them - -def main(): - ## Parsing Arguments - arguments = argparse.ArgumentParser( - prog = 'lb binary-includes', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The binary-includes command copies include files into the binary stage.''', - epilog = 'See \'man lb-binary-includes\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Copying binary includes - - # stagefile - if os.path.isfile('.build/binary-includes'): - if verbose: - print('I: binary-includes 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) - - if not os.path.isfile('/bin/cpio'): - print('E: /bin/cpio - no such file', file=sys.stderr) - - if verbose: - print('I: cpio can be obtained from:\n' - 'I: http://www.gnu.org/software/cpio/\n' - 'I: http://ftp.gnu.org/gnu/cpio/\n' - 'I: On Debian based systems, cpio can be installed with:\n' - 'I: # sudo apt-get install cpio') - - sys.exit(1) - - # includes - if not glob.glob('config/includes/*') and not glob.glob('config/includes/.*') and not glob.glob('config/includes.binary/*') and not glob.glob('config/includes.binary/.*'): - if verbose: - print ('I: no binary includes found at config/includes{,.binary} - nothing to do') - - sys.exit(0) - - # process includes - if glob.glob('config/includes/*') or glob.glob('config/includes/.*'): - if verbose: - print('I: Copying config/includes to binary') - - cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True) - - if glob.glob('config/includes.binary/*') or glob.glob('config/includes.binary/.*'): - if verbose: - print('I: Copying config/includes.binary to binary') - - cpio = subprocess.check_call('cd config/includes.binary && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True) - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/binary-includes', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/bootstrap-cdebootstrap b/components/bootstrap-cdebootstrap deleted file mode 100755 index 59c83c8df..000000000 --- a/components/bootstrap-cdebootstrap +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 -# * cdebootstrap-options from config/options/cdebootstrap -# * take mirrors from config/archives/mirror.{bootstrap,chroot} - -def main(): - ## Parsing Arguments - arguments = argparse.ArgumentParser( - prog = 'lb bootstrap-cdebootstrap', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The bootstrap-cdebootstrap command bootstraps the chroot system with cdebootstrap.''', - epilog = 'See \'man lb-bootstrap-cdebootstrap\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - arguments.add_argument('--cdebootstrap-options', help='set cdebootstrap(1) options' ) - - args = arguments.parse_args() - - ## Parsing Configuration - if not os.path.isfile('config/build'): - print('E: config/build - no such file', file=sys.stderr) - - sys.exit(1) - - config = configparser.ConfigParser() - - config.read('config/build') - - try: - architecture = config.get('Image', 'Architecture') - distribution = config.get('Image', 'Parent-Distribution') - mirror_bootstrap = config.get('Image', 'Parent-Mirror-Bootstrap') - except: - distribution = config.get('Image', 'Distribution') - mirror_bootstrap = config.get('Image', 'Mirror-Bootstrap') - - # --verbose - verbose = args.verbose - - # --cdebootstrap-options - cdebootstrap_options_late = distribution + ' chroot ' + mirror_bootstrap - - cdebootstrap_options_early = '' - - if (architecture) and (not architecture == 'auto'): - cdebootstrap_options_early = cdebootstrap_options_early + ' --arch=' + architecture - - if args.cdebootstrap_options: - cdebootstrap_options = cdebootstrap_options_early + ' ' + args.cdebootstrap_options + ' ' + cdebootstrap_options_late - else: - cdebootstrap_options = cdebootstrap_options_early + ' ' + cdebootstrap_options_late - - ## Calling cdebootstrap - - # stagefile - if os.path.isfile('.build/bootstrap'): - if verbose: - print('I: bootstrap already done - nothing to do') - - sys.exit(0) - - # dependencies - if not os.path.isfile('/usr/bin/cdebootstrap'): - print('E: /usr/bin/cdebootstrap - no such file', file=sys.stderr) - - if verbose: - print('I: cdebootstrap can be obtained from:\n' - 'I: http://anonscm.debian.org/gitweb/?p=users/waldi/cdebootstrap.git\n' - 'I: http://ftp.debian.org/debian/pool/main/c/cdebootstrap/\n' - 'I: On Debian based systems, cdebootstrap can be installed with:\n' - 'I: # sudo apt-get install cdebootstrap') - - sys.exit(1) - - # clean - if os.path.exists('chroot'): - print('E: chroot already exists - unclean build', file=sys.stderr) - - if verbose: - print('I: use \'lb clean\' to clean up a previously incomplete build') - - sys.exit(1) - - # stage cache - if os.path.exists('cache/bootstrap'): - if verbose: - print('I: Copying cache/bootstrap to chroot') - - # Notes: - # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. - cache = subprocess.check_call('cp -a cache/bootstrap chroot', shell=True) - - os.makedirs('.build', exist_ok=True) - open('.build/bootstrap', 'w').close() - - sys.exit(0) - - # packages cache - if glob.glob('cache/packages.bootstrap/*.deb'): - if verbose: - print('I: Copying cache/packages.bootstrap/*.deb to chroot/var/cache/bootstrap/*.deb') - - # Notes: - # * copy instead of move to make cache survive incomplete build - os.makedirs('chroot/var/cache/bootstrap', exist_ok=True) - - for package in glob.glob('cache/packages.bootstrap/*.deb'): - os.link(package, os.path.join('chroot/var/cache/bootstrap/' + os.path.basename(package))) - else: - # cdebootstrap - if verbose: - print('I: Calling \'/usr/bin/debootstrap --download-only ' + cdebootstrap_options + '\'') - - # Notes: - # * calling cdebootstrap twice: - # - to use already downloaded /var/cache/bootstrap/*.deb on incomplete builds - # - to use /var/cache/boottrap/*.deb for debian-installer - cdebootstrap = subprocess.check_call('/usr/bin/cdebootstrap --download-only ' + cdebootstrap_options, shell=True) - - # package cache - if glob.glob('chroot/var/cache/bootstrap/*.deb'): - if verbose: - print('I: Copying chroot/var/cache/bootstrap/*.deb to cache/packages.bootstrap') - - # Notes: - # * remove first to keep cache minimal - # * remove files instead of directory to work with symlinked directory - for package in glob.glob('cache/packages.bootstrap/*.deb'): - os.remove(package) - - os.makedirs('cache/packages.bootstrap', exist_ok=True) - - for package in glob.glob('chroot/var/cache/bootstrap/*.deb'): - shutil.copy2(package, 'cache/packages.bootstrap') - - # cdebootstrap - if not os.path.exists('chroot/bin'): - if verbose: - print('I: Calling \'/usr/bin/debootstrap ' + cdebootstrap_options + '\'') - - cdebootstrap = subprocess.check_call('/usr/bin/cdebootstrap ' + cdebootstrap_options, shell=True) - - # stage cache - if not os.path.exists('cache/bootstrap'): - if verbose: - print('I: Copying chroot to cache/bootstrap') - - # Notes: - # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. - cache = subprocess.check_call('cp -a chroot cache/bootstrap', shell=True) - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/bootstrap', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/bootstrap-debootstrap b/components/bootstrap-debootstrap deleted file mode 100755 index 70974be6e..000000000 --- a/components/bootstrap-debootstrap +++ /dev/null @@ -1,180 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 -# * debootstrap-options from config/options/debootstrap -# * take mirrors from config/archives/mirror.{bootstrap,chroot} - -def main(): - ## Parsing Arguments - arguments = argparse.ArgumentParser( - prog = 'lb bootstrap-debootstrap', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The bootstrap-debootstrap command bootstraps the chroot system with debootstrap.''', - epilog = 'See \'man lb-bootstrap-debootstrap\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - arguments.add_argument('--debootstrap-options', help='set debootstrap(8) options' ) - - args = arguments.parse_args() - - ## Parsing Configuration - if not os.path.isfile('config/build'): - print('E: config/build - no such file', file=sys.stderr) - - sys.exit(1) - - config = configparser.ConfigParser() - - config.read('config/build') - - try: - architecture = config.get('Image', 'Architecture') - archive_areas = config.get('Image', 'Parent-Archive-Areas') - distribution = config.get('Image', 'Parent-Distribution') - mirror_bootstrap = config.get('Image', 'Parent-Mirror-Bootstrap') - except: - archive_areas = config.get('Image', 'Archive-Areas') - distribution = config.get('Image', 'Distribution') - mirror_bootstrap = config.get('Image', 'Mirror-Bootstrap') - - # --verbose - verbose = args.verbose - - # --debootstrap-options - debootstrap_options_late = distribution + ' chroot ' + mirror_bootstrap - - debootstrap_options_early = '' - - if (architecture) and (not architecture == 'auto'): - debootstrap_options_early = debootstrap_options_early + ' --arch=' + architecture - - if (archive_areas) and (not archive_areas == 'main'): - debootstrap_options_early = debootstrap_options_early + ' --components=' + archive_areas.replace(' ',',') - - if args.debootstrap_options: - debootstrap_options = debootstrap_options_early + ' ' + args.debootstrap_options + ' ' + debootstrap_options_late - else: - debootstrap_options = debootstrap_options_early + ' ' + debootstrap_options_late - - ## Calling debootstrap - - # stagefile - if os.path.isfile('.build/bootstrap'): - if verbose: - print('I: bootstrap already done - nothing to do') - - sys.exit(0) - - # dependencies - if not os.path.isfile('/usr/sbin/debootstrap'): - print('E: /usr/sbin/debootstrap - no such file', file=sys.stderr) - - if verbose: - print('I: debootstrap can be obtained from:\n' - 'I: http://anonscm.debian.org/gitweb/?p=d-i/debootstrap.git\n' - 'I: http://ftp.debian.org/debian/pool/main/d/debootstrap/\n' - 'I: On Debian based systems, debootstrap can be installed with:\n' - 'I: # sudo apt-get install debootstrap') - - sys.exit(1) - - # clean - if os.path.exists('chroot'): - print('E: chroot already exists - unclean build', file=sys.stderr) - - if verbose: - print('I: use \'lb clean\' to clean up a previously incomplete build') - - sys.exit(1) - - # stage cache - if os.path.exists('cache/bootstrap'): - if verbose: - print('I: Copying cache/bootstrap to chroot') - - # Notes: - # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. - cache = subprocess.check_call('cp -a cache/bootstrap chroot', shell=True) - - os.makedirs('.build', exist_ok=True) - open('.build/bootstrap', 'w').close() - - sys.exit(0) - - # packages cache - if glob.glob('cache/packages.bootstrap/*.deb'): - if verbose: - print('I: Copying cache/packages.bootstrap/*.deb to chroot/var/cache/apt/archives/*.deb') - - # Notes: - # * copy instead of move to make cache survive incomplete build - os.makedirs('chroot/var/cache/apt/archives', exist_ok=True) - - for package in glob.glob('cache/packages.bootstrap/*.deb'): - os.link(package, os.path.join('chroot/var/cache/apt/archives/' + os.path.basename(package))) - - # debootstrap - if not os.path.exists('chroot/bin'): - if verbose: - print('I: Calling \'/usr/sbin/debootstrap ' + debootstrap_options + '\'') - - debootstrap = subprocess.check_call('/usr/sbin/debootstrap ' + debootstrap_options, shell=True) - - # package cache - if glob.glob('chroot/var/cache/apt/archives/*.deb'): - if verbose: - print('I: Copying chroot/var/cache/apt/archives/*.deb to cache/packages.bootstrap') - - # Notes: - # * remove first to keep cache minimal, - # * remove files instead of directory to work with symlinked directory - for package in glob.glob('cache/packages.bootstrap/*.deb'): - os.remove(package) - - os.makedirs('cache/packages.bootstrap', exist_ok=True) - - # Notes: - # * move instead of copy to keep stage minimal - for package in glob.glob('chroot/var/cache/apt/archives/*.deb'): - shutil.move(package, 'cache/packages.bootstrap') - - # stage cache - if not os.path.exists('cache/bootstrap'): - if verbose: - print('I: Copying chroot to cache/bootstrap') - - # Notes: - # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. - cache = subprocess.check_call('cp -a chroot cache/bootstrap', shell=True) - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/bootstrap', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/bootstrap-hooks b/components/bootstrap-hooks deleted file mode 100755 index 694d66b95..000000000 --- a/components/bootstrap-hooks +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 bootstrap-hooks', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The bootstrap-hooks command executes hook files after the bootstrap stage.''', - epilog = 'See \'man lb-bootstrap-hooks\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Calling bootstrap hooks - - # stagefile - if os.path.isfile('.build/bootstrap-hooks'): - if verbose: - print('I: bootstrap-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.bootstrap'): - if verbose: - print ('I: no bootstrap hooks found at config/hooks/*.hook{,.bootstrap} - 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.check_call('mount -o bind config chroot/live-build/config', shell=True) - remount = subprocess.check_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.bootstrap') - - for hook in sorted(hooks): - if verbose: - print('I: Copying config/hooks/*.hook.bootstrap to chroot/live-build') - - shutil.copy(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.check_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.check_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/bootstrap-hooks', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/bootstrap-includes b/components/bootstrap-includes deleted file mode 100755 index 2ce677282..000000000 --- a/components/bootstrap-includes +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 bootstrap-includes', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The bootstrap-includes command copies include files into the bootstrap stage.''', - epilog = 'See \'man lb-bootstrap-includes\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Copying bootstrap includes - - # stagefile - if os.path.isfile('.build/bootstrap-includes'): - if verbose: - print('I: bootstrap-includes 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) - - if not os.path.isfile('/bin/cpio'): - print('E: /bin/cpio - no such file', file=sys.stderr) - - if verbose: - print('I: cpio can be obtained from:\n' - 'I: http://www.gnu.org/software/cpio/\n' - 'I: http://ftp.gnu.org/gnu/cpio/\n' - 'I: On Debian based systems, cpio can be installed with:\n' - 'I: # sudo apt-get install cpio') - - sys.exit(1) - - # includes - if not glob.glob('config/includes/*') and not glob.glob('config/includes/.*') and not glob.glob('config/includes.bootstrap/*') and not glob.glob('config/includes.bootstrap/.*'): - if verbose: - print ('I: no bootstrap includes found at config/includes{,.bootstrap} - nothing to do') - - sys.exit(0) - - # process includes - if glob.glob('config/includes/*') or glob.glob('config/includes/.*'): - if verbose: - print('I: Copying config/includes to chroot') - - cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True) - - if glob.glob('config/includes.bootstrap/*') or glob.glob('config/includes.bootstrap/.*'): - if verbose: - print('I: Copying config/includes.bootstrap to chroot') - - cpio = subprocess.check_call('cd config/includes.bootstrap && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True) - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/bootstrap-includes', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/chroot-hooks b/components/chroot-hooks deleted file mode 100755 index 6d973afea..000000000 --- a/components/chroot-hooks +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 hook files after the chroot stage.''', - epilog = 'See \'man lb-chroot-hooks\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Calling chroot 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.check_call('mount -o bind config chroot/live-build/config', shell=True) - remount = subprocess.check_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 sorted(hooks): - if verbose: - print('I: Copying config/hooks/*.hook.chroot to chroot/live-build') - - shutil.copy(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.check_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.check_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() diff --git a/components/chroot-includes b/components/chroot-includes deleted file mode 100755 index a961db6cf..000000000 --- a/components/chroot-includes +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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-includes', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The chroot-includes command copies include files into the chroot stage.''', - epilog = 'See \'man lb-chroot-includes\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Copying chroot includes - - # stagefile - if os.path.isfile('.build/chroot-includes'): - if verbose: - print('I: chroot-includes 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) - - if not os.path.isfile('/bin/cpio'): - print('E: /bin/cpio - no such file', file=sys.stderr) - - if verbose: - print('I: cpio can be obtained from:\n' - 'I: http://www.gnu.org/software/cpio/\n' - 'I: http://ftp.gnu.org/gnu/cpio/\n' - 'I: On Debian based systems, cpio can be installed with:\n' - 'I: # sudo apt-get install cpio') - - sys.exit(1) - - # includes - if not glob.glob('config/includes/*') and not glob.glob('config/includes/.*') and not glob.glob('config/includes.chroot/*') and not glob.glob('config/includes.chroot/.*'): - if verbose: - print ('I: no chroot includes found at config/includes{,.chroot} - nothing to do') - - sys.exit(0) - - # process includes - if glob.glob('config/includes/*') or glob.glob('config/includes/.*'): - if verbose: - print('I: Copying config/includes to chroot') - - cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True) - - if glob.glob('config/includes.chroot/*') or glob.glob('config/includes.chroot/.*'): - if verbose: - print('I: Copying config/includes.chroot to chroot') - - cpio = subprocess.check_call('cd config/includes.chroot && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True) - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/chroot-includes', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/init b/components/init deleted file mode 100755 index c6eb21992..000000000 --- a/components/init +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 -import urllib.request - - -# TODO: -# * logfile output -# * lockfile handling -# * use gettext for i18n - -def main(): - ## Parsing Arguments - arguments = argparse.ArgumentParser( - prog = 'lb init', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The init command creates an empty configuration directory or reinitialize an existing one.''', - epilog = 'See \'man lb-init\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - arguments.add_argument('--distribution', help='set default distribution') - arguments.add_argument('--project', help='set project defaults') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - # --distribution - distribution = args.distribution - - # --project - project = args.project - - ## Setting defaults - - if not project: - # FIXME: hardcoded project information - project = 'debian' - - if not distribution: - # FIXME hardcoded release information - default_distribution = { 'debian' : 'jessie', - 'progress-linux' : 'cairon', - } - - distribution = default_distribution[project] - - ## Creating configuration directory - - # stagefile - if os.path.isdir('.build'): - if verbose: - print('I: configuration directory already initialized - nothing to do') - - # Notes: - # * until further tests, we do not allow to re-run lb init on an already initialized directory. - sys.exit(0) - - # Print warning about live-build development version - print('WARNING: THIS VERSION OF LIVE-BUILD IS EXPERIMENTAL\n') - - print('IT IS UNFINISHED AND CHANGES HEAVILY WITHOUT PRIOR NOTICE.') - print('USER DISCRETION IS ADVISED.\n') - - print('Please also note that you are running a live-build development version') - print('and that we are only supporting the newest development version.\n') - - print('Make sure you are using the newest version at all times.') - - # Configuring default archive-keys - if (project == 'progress-linux'): - # dependencies - if not os.path.isfile('/usr/bin/gpgv'): - print('E: /usr/bin/gpgv - no such file', file=sys.stderr) - - if verbose: - print('I: gnupg can be obtained from:\n' - 'I: http://www.gnupg.org/\n' - 'I: On Debian based systems, gnupg can be installed with:\n' - 'I: # sudo apt-get install gnupg') - - sys.exit(1) - - os.makedirs('config/archives', exist_ok=True) - - # FIXME hardcoded release information - archive_keys_url = 'http://cdn.archive.progress-linux.org/packages/project/keys/' - - archive_keys = { 'artax' : [ 'archive-key-1-artax.asc' , 'archive-key-1+-artax-backports.asc' ], - 'artax-backports' : [ 'archive-key-1-artax.asc' , 'archive-key-1+-artax-backports.asc' ], - 'baureo' : [ 'archive-key-2-baureo.asc' , 'archive-key-2+-baureo-backports.asc' ], - 'baureo-backports' : [ 'archive-key-2-baureo.asc' , 'archive-key-2+-baureo-backports.asc' ], - 'cairon' : [ 'archive-key-3-cairon.asc' , 'archive-key-3+-cairon-backports.asc' ], - 'cairon-backports' : [ 'archive-key-3-cairon.asc' , 'archive-key-3+-cairon-backports.asc' ], - } - - keys = archive_keys[distribution] - - for key in keys: - url = archive_keys_url + key - target = os.path.splitext(os.path.basename(key)) - - if verbose: - print('I: Downloading ' + url) - - r = urllib.request.urlopen(url) - f = open('config/archives/' + target[0] + '.key', 'w') - - f.write(r.read()) - - # FIXME: download signatures and verify them against debian-keyring - - # Configuring default hooks - os.makedirs('config/hooks', exist_ok=True) - - for hook in glob.glob('/usr/share/live/build/hooks/*.hook*'): - os.symlink(hook, os.path.join('config/hooks/' + os.path.basename(hook))) - - # Configuring default includes - os.makedirs('config/includes', exist_ok=True) - os.makedirs('config/includes.bootstrap', exist_ok=True) - os.makedirs('config/includes.chroot', exist_ok=True) - os.makedirs('config/includes.binary', exist_ok=True) - os.makedirs('config/includes.source', exist_ok=True) - - # Ensure correct include directory permissions avoiding tainting of target system - os.chmod('config/includes', 0o755) - os.chmod('config/includes.bootstrap', 0o755) - os.chmod('config/includes.chroot', 0o755) - os.chmod('config/includes.binary', 0o755) - os.chmod('config/includes.source', 0o755) - - # Configuring default package lists - os.makedirs('config/package-lists', exist_ok=True) - - f = open('config/package-lists/live.list.chroot', 'w') - f.write('live-boot\nlive-config\nlive-config-sysvinit\n') - f.close() - - ## stagefile - os.makedirs('.build', exist_ok=True) - - -if __name__ == '__main__': - main() diff --git a/components/source-hooks b/components/source-hooks deleted file mode 100755 index 552e228da..000000000 --- a/components/source-hooks +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 source-hooks', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The source-hooks command executes hook files after the source stage.''', - epilog = 'See \'man lb-source-hooks\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Calling source hooks - - # stagefile - if os.path.isfile('.build/source-hooks'): - if verbose: - print('I: source-hooks already done - nothing to do') - - sys.exit(0) - - # dependencies - if not os.path.isfile('.build/source'): - print('E: source stage missing - aborting', file=sys.stderr) - - if verbose: - print('I: use \'lb source\' to source system') - - sys.exit(1) - - # hooks - if not glob.glob('config/hooks/*.hook') and not glob.glob('config/hooks/*.hook.source'): - if verbose: - print ('I: no source hooks found at config/hooks/*.hook{,.source} - nothing to do') - - sys.exit(0) - - # bind mount configuration directory - if verbose: - print('I: Mounting config to source/live-build/config') - - os.makedirs('source/live-build/config', exist_ok=True) - - mount = subprocess.check_call('mount -o bind config source/live-build/config', shell=True) - remount = subprocess.check_call('mount -o remount,ro,bind source/live-build/config', shell=True) - - # process hooks - os.makedirs('source/live-build', exist_ok=True) - - hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.source') - - for hook in sorted(hooks): - if verbose: - print('I: Copying config/hooks/*.hook.source to source/live-build') - - shutil.copy(hook, os.path.join('source/live-build/' + os.path.basename(hook)), follow_symlinks=True) - - if verbose: - print('I: Executing \' ' + hook + '\'') - - os.chmod(hook, 0o755) - exec_hook = subprocess.check_call('cd source && live-build/' + os.path.basename(hook), shell=True) - os.remove('source/live-build/' + os.path.basename(hook)) - - # unmount coniguration directory - umount = subprocess.check_call('umount source/live-build/config', shell=True) - - os.rmdir('source/live-build/config') - os.rmdir('source/live-build') - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/source-hooks', 'w').close() - - -if __name__ == '__main__': - main() diff --git a/components/source-includes b/components/source-includes deleted file mode 100755 index 85eca1482..000000000 --- a/components/source-includes +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/python3 - -## live-build(7) - Live System Build Components -## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch> -## -## 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 -# * derefence or remove symlinks if source filesystem does not support them - -def main(): - ## Parsing Arguments - arguments = argparse.ArgumentParser( - prog = 'lb source-includes', - usage = '%(prog)s [arguments]', - description = '''live-build contains the components to build a live system from a configuration directory. - The source-includes command copies include files into the source stage.''', - epilog = 'See \'man lb-source-includes\' for more information.', - formatter_class = argparse.ArgumentDefaultsHelpFormatter - ) - - arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4') - arguments.add_argument('--verbose', help='set verbose option', action='store_true') - - args = arguments.parse_args() - - # --verbose - verbose = args.verbose - - ## Copying source includes - - # stagefile - if os.path.isfile('.build/source-includes'): - if verbose: - print('I: source-includes 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) - - if not os.path.isfile('/bin/cpio'): - print('E: /bin/cpio - no such file', file=sys.stderr) - - if verbose: - print('I: cpio can be obtained from:\n' - 'I: http://www.gnu.org/software/cpio/\n' - 'I: http://ftp.gnu.org/gnu/cpio/\n' - 'I: On Debian based systems, cpio can be installed with:\n' - 'I: # sudo apt-get install cpio') - - sys.exit(1) - - # includes - if not glob.glob('config/includes/*') and not glob.glob('config/includes/.*') and not glob.glob('config/includes.source/*') and not glob.glob('config/includes.source/.*'): - if verbose: - print ('I: no source includes found at config/includes{,.source} - nothing to do') - - sys.exit(0) - - # process includes - if glob.glob('config/includes/*') or glob.glob('config/includes/.*'): - if verbose: - print('I: Copying config/includes to source') - - cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../source', shell=True) - - if glob.glob('config/includes.source/*') or glob.glob('config/includes.source/.*'): - if verbose: - print('I: Copying config/includes.source to source') - - cpio = subprocess.check_call('cd config/includes.source && find . | cpio -dmpu --no-preserve-owner ../../source', shell=True) - - # stagefile - os.makedirs('.build', exist_ok=True) - open('.build/source-includes', 'w').close() - - -if __name__ == '__main__': - main() |