Compare commits
17 Commits
master
...
tmp-python
Author | SHA1 | Date |
---|---|---|
Daniel Baumann | 6bd4253bfa | |
Daniel Baumann | d1982cbd94 | |
Daniel Baumann | 86b6ed3e39 | |
Daniel Baumann | 84afa594d6 | |
Daniel Baumann | 22c8569f53 | |
Daniel Baumann | 50cd46d209 | |
Daniel Baumann | 294b8b1602 | |
Daniel Baumann | 0e197eacb7 | |
Daniel Baumann | 5203e46e9d | |
Daniel Baumann | b78f2db21d | |
Daniel Baumann | 6217527ed4 | |
Daniel Baumann | a3e93f9c57 | |
Daniel Baumann | 1fe3b72c63 | |
Daniel Baumann | 1db5b4a96e | |
Daniel Baumann | 7ce82acee7 | |
Daniel Baumann | 33aaf3617f | |
Daniel Baumann | d735e034eb |
12
Makefile
12
Makefile
|
@ -4,7 +4,7 @@ SHELL := sh -e
|
|||
|
||||
LANGUAGES = $(shell cd manpages/po && ls)
|
||||
|
||||
SCRIPTS = frontend/* functions/* examples/auto/* examples/hooks/*.chroot examples/hooks/reproducible/*.chroot scripts/*.sh scripts/*/* share/bin/* share/hooks/*/*
|
||||
SCRIPTS = frontend/cli/* frontend/cgi/live-build-cgi frontend/cgi/live-build-cgi.cron functions/* examples/auto/* examples/hooks/* scripts/*.sh scripts/*/* share/bin/* share/hooks/*
|
||||
|
||||
all: build
|
||||
|
||||
|
@ -29,7 +29,7 @@ test:
|
|||
echo -n "."; \
|
||||
done; \
|
||||
else \
|
||||
echo "WARNING: Skipping bashism test - you need to install devscripts."; \
|
||||
echo "WARNING: skipping bashism test - you need to install devscripts."; \
|
||||
fi
|
||||
|
||||
@echo " done."
|
||||
|
@ -40,16 +40,16 @@ build:
|
|||
install:
|
||||
# Installing shared data
|
||||
mkdir -p $(DESTDIR)/usr/share/live/build
|
||||
cp -r data functions $(DESTDIR)/usr/share/live/build
|
||||
sed -e 's/.*(\(.*\)).*/\1/; s/^[0-9]://; q' debian/changelog >$(DESTDIR)/usr/share/live/build/VERSION
|
||||
cp -r frontend/cgi data functions templates VERSION $(DESTDIR)/usr/share/live/build
|
||||
cp -r share/* $(DESTDIR)/usr/share/live/build
|
||||
|
||||
# Installing executables
|
||||
mkdir -p $(DESTDIR)/usr/bin
|
||||
cp -a frontend/* $(DESTDIR)/usr/bin
|
||||
cp -a frontend/cli/* $(DESTDIR)/usr/bin
|
||||
|
||||
mkdir -p $(DESTDIR)/usr/lib/live
|
||||
cp -a scripts/* $(DESTDIR)/usr/lib/live
|
||||
cp -a components/* $(DESTDIR)/usr/lib/live/build
|
||||
|
||||
# Installing documentation
|
||||
mkdir -p $(DESTDIR)/usr/share/doc/live-build
|
||||
|
@ -103,5 +103,3 @@ clean:
|
|||
distclean:
|
||||
|
||||
reinstall: uninstall install
|
||||
|
||||
.PHONY: all test build install uninstall clean distclean reinstall
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
live-build 4.x is transitioning from shell scripts to Python scripts.
|
||||
|
||||
In order to ensure a smooth transition without breaks until completion,
|
||||
one component at the time is being rewritten and re-documented without
|
||||
interconnection between them.
|
||||
|
||||
Once done, the newly Python sources will be shaped into modules and
|
||||
subcommands properly.
|
||||
|
||||
---
|
||||
|
||||
Some notes on coding style:
|
||||
|
||||
* live-build commands should be *prefixed* with the stage:
|
||||
chroot-includes, not includes-chroot; -> tab-completion
|
||||
|
||||
* directories/files in the config directory should be *suffixed* with the stage:
|
||||
includes.chroot, not chroot.includes; -> sort-order
|
||||
|
||||
* cli arguments should be *suffixed* with the stage:
|
||||
--mirror-bootstrap, not --bootstrap-mirror; -> tab-completion
|
|
@ -0,0 +1,108 @@
|
|||
#!/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 configuration 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()
|
|
@ -0,0 +1,101 @@
|
|||
#!/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()
|
|
@ -0,0 +1,183 @@
|
|||
#!/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.conf'):
|
||||
print('E: config/build.conf - no such file', file=sys.stderr)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
config.read('config/build.conf')
|
||||
|
||||
try:
|
||||
architecture = config.get('build', 'Architecture')
|
||||
distribution = config.get('build', 'Parent-Distribution')
|
||||
mirror_bootstrap = config.get('build', 'Parent-Mirror-Bootstrap')
|
||||
except:
|
||||
distribution = config.get('build', 'Distribution')
|
||||
mirror_bootstrap = config.get('build', '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()
|
|
@ -0,0 +1,182 @@
|
|||
#!/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 re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
# TODO:
|
||||
# * logfile output
|
||||
# * lockfile handling
|
||||
# * use gettext for i18n
|
||||
# * debootstrap-options from config/options/debootstrap
|
||||
|
||||
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.conf'):
|
||||
print('E: config/build.conf - no such file', file=sys.stderr)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config/build.conf')
|
||||
|
||||
architecture = config.get('build', 'architecture')
|
||||
distribution = config.get('build', 'parent-distribution')
|
||||
|
||||
# --verbose
|
||||
verbose = args.verbose
|
||||
|
||||
# mirror-bootstrap
|
||||
f = open('config/build.conf', 'r')
|
||||
|
||||
for line in f:
|
||||
if re.match('^deb ', line):
|
||||
mirror_bootstrap = line
|
||||
break
|
||||
|
||||
f.close()
|
||||
|
||||
# --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()
|
|
@ -0,0 +1,108 @@
|
|||
#!/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 configuration 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()
|
|
@ -0,0 +1,100 @@
|
|||
#!/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()
|
|
@ -0,0 +1,108 @@
|
|||
#!/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 configuration 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()
|
|
@ -0,0 +1,100 @@
|
|||
#!/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()
|
|
@ -0,0 +1,521 @@
|
|||
#!/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 platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
|
||||
# TODO:
|
||||
# * logfile output
|
||||
# * lockfile handling
|
||||
# * use gettext for i18n
|
||||
|
||||
def main():
|
||||
## early defaults detection
|
||||
architecture = platform.machine()
|
||||
|
||||
if (architecture == 'x86_64'):
|
||||
architecture = 'amd64'
|
||||
|
||||
## 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('--project', help='set project defaults', default='debian')
|
||||
arguments.add_argument('--system', help='set system type', default='live')
|
||||
arguments.add_argument('--architecture', help='set system architecture', default=architecture)
|
||||
|
||||
arguments.add_argument('--archive-areas', help='set default archive areas', default='main')
|
||||
arguments.add_argument('--parent-archive-areas', help='set default parent archive areas', default='main')
|
||||
|
||||
arguments.add_argument('--distribution', help='set default distribution', default='jessie')
|
||||
arguments.add_argument('--parent-distribution', help='set default parent distribution', default='jessie')
|
||||
|
||||
arguments.add_argument('--mirror-bootstrap', help='set default bootstrap mirror', default='http://ftp.debian.org/debian')
|
||||
arguments.add_argument('--parent-mirror-bootstrap', help='set default parent bootstrap mirror', default='http://ftp.debian.org/debian')
|
||||
|
||||
arguments.add_argument('--mirror-bootstrap-security', help='set default bootstrap security mirror', default='http://security.debian.org')
|
||||
arguments.add_argument('--parent-mirror-bootstrap-security', help='set default parent security bootstrap mirror', default='http://security.debian.org')
|
||||
|
||||
arguments.add_argument('--mirror-chroot', help='set default chroot mirror', default='http://ftp.debian.org/debian')
|
||||
arguments.add_argument('--parent-mirror-chroot', help='set default parent chroot mirror', default='http://ftp.debian.org/debian')
|
||||
|
||||
arguments.add_argument('--mirror-chroot-security', help='set default chroot security mirror', default='http://security.debian.org')
|
||||
arguments.add_argument('--parent-mirror-chroot-security', help='set default parent chroot security mirror', default='http://security.debian.org')
|
||||
|
||||
arguments.add_argument('--mirror-installer', help='set default installer mirror', default='http://ftp.debian.org/debian')
|
||||
arguments.add_argument('--parent-mirror-installer', help='set default parent installer mirror', default='http://ftp.debian.org/debian')
|
||||
|
||||
arguments.add_argument('--mirror-installer-security', help='set default installer security mirror', default='http://security.debian.org')
|
||||
arguments.add_argument('--parent-mirror-installer-security', help='set default parent installer security mirror', default='http://security.debian.org')
|
||||
|
||||
arguments.add_argument('--mirror-binary', help='set default binary mirror', default='http://ftp.debian.org/debian')
|
||||
arguments.add_argument('--parent-mirror-binary', help='set default parent binary mirror', default='http://ftp.debian.org/debian')
|
||||
|
||||
arguments.add_argument('--mirror-binary-security', help='set default binary security mirror', default='http://security.debian.org')
|
||||
arguments.add_argument('--parent-mirror-binary-security', help='set default parent binary security mirror', default='http://security.debian.org')
|
||||
|
||||
arguments.add_argument('--mirror-source', help='set default source mirror', default='http://ftp.debian.org/debian')
|
||||
arguments.add_argument('--parent-mirror-source', help='set default parent source mirror', default='http://ftp.debian.org/debian')
|
||||
|
||||
arguments.add_argument('--mirror-source-security', help='set default source security mirror', default='http://security.debian.org')
|
||||
arguments.add_argument('--parent-mirror-source-security', help='set default parent source security mirror', default='http://security.debian.org')
|
||||
|
||||
args = arguments.parse_args()
|
||||
|
||||
# --verbose
|
||||
verbose = args.verbose
|
||||
|
||||
# --project
|
||||
project = args.project
|
||||
|
||||
# --system
|
||||
system = args.system
|
||||
|
||||
# --architecture
|
||||
architecture = args.architecture
|
||||
|
||||
# --archive-areas
|
||||
archive_areas = args.archive_areas
|
||||
|
||||
# --parent-archive-areas
|
||||
parent_archive_areas = args.parent_archive_areas
|
||||
|
||||
# --distribution
|
||||
distribution = args.distribution
|
||||
|
||||
# --parent-distribution
|
||||
parent_distribution = args.parent_distribution
|
||||
|
||||
# --mirror-bootstrap
|
||||
mirror_bootstrap = args.mirror_bootstrap
|
||||
|
||||
# --parent-mirror-bootstrap
|
||||
parent_mirror_bootstrap = args.parent_mirror_bootstrap
|
||||
|
||||
# --mirror-bootstrap-security
|
||||
mirror_bootstrap_security = args.mirror_bootstrap_security
|
||||
|
||||
# --parent-mirror-bootstrap-security
|
||||
parent_mirror_bootstrap_security = args.parent_mirror_bootstrap_security
|
||||
|
||||
# --mirror-chroot
|
||||
mirror_chroot = args.mirror_chroot
|
||||
|
||||
# --parent-mirror-chroot
|
||||
parent_mirror_chroot = args.parent_mirror_chroot
|
||||
|
||||
# --mirror-chroot-security
|
||||
mirror_chroot_security = args.mirror_chroot_security
|
||||
|
||||
# --parent-mirror-chroot-security
|
||||
parent_mirror_chroot_security = args.parent_mirror_chroot_security
|
||||
|
||||
# --mirror-installer
|
||||
mirror_installer = args.mirror_installer
|
||||
|
||||
# --parent-mirror-installer
|
||||
parent_mirror_installer = args.parent_mirror_installer
|
||||
|
||||
# --mirror-installer-security
|
||||
mirror_installer_security = args.mirror_installer_security
|
||||
|
||||
# --parent-mirror-installer-security
|
||||
parent_mirror_installer_security = args.parent_mirror_installer_security
|
||||
|
||||
# --mirror-binary
|
||||
mirror_binary = args.mirror_binary
|
||||
|
||||
# --parent-mirror-binary
|
||||
parent_mirror_binary = args.parent_mirror_binary
|
||||
|
||||
# --mirror-binary-security
|
||||
mirror_binary_security = args.mirror_binary_security
|
||||
|
||||
# --parent-mirror-binary-security
|
||||
parent_mirror_binary_security = args.parent_mirror_binary_security
|
||||
|
||||
# --mirror-source
|
||||
mirror_source = args.mirror_source
|
||||
|
||||
# --parent-mirror-source
|
||||
parent_mirror_source = args.parent_mirror_source
|
||||
|
||||
# --mirror-source-security
|
||||
mirror_source_security = args.mirror_source_security
|
||||
|
||||
# --parent-mirror-source-security
|
||||
parent_mirror_source_security = args.parent_mirror_source_security
|
||||
|
||||
## Setting defaults
|
||||
|
||||
if not system:
|
||||
system = 'live'
|
||||
|
||||
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]
|
||||
|
||||
## Setting derivative defaults
|
||||
if (project == 'progress-linux'):
|
||||
# parent-distribution
|
||||
if(distribution == 'artax'):
|
||||
parent_distribution = 'squeeze'
|
||||
if(distribution == 'artax-backports'):
|
||||
parent_distribution = 'squeeze'
|
||||
if(distribution == 'baureo'):
|
||||
parent_distribution = 'wheezy'
|
||||
if(distribution == 'baureo-backports'):
|
||||
parent_distribution = 'wheezy'
|
||||
if(distribution == 'cairon'):
|
||||
parent_distribution = 'jessie'
|
||||
if(distribution == 'cairon-backports'):
|
||||
parent_distribution = 'jessie'
|
||||
else:
|
||||
# parent-architecture
|
||||
parent_architecture = architecture
|
||||
|
||||
# parent-distribution
|
||||
parent_distribution = distribution
|
||||
|
||||
# parent-mirror-bootstrap
|
||||
parent_mirror_bootstrap = mirror_bootstrap
|
||||
|
||||
# parent-mirror-bootstrap-security
|
||||
parent_mirror_bootstrap_security = mirror_bootstrap_security
|
||||
|
||||
# parent-mirror-chroot
|
||||
parent_mirror_chroot = mirror_chroot
|
||||
|
||||
# parent-mirror-chroot-security
|
||||
parent_mirror_chroot_security = mirror_chroot_security
|
||||
|
||||
# parent-mirror-installer
|
||||
parent_mirror_installer = mirror_installer
|
||||
|
||||
# parent-mirror-installer-security
|
||||
parent_mirror_installer_security = mirror_installer_security
|
||||
|
||||
# parent-mirror-binary
|
||||
parent_mirror_binary = mirror_binary
|
||||
|
||||
# parent-mirror-binary-security
|
||||
parent_mirror_binary_security = mirror_binary_security
|
||||
|
||||
# parent-mirror-source
|
||||
parent_mirror_source = mirror_source
|
||||
|
||||
# parent-mirror-source-security
|
||||
parent_mirror_source_security = mirror_source_security
|
||||
|
||||
## Creating configuration directory
|
||||
|
||||
# stagefile
|
||||
if os.path.exists('.build/init'):
|
||||
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.')
|
||||
|
||||
## Writing main configuration file
|
||||
|
||||
os.makedirs('config', exist_ok=True)
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
# build.conf
|
||||
f = open('config/build.conf', 'w')
|
||||
|
||||
config.add_section('build')
|
||||
|
||||
config.set('build', 'architecture', architecture)
|
||||
|
||||
config.set('build', 'archive-areas', archive_areas)
|
||||
config.set('build', 'parent-archive-areas', parent_archive_areas)
|
||||
|
||||
config.set('build', 'distribution', distribution)
|
||||
config.set('build', 'parent-distribution', parent_distribution)
|
||||
|
||||
config.set('build', 'project', project)
|
||||
config.set('build', 'system', system)
|
||||
|
||||
config.add_section('meta')
|
||||
|
||||
config.set('meta', 'version', '4.0')
|
||||
|
||||
config.write(f)
|
||||
f.close()
|
||||
|
||||
# config/archives
|
||||
os.makedirs('config/archives', exist_ok=True)
|
||||
|
||||
if (project == 'debian'):
|
||||
# config/archives/debian.list.bootstrap
|
||||
f = open('config/archives/debian.list.bootstrap', 'w')
|
||||
f.write('deb ' + mirror_bootstrap + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_bootstrap_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_bootstrap + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.chroot
|
||||
f = open('config/archives/debian.list.chroot', 'w')
|
||||
f.write('deb ' + mirror_chroot + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_chroot_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_chroot + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_chroot + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.installer
|
||||
f = open('config/archives/debian.list.installer', 'w')
|
||||
f.write('deb ' + mirror_installer + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_installer_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_installer + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_installer + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.binary
|
||||
f = open('config/archives/debian.list.binary', 'w')
|
||||
f.write('deb ' + mirror_binary + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_binary_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_binary + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_binary + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.source
|
||||
f = open('config/archives/debian.list.source', 'w')
|
||||
f.write('deb ' + mirror_source + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_source_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_source + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_source + ' ' + distribution + '-backports ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
elif(project == 'progress-linux'):
|
||||
# config/archives/debian.list.bootstrap
|
||||
f = open('config/archives/debian.list.bootstrap', 'w')
|
||||
f.write('deb ' + parent_mirror_bootstrap + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-backports' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.chroot
|
||||
f = open('config/archives/debian.list.chroot', 'w')
|
||||
f.write('deb ' + parent_mirror_chroot + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_chroot_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-backports' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.installer
|
||||
f = open('config/archives/debian.list.installer', 'w')
|
||||
f.write('deb ' + parent_mirror_installer + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_installer_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-backports' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.binary
|
||||
f = open('config/archives/debian.list.binary', 'w')
|
||||
f.write('deb ' + parent_mirror_binary + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_binary_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-backports' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/debian.list.source
|
||||
f = open('config/archives/debian.list.source', 'w')
|
||||
f.write('deb ' + parent_mirror_source + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb-src ' + parent_mirror_source + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_source_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb-src ' + parent_mirror_source_security + ' ' + distribution + '/updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb-src ' + parent_mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + parent_mirror_bootstrap + ' ' + distribution + '-backports' + archive_areas + '\n'
|
||||
'deb-src ' + parent_mirror_bootstrap + ' ' + distribution + '-backports' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/project.list.bootstrap
|
||||
f = open('config/archives/' + project + '.list.bootstrap', 'w')
|
||||
f.write('deb ' + mirror_bootstrap + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_bootstrap_security + ' ' + distribution + '-security ' + archive_areas + '\n'
|
||||
'deb ' + mirror_bootstrap + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_bootstrap + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/project.list.chroot
|
||||
f = open('config/archives/' + project + '.list.chroot', 'w')
|
||||
f.write('deb ' + mirror_chroot + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_chroot_security + ' ' + distribution + '-security ' + archive_areas + '\n'
|
||||
'deb ' + mirror_chroot + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_chroot + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/project.list.installer
|
||||
f = open('config/archives/' + project + '.list.installer', 'w')
|
||||
f.write('deb ' + mirror_installer + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_installer_security + ' ' + distribution + '-security ' + archive_areas + '\n'
|
||||
'deb ' + mirror_installer + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_installer + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/project.list.binary
|
||||
f = open('config/archives/' + project + '.list.binary', 'w')
|
||||
f.write('deb ' + mirror_binary + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_binary_security + ' ' + distribution + '-security ' + archive_areas + '\n'
|
||||
'deb ' + mirror_binary + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_binary + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
# config/archives/project.list.source
|
||||
f = open('config/archives/' + project + '.list.source', 'w')
|
||||
f.write('deb ' + mirror_source + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source + ' ' + distribution + ' ' + archive_areas + '\n'
|
||||
'deb ' + mirror_source_security + ' ' + distribution + '-security ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source_security + ' ' + distribution + '-security ' + archive_areas + '\n'
|
||||
'deb ' + mirror_source + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source + ' ' + distribution + '-updates ' + archive_areas + '\n'
|
||||
'deb ' + mirror_source + ' ' + distribution + '-backports ' + archive_areas + '\n'
|
||||
'deb-src ' + mirror_source + ' ' + distribution + '-backports ' + archive_areas + '\n')
|
||||
f.close()
|
||||
|
||||
## Populating configuration directory
|
||||
|
||||
# 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/all/*.hook*'):
|
||||
os.symlink(hook, os.path.join('config/hooks/' + os.path.basename(hook)))
|
||||
|
||||
if os.path.exists('/usr/share/live/build/hooks/' + system):
|
||||
for hook in glob.glob('/usr/share/live/build/hooks/' + system + '/*.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.installer', exist_ok=True) FIXME
|
||||
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.installer', 0o755) FIXME
|
||||
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\n'
|
||||
'live-config\n')
|
||||
|
||||
if(parent_distribution == 'wheezy'):
|
||||
f.write('live-config-sysvinit\n')
|
||||
else:
|
||||
f.write('live-config-systemd\n')
|
||||
|
||||
f.close()
|
||||
|
||||
## stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
open('.build/init', 'w').close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,108 @@
|
|||
#!/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 configuration 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()
|
|
@ -0,0 +1,101 @@
|
|||
#!/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()
|
|
@ -1 +0,0 @@
|
|||
squeeze/
|
|
@ -1 +0,0 @@
|
|||
squeeze/
|
|
@ -1 +0,0 @@
|
|||
sid
|
|
@ -1 +0,0 @@
|
|||
sid
|
|
@ -1 +0,0 @@
|
|||
sid
|
|
@ -0,0 +1 @@
|
|||
maverick
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1 @@
|
|||
kernel-image-*
|
|
@ -0,0 +1,5 @@
|
|||
choose-mirror
|
||||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -1,3 +1,4 @@
|
|||
choose-mirror
|
||||
netcfg
|
||||
ethdetect
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,3 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -0,0 +1,4 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmcia-cs-udeb
|
||||
wireless-tools-udeb
|
|
@ -1 +1 @@
|
|||
trixie
|
||||
squeeze
|
|
@ -1,2 +0,0 @@
|
|||
netcfg
|
||||
ethdetect
|
|
@ -1,2 +0,0 @@
|
|||
netcfg
|
||||
ethdetect
|
|
@ -1 +0,0 @@
|
|||
squeeze
|
|
@ -1 +0,0 @@
|
|||
trixie
|
|
@ -1,2 +0,0 @@
|
|||
This is a manual copy of the exclude lists is debian-cd/data
|
||||
https://salsa.debian.org/images-team/debian-cd
|
|
@ -1,4 +0,0 @@
|
|||
choose-mirror
|
||||
netcfg
|
||||
ethdetect
|
||||
pcmciautils-udeb
|
|
@ -1,3 +0,0 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmciautils-udeb
|
|
@ -1,3 +0,0 @@
|
|||
netcfg
|
||||
ethdetect
|
||||
pcmciautils-udeb
|
|
@ -1,143 +0,0 @@
|
|||
# These udebs build the d-i cdrom initrd. As such, there is no reason
|
||||
# to keep another copy of them on the CD in udeb form.
|
||||
#
|
||||
# This duplicates data found in the file build/pkg-lists/kernel, in d-i svn
|
||||
kernel-image-*
|
||||
# build/pkg-lists/base in d-i svn
|
||||
archdetect
|
||||
rootskel
|
||||
main-menu
|
||||
cdebconf-udeb
|
||||
udpkg
|
||||
anna
|
||||
di-utils
|
||||
di-utils-shell
|
||||
di-utils-reboot
|
||||
lowmemcheck
|
||||
# build/pkg-lists/cdrom/common, in d-i svn (also included in the
|
||||
# root+cd-drivers floppies)
|
||||
busybox-udeb
|
||||
installation-locale
|
||||
localechooser
|
||||
iso-3166-udeb
|
||||
hw-detect
|
||||
cdrom-detect
|
||||
cdrom-retriever
|
||||
load-cdrom
|
||||
cdrom-checker
|
||||
bogl-bterm-udeb
|
||||
di-utils-terminfo
|
||||
cdebconf-priority
|
||||
cdebconf-newt-udeb
|
||||
usb-discover
|
||||
preseed-common
|
||||
initrd-preseed
|
||||
file-preseed
|
||||
nano-udeb
|
||||
floppy-retriever
|
||||
libfribidi0-udeb
|
||||
# Already on the initrd as dependencies
|
||||
libdebconfclient0-udeb
|
||||
libdebian-installer4-udeb
|
||||
libdebian-installer-extra4-udeb
|
||||
# These udebs are only useful in building the boot floppy image
|
||||
busybox-floppy-udeb
|
||||
rootskel-bootfloppy
|
||||
# Graphical installer: common udebs included in initrd
|
||||
rootskel-gtk
|
||||
cdebconf-gtk-udeb
|
||||
fontconfig-udeb
|
||||
gtk2-engines-udeb
|
||||
libatk1.0-udeb
|
||||
libexpat1-udeb
|
||||
libfreetype6-udeb
|
||||
libglib2.0-udeb
|
||||
libgtk2-engines-udeb
|
||||
libpango1.0-udeb
|
||||
libpcre3-udeb
|
||||
libpixman-1-0-udeb
|
||||
libpng*-udeb
|
||||
libsdl1.2debian-udeb
|
||||
mouse-modules-*
|
||||
ttf-*
|
||||
fbset-udeb
|
||||
# Graphical installer: udebs for directfb
|
||||
libdirectfb-*-udeb
|
||||
libcairo-directfb2-udeb
|
||||
libgtk-directfb-2.0-0-udeb
|
||||
# Graphical installer: udebs for X.Org
|
||||
xserver-xorg-core-udeb
|
||||
xserver-xorg-input-evdev-udeb
|
||||
xserver-xorg-video-fbdev-udeb
|
||||
x11-xkb-utils-udeb
|
||||
xkb-data-udeb
|
||||
libcairo2-udeb
|
||||
libdrm2-udeb
|
||||
libfontenc1-udeb
|
||||
libgtk-x11-udeb
|
||||
libpciaccess0-udeb
|
||||
libx11-6-udeb
|
||||
libxau6-udeb
|
||||
libxcb1-udeb
|
||||
libxcursor1-udeb
|
||||
libxdmcp6-udeb
|
||||
libxext6-udeb
|
||||
libxfixes3-udeb
|
||||
libxfont1-udeb
|
||||
libxft2-udeb
|
||||
libxi6-udeb
|
||||
libxinerama1-udeb
|
||||
libxkbfile1-udeb
|
||||
libxrender1-udeb
|
||||
# Graphical installer: terminal support is included in initrd
|
||||
cdebconf-gtk-terminal
|
||||
libvte9-udeb
|
||||
# Not currently used
|
||||
cdebootstrap-udeb
|
||||
hdparm-udeb
|
||||
dhcp-client-udeb
|
||||
# This package is only useful in the d-i-demo
|
||||
di-utils-exit-installer
|
||||
# No need for these loaders.
|
||||
download-installer
|
||||
load-floppy
|
||||
# Only useful in the hd-media initrd
|
||||
iso-scan
|
||||
load-iso
|
||||
# These are not really needed, the regular netcfg subsumes them
|
||||
netcfg-static
|
||||
# skolelinux stuff, not for the stock CDs
|
||||
debian-edu-install-udeb
|
||||
debian-edu-profile-udeb
|
||||
debian-edu-archive-keyring-udeb
|
||||
ltsp-client-builder
|
||||
autopartkit
|
||||
# live CD stuff
|
||||
live-installer
|
||||
simple-cdd-profiles
|
||||
# If needed, will be on the initrd already
|
||||
module-init-tools-udeb
|
||||
env-preseed
|
||||
rescue-check
|
||||
cdebconf-text-udeb
|
||||
brltty-udeb
|
||||
klibc-utils-udeb
|
||||
libklibc-udeb
|
||||
udev-udeb
|
||||
udev-gtk-udeb
|
||||
ai-choosers
|
||||
auto-install
|
||||
libslang2-udeb
|
||||
kbd-chooser
|
||||
kbd-udeb
|
||||
console-setup-*
|
||||
# Currently unused
|
||||
debian-ports-archive-keyring-udeb
|
||||
emdebian-archive-keyring-udeb
|
||||
nbd-client-udeb
|
||||
pwgen-udeb
|
||||
# Eh?
|
||||
gnumach-udeb
|
||||
# We only support grub these days, drop lilo and elilo
|
||||
lilo-installer
|
||||
elilo-installer
|
|
@ -1,42 +0,0 @@
|
|||
# These udebs are in the d-i cdrom initrd and the hd-media initrd.
|
||||
# As such, there is no reason to keep another copy of them on the CD
|
||||
# in udeb form.
|
||||
console-keymaps-at
|
||||
console-keymaps-usb
|
||||
kbd-chooser
|
||||
acpi-modules-*
|
||||
ata-modules-*
|
||||
cdrom-core-modules-*
|
||||
core-modules-*
|
||||
fat-modules-*
|
||||
fb-modules-*
|
||||
ide-core-modules-*
|
||||
ide-modules-*
|
||||
input-modules-*
|
||||
isofs-modules-*
|
||||
mmc-modules-*
|
||||
nls-core-modules-*
|
||||
parport-modules-*
|
||||
pcmcia-modules-*
|
||||
sata-modules-*
|
||||
scsi-common-modules-*
|
||||
scsi-core-modules-*
|
||||
scsi-modules-*
|
||||
serial-modules-*
|
||||
speakup-modules-*
|
||||
usb-modules-*
|
||||
usb-serial-modules-*
|
||||
usb-storage-modules-*
|
||||
# Not used on amd64
|
||||
console-keymaps-acorn
|
||||
console-keymaps-amiga
|
||||
console-keymaps-atari
|
||||
console-keymaps-dec
|
||||
console-keymaps-sun
|
||||
# Not needed with the 2.6 kernel on amd64.
|
||||
userdevfs
|
||||
# Only needed on arches that use partconf or autopartkit.
|
||||
partconf-mkfstab
|
||||
# Not needed on arches that use partman
|
||||
mdcfg
|
||||
lvmcfg
|
|
@ -1 +0,0 @@
|
|||
apt-mirror-setup
|
|
@ -1 +0,0 @@
|
|||
sid
|
|
@ -1,27 +0,0 @@
|
|||
live-build (1:20220505) unstable; urgency=medium
|
||||
|
||||
The support for FTP proxies has ended. You are advised to use http or https
|
||||
while configuring the debian package mirror, instead of ftp.
|
||||
See https://salsa.debian.org/live-team/live-build/-/merge_requests/252#note_243114
|
||||
|
||||
-- Roland Clobus <rclobus@rclobus.nl> Wed, 8 Sep 2021 11:55:00 +0200
|
||||
|
||||
live-build (1:20210329) unstable; urgency=medium
|
||||
|
||||
The 'filesystem.size' file is no longer created and included in the image,
|
||||
as it is often incorrect and variates depending on the build environment,
|
||||
breaking reproducibility. For more information see the following thread:
|
||||
https://lists.debian.org/debian-live/2021/03/msg00008.html
|
||||
|
||||
-- Luca Boccassi <bluca@debian.org> Mon, 29 Mar 2021 10:49:43 +0100
|
||||
|
||||
live-build (1:20180411) unstable; urgency=medium
|
||||
|
||||
The live-boot mount points have been moved from /lib/live/mount to
|
||||
/run/live. Since this is a backward-incompatible change, a compat
|
||||
recursive bind mount point is being provided in /lib/live/mount so
|
||||
that existing scripts will not break in Debian 10 (Buster).
|
||||
Please note that this will be removed in Debian 11 (Bullseye) so
|
||||
plan accordingly and update any required scripts.
|
||||
|
||||
-- Luca Boccassi <bluca@debian.org> Wed, 11 Apr 2018 12:35:19 +0100
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
9
|
|
@ -1,34 +1,43 @@
|
|||
Source: live-build
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Maintainer: Debian Live <debian-live@lists.debian.org>
|
||||
Uploaders: Raphaël Hertzog <raphael@offensive-security.com>,
|
||||
Luca Boccassi <bluca@debian.org>
|
||||
Build-Depends: debhelper-compat (= 13), devscripts, gettext, po4a
|
||||
Standards-Version: 4.7.0
|
||||
Rules-Requires-Root: no
|
||||
Homepage: https://wiki.debian.org/DebianLive
|
||||
Vcs-Browser: https://salsa.debian.org/live-team/live-build
|
||||
Vcs-Git: https://salsa.debian.org/live-team/live-build.git
|
||||
Maintainer: Live Systems Maintainers <debian-live@lists.debian.org>
|
||||
Uploaders: Daniel Baumann <mail@daniel-baumann.ch>
|
||||
Build-Depends: debhelper (>= 9)
|
||||
Standards-Version: 3.9.5
|
||||
Homepage: http://live-systems.org/devel/live-build/
|
||||
Vcs-Browser: http://live-systems.org/gitweb/?p=live-build.git
|
||||
Vcs-Git: git://live-systems.org/git/live-build.git
|
||||
|
||||
Package: live-build
|
||||
Architecture: all
|
||||
Depends: cpio, debootstrap, ${misc:Depends}
|
||||
Recommends: apt-utils,
|
||||
bzip2,
|
||||
cryptsetup,
|
||||
file,
|
||||
live-boot-doc,
|
||||
live-config-doc,
|
||||
live-manual-html | live-manual,
|
||||
rsync,
|
||||
systemd-container,
|
||||
wget,
|
||||
xz-utils
|
||||
Suggests: e2fsprogs, eatmydata, git, mtd-utils, parted
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
debootstrap | cdebootstrap | cdebootstrap-static,
|
||||
python3,
|
||||
Recommends:
|
||||
cpio,
|
||||
live-boot-doc,
|
||||
live-config-doc,
|
||||
live-manual-html | live-manual,
|
||||
Description: Live System Build Components
|
||||
The Debian Live project maintains the components to build Debian based Live
|
||||
The Live Systems project maintains the components to build Debian based Live
|
||||
systems and the official Debian Live images themselves.
|
||||
.
|
||||
live-build contains the components to build a live system from a configuration
|
||||
directory.
|
||||
|
||||
Package: live-build-cgi
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, live-build (= ${source:Version})
|
||||
Recommends:
|
||||
apache2 | httpd,
|
||||
cron,
|
||||
Description: Live System Build Scripts (CGI frontend)
|
||||
The Live Systems project maintains the components to build Debian based Live
|
||||
systems and the official Debian Live images themselves.
|
||||
.
|
||||
live-build contains the components to build a live system from a configuration
|
||||
directory.
|
||||
.
|
||||
This package contains the CGI frontend (experimental!).
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: live-build
|
||||
Upstream-Contact: Debian Live Project <debian-live@lists.debian.org>
|
||||
Upstream-Contact: Live Systems Project <debian-live@lists.debian.org>
|
||||
Source: http://live-systems.org/archive/packages/live-build/
|
||||
|
||||
Files: *
|
||||
Copyright:
|
||||
2016-2020 The Debian Live team
|
||||
2016-2017 Raphaël Hertzog <hertzog@debian.org>
|
||||
2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
Copyright: 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
License: GPL-3+
|
||||
|
||||
License: GPL-3+
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
---
|
||||
include:
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
|
||||
|
||||
variables:
|
||||
SALSA_CI_DISABLE_BUILD_PACKAGE_ANY: 1
|
||||
SALSA_CI_DISABLE_BUILD_PACKAGE_I386: 1
|
||||
|
||||
.lb-build:
|
||||
stage: test
|
||||
script:
|
||||
- apt-get update
|
||||
- apt-get install -y "$(find . -type f -name '*.deb')"
|
||||
- lb --version
|
||||
# We need to stay within the maximum limit for artifacts on Salsa (250M),
|
||||
# so disable a few things
|
||||
- lb config --apt-indices false --apt-recommends false --firmware-chroot false --source false --distribution sid --updates false --debootstrap-options "--variant=minbase" --bootloaders grub-efi
|
||||
# But do install user-setup and sudo to have a usable image
|
||||
- echo "user-setup sudo" > config/package-lists/recommends.list.chroot
|
||||
# xz compresses initrds much better than zstd
|
||||
- echo xz-utils >> config/package-lists/live.list.chroot
|
||||
- mkdir -p config/includes.chroot_after_packages/etc/initramfs-tools/conf.d/
|
||||
- printf 'COMPRESS=xz\nCOMPRESSLEVEL=9\n' > config/includes.chroot_after_packages/etc/initramfs-tools/conf.d/compress
|
||||
# Remove stuff not really needed to boot
|
||||
- echo 'rm -rf /usr/share/doc/* /usr/share/i18n/* /usr/share/man/* /usr/share/locale/*' >> config/hooks/normal/9020-remove-man-cache.hook.chroot
|
||||
# Build the ISO
|
||||
- lb build
|
||||
- ls -lh
|
||||
- cp live-image-${BUILD_ARCH}.contents ${WORKING_DIR}
|
||||
- cp live-image-${BUILD_ARCH}.hybrid.iso ${WORKING_DIR}
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- ${WORKING_DIR}/live-image-${BUILD_ARCH}.contents
|
||||
- ${WORKING_DIR}/live-image-${BUILD_ARCH}.hybrid.iso
|
||||
needs:
|
||||
- job: build
|
||||
artifacts: true
|
||||
|
||||
ISO amd64:
|
||||
extends:
|
||||
- .lb-build
|
||||
variables:
|
||||
BUILD_ARCH: 'amd64'
|
||||
|
||||
ISO arm64:
|
||||
extends:
|
||||
- .lb-build
|
||||
rules:
|
||||
- if: $CI_PROJECT_ROOT_NAMESPACE != "rclobus-guest"
|
||||
variables:
|
||||
BUILD_ARCH: 'arm64'
|
||||
tags:
|
||||
- $SALSA_CI_ARM_RUNNER_TAG
|
|
@ -1,7 +1,7 @@
|
|||
Before submitting a bug report against live-build, please make sure
|
||||
that you have read your guidelines for live systems bug reports:
|
||||
|
||||
https://live-team.pages.debian.net/live-manual/
|
||||
http://live-systems.org/manual/
|
||||
|
||||
By providing the required information as outlined in the guidelines makes
|
||||
sure that we can optimally reproduce and fix bugs, not doing so wastes a
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
DEFAULT_SETTINGS="/etc/live/build.conf"
|
||||
|
||||
dpkg -l debootstrap
|
||||
# Checking depends
|
||||
dpkg -l debootstrap cdebootstrap
|
||||
|
||||
# Checking suggests
|
||||
dpkg -l dosfstools xorriso loadlin memtest86+ memtest86 mtools parted squashfs-tools mtd-tools syslinux syslinux-common extlinux grub uuid-runtime win32-loader
|
||||
|
||||
if [ -e "${DEFAULT_SETTINGS}" ]; then
|
||||
echo "Contents of ${DEFAULT_SETTINGS}:"
|
||||
|
|
|
@ -1,6 +1 @@
|
|||
live-build: absolute-symlink-in-top-level-folder
|
||||
# Those cases are legitimate uses of direct access to the database
|
||||
live-build: uses-dpkg-database-directly [usr/lib/live/build/chroot_tmpfs]
|
||||
live-build: uses-dpkg-database-directly [usr/lib/live/build/clean]
|
||||
live-build: uses-dpkg-database-directly [usr/share/live/build/functions/chroot.sh]
|
||||
live-build: uses-dpkg-database-directly [usr/share/live/build/hooks/normal/8010-remove-backup-files.hook.chroot]
|
||||
live-build: symlink-should-be-relative
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
dh ${@} --parallel
|
||||
|
||||
override_dh_auto_install:
|
||||
# Update manual pages first
|
||||
$(MAKE) -C manpages update
|
||||
$(MAKE) -C manpages build
|
||||
|
||||
dh_auto_install -- DESTDIR=debian/live-build
|
||||
|
||||
# Removing unused files
|
||||
rm -f debian/live-build/usr/share/doc/live-build/COPYING
|
||||
|
||||
# live-build-cgi
|
||||
mkdir -p debian/live-build-cgi/usr/share/live/build
|
||||
mv debian/live-build/usr/share/live/build/cgi debian/live-build-cgi/usr/share/live/build
|
||||
|
||||
override_dh_builddeb:
|
||||
dh_builddeb -- -Zxz
|
||||
|
||||
override_dh_link:
|
||||
# workaround dh_link conversion of absolute symlinks to relative symlinks
|
||||
dh_link -X.c32 -Xisolinux.bin -Xpxelinux.0
|
||||
dh_link
|
||||
|
||||
# workaround dh_link convertion of absolute symlinks to relvative symlinks
|
||||
rm -rf debian/live-build/usr/share/live/build/bootloaders
|
||||
cp -a share/bootloaders debian/live-build/usr/share/live/build/bootloaders
|
||||
|
|
|
@ -1 +1 @@
|
|||
3.0 (native)
|
||||
3.0 (quilt)
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Ignore those errors, it's not nice but works currently
|
||||
absolute-symbolic-link-target-in-source /usr/lib/ISOLINUX/isolinux.bin [share/bootloaders/isolinux/isolinux.bin]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/PXELINUX/pxelinux.0 [share/bootloaders/pxelinux/pxelinux.0]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/hdt.c32 [share/bootloaders/syslinux_common/hdt.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/ldlinux.c32 [share/bootloaders/isolinux/ldlinux.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/ldlinux.c32 [share/bootloaders/pxelinux/ldlinux.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/libcom32.c32 [share/bootloaders/syslinux_common/libcom32.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/libgpl.c32 [share/bootloaders/syslinux_common/libgpl.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/libmenu.c32 [share/bootloaders/syslinux_common/libmenu.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/libutil.c32 [share/bootloaders/syslinux_common/libutil.c32]
|
||||
absolute-symbolic-link-target-in-source /usr/lib/syslinux/modules/bios/vesamenu.c32 [share/bootloaders/syslinux_common/vesamenu.c32]
|
|
@ -0,0 +1 @@
|
|||
abort-on-upstream-changes
|
|
@ -0,0 +1 @@
|
|||
compression = xz
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
cd "${AUTOPKGTEST_TMP}"
|
||||
# Use the default values
|
||||
lb config --verbose
|
||||
# Verify some values
|
||||
lb config --dump | grep 'LB_DISTRIBUTION="testing"'
|
||||
lb config --dump | grep 'LB_UPDATES="true"'
|
||||
lb config --dump | grep 'LB_SECURITY="true"'
|
||||
lb config --dump | grep 'LB_PROPOSED_UPDATES="false"'
|
||||
lb build --verbose
|
||||
ls -l
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Ensure Kali's keyring archive is installed and is always up to date
|
||||
echo "Acquire::Retries 5;" > /etc/apt/apt.conf.d/live-build-ci
|
||||
curl https://archive.kali.org/archive-key.asc > /etc/apt/trusted.gpg.d/kali.asc
|
||||
mkdir -p /etc/apt/sources.list.d
|
||||
echo "deb http://http.kali.org/kali kali-rolling main" > /etc/apt/sources.list.d/kali.list
|
||||
apt-get update
|
||||
apt-get install -y kali-archive-keyring
|
||||
rm -f /etc/apt/trusted.gpg.d/kali.asc /etc/apt/sources.list.d/kali.list /etc/apt/apt.conf.d/live-build-ci
|
||||
apt-get update
|
||||
|
||||
cd "${AUTOPKGTEST_TMP}"
|
||||
git clone --depth 1 --no-tags https://gitlab.com/kalilinux/build-scripts/live-build-config.git
|
||||
cd live-build-config
|
||||
./build.sh --verbose
|
||||
ls -l
|
||||
ls -l images
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
cd "${AUTOPKGTEST_TMP}"
|
||||
# A minimal command line
|
||||
lb config --verbose --distribution stable
|
||||
# Verify some default values
|
||||
lb config --dump | grep 'LB_UPDATES="true"'
|
||||
lb config --dump | grep 'LB_SECURITY="true"'
|
||||
lb config --dump | grep 'LB_PROPOSED_UPDATES="false"'
|
||||
lb build --verbose
|
||||
ls -l
|
|
@ -1,20 +0,0 @@
|
|||
Tests: build-default-image
|
||||
Depends: live-build
|
||||
Restrictions: allow-stderr, needs-internet, needs-root
|
||||
|
||||
Tests: build-stable-image
|
||||
Depends: live-build
|
||||
Restrictions: allow-stderr, needs-internet, needs-root
|
||||
|
||||
Tests: build-kali-image
|
||||
Depends: apt-utils,
|
||||
bzip2,
|
||||
ca-certificates,
|
||||
cpio,
|
||||
curl,
|
||||
file,
|
||||
git,
|
||||
live-build,
|
||||
wget,
|
||||
xz-utils
|
||||
Restrictions: allow-stderr, flaky, needs-internet, needs-root
|
|
@ -5,6 +5,7 @@ binary*.tar*
|
|||
binary*.contents
|
||||
binary*.packages
|
||||
binary*.zsync
|
||||
live-image-*
|
||||
|
||||
.build/
|
||||
build.log
|
||||
|
@ -13,6 +14,7 @@ cache/
|
|||
|
||||
chroot/
|
||||
chroot.packages.*
|
||||
chroot.files
|
||||
|
||||
config/binary
|
||||
config/bootstrap
|
||||
|
@ -20,7 +22,7 @@ config/chroot
|
|||
config/common
|
||||
config/source
|
||||
|
||||
config/control
|
||||
config/build
|
||||
|
||||
source/
|
||||
source*.iso
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## 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
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# util-linux creates random UUIDs when uuid_generate_random is called
|
||||
# Use LD_PRELOAD to replace uuid_generate_random with a less random version
|
||||
|
||||
# Don't run if gcc is not installed
|
||||
if [ ! -e /usr/bin/cc ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cat > unrandomize_uuid_generate_random.c << END_OF_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define SEQUENCE_FILENAME "/var/cache/unrandomize_uuid_generate_random.sequence_number"
|
||||
|
||||
/* https://tools.ietf.org/html/rfc4122 */
|
||||
typedef unsigned char uuid_t[16];
|
||||
|
||||
/* Our pseudo-random version */
|
||||
void uuid_generate_random(uuid_t out)
|
||||
{
|
||||
/* Nil UUID */
|
||||
for (int i=0;i<16;i++) {
|
||||
out[i] = 0x00;
|
||||
}
|
||||
out[6]=0x40; /* UUID version 4 means randomly generated */
|
||||
out[8]=0x80; /* bit7=1,bit6=0 */
|
||||
|
||||
/* The file doesn't need to exist yet */
|
||||
FILE *f = fopen(SEQUENCE_FILENAME, "rb");
|
||||
if (f) {
|
||||
fread(out+12, 4, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
/* Use the next number. Endianness is not important */
|
||||
(*(unsigned long*)(out+12))++;
|
||||
|
||||
unsigned long long epoch;
|
||||
/* Use SOURCE_DATE_EPOCH when provided */
|
||||
char *date = getenv("SOURCE_DATE_EPOCH");
|
||||
if (date) {
|
||||
epoch = strtoll(date, NULL, 10);
|
||||
} else {
|
||||
epoch = 0ll;
|
||||
}
|
||||
out[0] = (epoch & 0xFF000000) >> 24;
|
||||
out[1] = (epoch & 0x00FF0000) >> 16;
|
||||
out[2] = (epoch & 0x0000FF00) >> 8;
|
||||
out[3] = (epoch & 0x000000FF);
|
||||
|
||||
/* Write the sequence number */
|
||||
f = fopen(SEQUENCE_FILENAME, "wb");
|
||||
if (f) {
|
||||
fwrite(out+12, 4, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
END_OF_SOURCE
|
||||
/usr/bin/cc -shared -fPIC unrandomize_uuid_generate_random.c -Wall --pedantic -o /usr/lib/unrandomize_uuid_generate_random.so
|
||||
rm -f unrandomize_uuid_generate_random.c
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# fontconfig creates non-reproducible files with UUIDs
|
||||
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864082
|
||||
#
|
||||
# Because the UUIDs should not be deleted, the proposed work-around is:
|
||||
# * Use LD_PRELOAD to replace uuid_generate_random with a less random version
|
||||
|
||||
# Don't run if fontconfig is not installed
|
||||
if [ ! -e /usr/bin/fc-cache ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if fontconfig is sufficiently new
|
||||
if dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' fontconfig | head -1) ge 2.13.1-4.4~;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the LD_PRELOAD module is not compiled
|
||||
if [ ! -e /usr/lib/unrandomize_uuid_generate_random.so ];
|
||||
then
|
||||
echo "P: $(basename $0) Reproducible hook inactive: The UUID module was not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
LD_PRELOAD=/usr/lib/unrandomize_uuid_generate_random.so /usr/bin/fc-cache --force --really-force --system-only --verbose
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# mkconf of mdadm creates a file with a timestamp
|
||||
# A bug report with patch is available at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982607
|
||||
# This script duplicates that patch
|
||||
|
||||
# Don't run if mdadm is not installed
|
||||
if [ ! -e /usr/share/mdadm/mkconf ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If mkconf already contains references to SOURCE_DATE_EPOCH, there is no need to patch the file
|
||||
if grep -q SOURCE_DATE_EPOCH /usr/share/mdadm/mkconf;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
sed -i -e '/# This configuration was auto-generated on/cif [ -z $SOURCE_DATE_EPOCH ]; then\n echo "# This configuration was auto-generated on $(date -R) by mkconf"\nelse\n echo "# This configuration was auto-generated on $(date -R --utc -d@$SOURCE_DATE_EPOCH) by mkconf"\nfi' /usr/share/mdadm/mkconf
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# update-perl-sax-parsers of libxml-sax-perl creates a file with a random order of its lines
|
||||
# A bug report with patch is available at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993444
|
||||
# This script duplicates that patch
|
||||
|
||||
# Don't run if libxml-sax-perl is not installed
|
||||
if [ ! -e /usr/bin/update-perl-sax-parsers ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If Debian.pm already contains a sort line, there is no need to patch the file
|
||||
if grep -q sort /usr/share/perl5/XML/SAX/Debian.pm;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Patch the Perl script
|
||||
sed -i -e '/foreach my $key/s/keys/sort keys/' /usr/share/perl5/XML/SAX/Debian.pm
|
||||
|
||||
# Regenerate the file that has more than one key-value pair
|
||||
update-perl-sax-parsers --remove XML::SAX::Expat
|
||||
update-perl-sax-parsers --add XML::SAX::Expat --priority 50
|
||||
update-perl-sax-parsers --update
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# libxmlb2 creates random GUIDs
|
||||
# See https://github.com/hughsie/libxmlb/issues/110
|
||||
# Fixed upstream: https://github.com/hughsie/libxmlb/commit/0652ec042cc0611b9b98e080e64e1025db9b4183
|
||||
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006358
|
||||
#
|
||||
# Until a sufficiently new version is installed, apply the work-around
|
||||
|
||||
# Don't run if libxmlb2 is not installed
|
||||
if [ ! -e /usr/share/doc/libxmlb2 ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if AppStream is not installed
|
||||
if [ ! -e /usr/bin/appstreamcli ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the version of libxmlb2 is sufficiently new
|
||||
if dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' libxmlb2 | head -1) ge 0.3.7~;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Refresh the compressed XML files
|
||||
appstreamcli refresh --force > /dev/null
|
||||
|
||||
# appstream <= 0.15.1 uses /var/cache/app-info
|
||||
# appstream >= 0.15.2 uses /var/cache/swcatalog
|
||||
if [ -d /var/cache/swcatalog ];
|
||||
then
|
||||
CACHE_PATH=/var/cache/swcatalog/cache
|
||||
else
|
||||
CACHE_PATH=/var/cache/app-info/cache
|
||||
fi
|
||||
|
||||
# Set the GUID field for each compressed XML file to zero
|
||||
for f in $(ls ${CACHE_PATH}/*.xb);
|
||||
do
|
||||
dd if=$f of=tmp.xb count=8 iflag=count_bytes status=none
|
||||
dd if=/dev/zero of=tmp.xb count=16 iflag=count_bytes status=none oflag=append conv=notrunc
|
||||
dd if=$f of=tmp.xb skip=24 iflag=skip_bytes status=none oflag=append conv=notrunc
|
||||
rm $f
|
||||
mv tmp.xb $f
|
||||
done
|
||||
|
||||
# When apt update is invoked, 50appstream calls 'appstreamcli refresh'
|
||||
# so add another hook to reset the guid again
|
||||
#
|
||||
# Before the chroot is finalised, 'apt update' is invoked again, so the reset guid step needs to be re-applied
|
||||
cat << EOF > /etc/apt/apt.conf.d/51appstream_reset_guid
|
||||
# Reset the GUID of the AppStream cache files when APT's cache is updated (i.e. apt update)
|
||||
APT::Update::Post-Invoke-Success {
|
||||
"if /usr/bin/test -w ${CACHE_PATH} -a -e /usr/bin/appstreamcli; then for f in \$(ls ${CACHE_PATH}/*.xb); do dd if=\$f of=tmp.xb count=8 iflag=count_bytes status=none; dd if=/dev/zero of=tmp.xb count=16 iflag=count_bytes status=none oflag=append conv=notrunc; dd if=\$f of=tmp.xb skip=24 iflag=skip_bytes status=none oflag=append conv=notrunc; rm \$f; mv tmp.xb \$f; done; fi";
|
||||
};
|
||||
EOF
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,60 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# This script fixes several issues:
|
||||
# 1. The fmt files contain timestamps
|
||||
# 2. The fmt files randomly select the path to language.dat.lua and language.def
|
||||
# (/var/lib/texmf/tex/generic/config vs /usr/share/texlive/texmf-dist/tex/generic/config)
|
||||
# 3. The fmt files have a random order due to the way iterators work in lua
|
||||
# The function 'exception_strings' uses these iterators
|
||||
# https://sources.debian.org/src/texlive-bin/2021.20210626.59705-1/texk/web2c/luatexdir/lang/texlang.c/?hl=501#L501
|
||||
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009196
|
||||
# 4. The 'tex' executable intentionally ignores SOURCE_DATE_EPOCH
|
||||
# See https://sources.debian.org/src/texlive-bin/2021.20210626.59705-1/debian/patches/debian-SDE-docs-in-tex-etex-manpage/?hl=36#L36
|
||||
|
||||
# Note: This hook must run before 0140-remove-log-files.hook.chroot and 0190-remove-temporary-files.hook.chroot
|
||||
|
||||
# Don't run if texlive-binaries is not installed
|
||||
if [ ! -e /usr/bin/luahbtex ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# This is TeX: set FORCE_SOURCE_DATE to enable SOURCE_DATE_EPOCH -> fixes 1 and 2
|
||||
export FORCE_SOURCE_DATE=1
|
||||
|
||||
# Generate the .fmt file 10 times. If the content differs, a fix for 3 is required
|
||||
for i in $(seq 1 10); do luahbtex -ini -jobname=luahbtex -progname=luabhtex luatex.ini > /dev/null; md5sum luahbtex.fmt >> md5sum.luahbtex; done
|
||||
rm -f luahbtex.fmt
|
||||
rm -f luahbtex.log
|
||||
if [ $(sort -u < md5sum.luahbtex | wc -l) -ne 1 ];
|
||||
then
|
||||
# Ugly hack: remove the hyphenation exceptions -> fixes 3
|
||||
# This results in incorrect hyphenation, but it is a work-around until the function 'exception_strings' has been adjusted
|
||||
sed -i -e '/as-so-ciate/d;/as-so-ciates/d;/dec-li-na-tion/d;/oblig-a-tory/d;/phil-an-thropic/d;/present/d;/presents/d;/project/d;/projects/d;/reci-procity/d;/re-cog-ni-zance/d;/ref-or-ma-tion/d;/ret-ri-bu-tion/d;/ta-ble/d' /usr/share/texlive/texmf-dist/tex/generic/hyphen/hyphen.tex
|
||||
echo "P: $(basename $0) Reproducible hack has been applied: hyphenation of some words will be incorrect"
|
||||
fi
|
||||
rm -f md5sum.luahbtex
|
||||
|
||||
# Rebuild all .fmt and .log files in /var/lib/texmf/web2c
|
||||
fmtutil --sys --all
|
||||
|
||||
# Use faketime to enforce a timestamp -> fixes 4
|
||||
# NB: hooks don't know about the apt/aptitude selection, so use 'apt-get'
|
||||
export FAKETIME_ALREADY_INSTALLED=1
|
||||
if [ ! -e /usr/bin/faketime ];
|
||||
then
|
||||
FAKETIME_ALREADY_INSTALLED=0
|
||||
apt-get install faketime --yes -o Acquire::Check-Valid-Until=false
|
||||
fi
|
||||
OLD_PWD=$(pwd)
|
||||
cd /var/lib/texmf/web2c/tex
|
||||
faketime $(date --utc -d@$SOURCE_DATE_EPOCH --iso-8601=seconds) tex -ini -jobname=tex -progname=tex tex.ini
|
||||
cd ${OLD_PWD}
|
||||
if [ ${FAKETIME_ALREADY_INSTALLED} -eq 0 ];
|
||||
then
|
||||
apt-get remove --purge --yes faketime
|
||||
apt-get autoremove --yes
|
||||
fi
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# The file /var/lib/texmf/web2c/updmap.log contains timestamps for the files that it just generated
|
||||
# Not reported yet. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=XXXXXXX
|
||||
|
||||
# Don't run if texlive-base is not installed
|
||||
if [ ! -e /usr/bin/updmap ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the script has been fixed
|
||||
if grep -q gmtime /usr/share/texlive/texmf-dist/scripts/texlive/updmap.pl;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Change: printf LOG "%s\n\n", scalar localtime();
|
||||
# To : printf LOG "%s\n\n", defined $ENV{SOURCE_DATE_EPOCH} ? scalar gmtime($ENV{SOURCE_DATE_EPOCH}) : scalar localtime();
|
||||
sed -i -e "/scalar localtime/s/scalar localtime/defined \$ENV{SOURCE_DATE_EPOCH} ? scalar gmtime(\$ENV{SOURCE_DATE_EPOCH}) : scalar localtime/" /usr/share/texlive/texmf-dist/scripts/texlive/updmap.pl
|
||||
|
||||
# Change: my ($s,$m,$h,$D,$M,$Y)=localtime($stat[9]);
|
||||
# To : my ($s,$m,$h,$D,$M,$Y)=defined $ENV{SOURCE_DATE_EPOCH} ? gmtime($ENV{SOURCE_DATE_EPOCH}) : localtime($stat[9]);
|
||||
sed -i -e "/localtime([$]/s/localtime/defined \$ENV{SOURCE_DATE_EPOCH} ? gmtime(\$ENV{SOURCE_DATE_EPOCH}) : localtime/" /usr/share/texlive/texmf-dist/scripts/texlive/updmap.pl
|
||||
|
||||
# The timestamp of the files that are generated by the script will be corrected in the 'lb binary' phase
|
||||
updmap -sys
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# mktexlsr and mktexlsr.pl generate different output
|
||||
# Whichever of both scripts is run last, determines the output of /var/lib/texmf/ls-R
|
||||
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003449
|
||||
|
||||
# Don't run if texlive-base is not installed
|
||||
if [ ! -e /usr/share/texlive/texmf-dist/scripts/texlive/mktexlsr ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the version of mktexlsr is sufficiently new
|
||||
if grep -q "Also remove double empty" /usr/share/texlive/texmf-dist/scripts/texlive/mktexlsr;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Apply only the functional part of the patch in #1003449 (removes double empty lines)
|
||||
sed -i -e "/vc_dirs'\./s/[\\]/| cat -s \\\\/" /usr/share/texlive/texmf-dist/scripts/texlive/mktexlsr
|
||||
|
||||
# Run the shell script, this hook is the last invoker.
|
||||
# The output in /var/lib/texmf/ls-R will be sorted
|
||||
mktexlsr
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,87 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# vlc-cache-gen uses readdir() which depends on the order in the filesystem
|
||||
|
||||
# Don't run if vlc is not installed
|
||||
if [ ! -x /usr/lib/x86_64-linux-gnu/vlc/vlc-cache-gen ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the cache file does not exist
|
||||
if [ ! -e /usr/lib/x86_64-linux-gnu/vlc/plugins/plugins.dat ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Install disorderfs when needed and mark for removal at the end
|
||||
_DISORDERFS_PREINSTALLED=yes
|
||||
if [ ! -x /usr/bin/disorderfs ];
|
||||
then
|
||||
_DISORDERFS_PREINSTALLED=no
|
||||
apt-get install --yes disorderfs
|
||||
fi
|
||||
|
||||
# Install the fuse device (needed by disorderfs) and mark for removal at the end
|
||||
_FUSE_DEVICE_PRESENT=yes
|
||||
if [ ! -e /dev/fuse ];
|
||||
then
|
||||
_FUSE_DEVICE_PRESENT=no
|
||||
mknod /dev/fuse c 10 229
|
||||
fi
|
||||
|
||||
# Check for changes in the cache file, for suppressing the output if no change was made
|
||||
_CHECK_FOR_CHANGES=yes
|
||||
if [ ! -x /usr/bin/sha256sum ];
|
||||
then
|
||||
_CHECK_FOR_CHANGES=no
|
||||
fi
|
||||
|
||||
|
||||
# Prepare a directory with a stable sorting order
|
||||
_ORDERED_DIR=$(mktemp --directory)
|
||||
disorderfs /usr/lib/x86_64-linux-gnu/vlc/plugins ${_ORDERED_DIR} --reverse-dirents=no --sort-dirents=yes --quiet
|
||||
|
||||
# The checksum of the original file
|
||||
if [ "${_CHECK_FOR_CHANGES}" = "yes" ];
|
||||
then
|
||||
sha256sum /usr/lib/x86_64-linux-gnu/vlc/plugins/plugins.dat > ${_ORDERED_DIR}/before.sha256sum
|
||||
fi
|
||||
|
||||
# Regenerate the cache file in a directory which guarantees the sorting order of the files
|
||||
/usr/lib/x86_64-linux-gnu/vlc/vlc-cache-gen ${_ORDERED_DIR}
|
||||
|
||||
# Verify the checksum for changes
|
||||
if [ "${_CHECK_FOR_CHANGES}" = "yes" ];
|
||||
then
|
||||
_HOOK_WAS_NEEDED=no
|
||||
sha256sum --check ${_ORDERED_DIR}/before.sha256sum --status || _HOOK_WAS_NEEDED=yes
|
||||
rm -f ${_ORDERED_DIR}/before.sha256sum
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
fusermount -u ${_ORDERED_DIR}
|
||||
rmdir ${_ORDERED_DIR}
|
||||
|
||||
if [ "${_DISORDERFS_PREINSTALLED}" = "no" ];
|
||||
then
|
||||
apt-get remove --yes --purge disorderfs
|
||||
apt-get autoremove --yes
|
||||
fi
|
||||
|
||||
if [ "${_FUSE_DEVICE_PRESENT}" = "no" ];
|
||||
then
|
||||
rm -f /dev/fuse
|
||||
fi
|
||||
|
||||
# Report only when either a change was detected or not detectable (due to missing tools)
|
||||
if [ "${_CHECK_FOR_CHANGES}" = "yes" ];
|
||||
then
|
||||
if [ "${_HOOK_WAS_NEEDED}" = "yes" ];
|
||||
then
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
||||
fi
|
||||
else
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
||||
fi
|
|
@ -1,42 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# install-info has an unstable sort order when a new section is added
|
||||
# Fixed by https://git.savannah.gnu.org/cgit/texinfo.git/commit/?id=01b5a4b9c33bef08feae041c221f820a1c76749f
|
||||
#
|
||||
# The postinst-hook of install-info depends on the natural order of the
|
||||
# filesystem and deletes the existing dir file beforehand.
|
||||
# Installing the same info.gz file again follows a different code path,
|
||||
# which has a stable sort order
|
||||
|
||||
# Don't run if install-info is not installed
|
||||
if [ ! -x /usr/bin/install-info ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if install-info is sufficiently new
|
||||
if dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' install-info | head -1) gt 7.2~;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Keep the original file
|
||||
cp /usr/share/info/dir /tmp/before
|
||||
|
||||
# dir, dircolors, dirname / pr, printenv, printf / tr, true, truncate / who, whoami
|
||||
install-info /usr/share/info/coreutils.info.gz /usr/share/info/dir
|
||||
# diff, diff3
|
||||
install-info /usr/share/info/diffutils.info.gz /usr/share/info/dir
|
||||
# dirmngr, dirmngr-client
|
||||
if [ -e /usr/share/info/gnupg.info.gz ];
|
||||
then
|
||||
install-info /usr/share/info/gnupg.info.gz /usr/share/info/dir
|
||||
fi
|
||||
|
||||
# Only report when the hook has made a difference
|
||||
if ! diff /tmp/before /usr/share/info/dir > /dev/null;
|
||||
then
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
||||
fi
|
||||
rm -f /tmp/before
|
|
@ -1,64 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# /etc/ssl/certs/java/cacerts is a keystore
|
||||
# Due to cryptographic requirements, it will be non-reproducible
|
||||
# as it embeds timestamps
|
||||
# It can be re-generated with low overhead
|
||||
|
||||
# Don't run if ca-certificates-java is not installed
|
||||
if [ ! -e /etc/ssl/certs/java/cacerts ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Remove the file
|
||||
rm -f /etc/ssl/certs/java/cacerts
|
||||
|
||||
# Add a hook to live-config to recreate it
|
||||
cat << EOF > /usr/lib/live/config/5000-ca-certificates-java
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/live/config.sh
|
||||
|
||||
## live-config(7) - System Configuration Components
|
||||
## Copyright (C) 2024 The Debian Live team
|
||||
##
|
||||
## 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.
|
||||
|
||||
Init ()
|
||||
{
|
||||
# Checking if package is installed
|
||||
if ! pkg_is_installed "ca-certificates-java" || \\
|
||||
component_was_executed "ca-certificates-java"
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
# If the keystore is embedded in the image, don't touch it
|
||||
if [ -e /etc/ssl/certs/java/cacerts ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n " ca-certificates-java"
|
||||
}
|
||||
|
||||
Config ()
|
||||
{
|
||||
# Re-generate the keystore
|
||||
touch /var/lib/ca-certificates-java/fresh
|
||||
dpkg-reconfigure ca-certificates-java
|
||||
|
||||
# Creating state file
|
||||
touch /var/lib/live/config/ca-certificates-java
|
||||
}
|
||||
|
||||
Init
|
||||
Config
|
||||
EOF
|
||||
chmod u=rwx,go=rx /usr/lib/live/config/5000-ca-certificates-java
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# update-dictcommon-aspell creates a file with content depending on PERL_HASH_SEED
|
||||
# A bug report with patch is available at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1090981
|
||||
# This script duplicates that patch
|
||||
|
||||
# Don't run if the file is not present
|
||||
if [ ! -e /usr/share/perl5/Debian/DictionariesCommon.pm ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If DictionariesCommon.pm already contains a sort statement at line 656, there is no need to patch the file
|
||||
if sed -e '656p;d' /usr/share/perl5/Debian/DictionariesCommon.pm | grep -q "foreach my \$k (sort keys"
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Patch the Perl script (at line 656)
|
||||
sed -i -e '656s/keys/sort keys/' /usr/share/perl5/Debian/DictionariesCommon.pm
|
||||
|
||||
update-dictcommon-aspell
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Delete all older backups of ucf files
|
||||
# The current files are /var/lib/ucf/hashfile and /var/lib/ucf/registry
|
||||
rm -f /var/lib/ucf/hashfile.*
|
||||
rm -f /var/lib/ucf/registry.*
|
|
@ -1,38 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# fontconfig creates non-reproducible files with UUIDs
|
||||
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864082
|
||||
#
|
||||
# Because the UUIDs should not be deleted, the proposed work-around is:
|
||||
# * Use LD_PRELOAD to replace uuid_generate_random with a less random version
|
||||
|
||||
# Don't run if fontconfig is not installed
|
||||
if [ ! -e /usr/bin/fc-cache ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if fontconfig is sufficiently new
|
||||
if dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' fontconfig | head -1) ge 2.13.1-4.4~;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if there is no font in the initrd.img file
|
||||
if ! lsinitramfs /initrd.img | grep "^var/cache/fontconfig" | grep ".cache-7$" > /dev/null;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the LD_PRELOAD module is not compiled
|
||||
if [ ! -e /usr/lib/unrandomize_uuid_generate_random.so ];
|
||||
then
|
||||
echo "P: $(basename $0) Reproducible hook inactive: The UUID module was not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
LD_PRELOAD=/usr/lib/unrandomize_uuid_generate_random.so update-initramfs -k all -u
|
||||
touch /initrd.img_has_already_been_regenerated
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# 'appstreamcli refresh --source=os' which is invoked by 'apt-get update'
|
||||
# creates cache files that will be re-generated by live-config.
|
||||
# These cache files are generated by lb for the C locale, while after boot in
|
||||
# the live image the actual language is used (default=en_US) when a network
|
||||
# connection was made. If no network is available 'GNOME Software' still works
|
||||
# correctly without these cache files.
|
||||
# Therefore these files can safely be removed from the live image.
|
||||
#
|
||||
# However, after all hooks have run, 'apt-get update' is run once again by
|
||||
# 'chroot_archives chroot remove', therefore the original executable
|
||||
# 'appstreamcli' is moved away by this script, to be restored upon the next
|
||||
# invocation.
|
||||
|
||||
# Don't run if AppStream is not installed
|
||||
if [ ! -e /usr/bin/appstreamcli ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Don't run if the version of appstream is too old
|
||||
if dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' appstream | head -1) lt 0.15.2~;
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create a wrapper that restores itself on the next invocation
|
||||
mv /usr/bin/appstreamcli /usr/bin/appstreamcli.orig
|
||||
cat << EOF > /usr/bin/appstreamcli
|
||||
#!/bin/sh
|
||||
/usr/bin/appstreamcli.orig \$@
|
||||
rm /usr/bin/appstreamcli
|
||||
mv /usr/bin/appstreamcli.orig /usr/bin/appstreamcli
|
||||
# Delete the cache files
|
||||
rm -f /var/cache/swcatalog/cache/C-*.xb
|
||||
EOF
|
||||
chmod a+x /usr/bin/appstreamcli
|
||||
|
||||
echo "P: $(basename $0) Reproducible hook has been applied"
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Remove the module and its data file
|
||||
rm -f /usr/lib/unrandomize_uuid_generate_random.so
|
||||
rm -f /var/cache/unrandomize_uuid_generate_random.sequence_number
|
|
@ -1,11 +0,0 @@
|
|||
Use these scripts to generate reproducible images.
|
||||
|
||||
See the generic Wiki page: https://wiki.debian.org/ReproducibleInstalls/LiveImages
|
||||
|
||||
After 'lb config' and before 'lb build' you should copy these hooks:
|
||||
|
||||
cp /usr/share/doc/live-build/examples/hooks/reproducible/* config/hooks/normal
|
||||
|
||||
or (when using the latest git version):
|
||||
|
||||
cp $LIVE_BUILD/examples/hooks/reproducible/* config/hooks/normal
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## 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
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# Makefile
|
||||
|
||||
install:
|
||||
install -D -m 0755 live-build-cgi $(DESTDIR)/usr/lib/cgi-bin/live-build
|
||||
install -D -m 0755 live-build-cgi.cron $(DESTDIR)/etc/cron.hourly/live-build-cgi
|
||||
install -D -m 0644 live-build-cgi.crontab $(DESTDIR)/etc/cron.d/live-build-cgi
|
||||
install -D -m 0644 live-build-cgi.default $(DESTDIR)/etc/default/live-build-cgi
|
||||
install -D -m 0644 live-build-cgi.logrotate $(DESTDIR)/etc/logrotate.d/live-build-cgi
|
||||
|
||||
install -d -m 0755 $(DESTDIR)/var/log
|
||||
touch $(DESTDIR)/var/log/live
|
||||
chown www-data:www-data $(DESTDIR)/var/log/live
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)/usr/lib/cgi-bin/live-build
|
||||
rm -f $(DESTDIR)/etc/cron.d/live-build-cgi
|
||||
rm -f $(DESTDIR)/etc/cron.hourly/live-build-cgi
|
||||
rm -f $(DESTDIR)/etc/default/live-build-cgi
|
||||
rm -f $(DESTDIR)/etc/logrotate.d/live-build-cgi
|
||||
|
||||
reinstall: uninstall install
|
|
@ -0,0 +1,220 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## 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.
|
||||
|
||||
|
||||
# Including common functions
|
||||
. /usr/lib/live/build.sh
|
||||
|
||||
# Reading defaults
|
||||
if [ -r /etc/default/live-build-cgi ]
|
||||
then
|
||||
. /etc/default/live-build-cgi
|
||||
else
|
||||
echo "E: /etc/default/live-build-cgi missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_HOSTNAME="$(hostname -f)"
|
||||
|
||||
# Turn on debug if true
|
||||
if [ "${_DEBUG}" = "true" ]
|
||||
then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Sending http header
|
||||
echo "Content-type: text/html"
|
||||
echo
|
||||
|
||||
# If we are passed something then read it in.
|
||||
if [ "$REQUEST_METHOD" = "POST" ] && [ "$CONTENT_LENGTH" -gt 0 ]
|
||||
then
|
||||
#QUERY_STRING=`cat /dev/stdin`
|
||||
QUERY_STRING=$(cat /dev/stdin)
|
||||
#read -n $CONTENT_LENGTH POST_DATA <&0
|
||||
fi
|
||||
|
||||
# Translate parameters
|
||||
QUERY_STRING=$(echo "${POST_DATA}" | sed -e 's/%2F/\//g' -e 's/+/ /g' -e 's/%3B/;/g' -e 's/%7E/~/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%3D/=/g' -e 's/%2B/+/g')
|
||||
# Debug the filtering string
|
||||
# echo ${QUERY_STRING}
|
||||
|
||||
|
||||
# Sending html header
|
||||
cat "${_TEMPLATES}"/header.html
|
||||
|
||||
# CGI
|
||||
if [ -z "${QUERY_STRING}" ]
|
||||
then
|
||||
# Sending html form
|
||||
sed -e "s/VERSION/${VERSION}/" \
|
||||
-e "s/DATE/`date +%Y%m%d-%H:%M`/" \
|
||||
"${_TEMPLATES}"/form.html
|
||||
else
|
||||
# Converting spaces: sed 's/+/ /g'
|
||||
# Converting '@': sed 's/%40/@/g'
|
||||
# Converting ':': sed 's/%3A/:/g'
|
||||
# Converting ';': sed 's/%3B/\;/g'
|
||||
# Converting '/': sed 's/%2F/\//g'
|
||||
# Converting '~': sed 's/%7E/\~/g'
|
||||
# Converting '=': sed 's/%3D/=/g'
|
||||
# Converting '+': sed 's/%2B/+/g'
|
||||
|
||||
# Email
|
||||
_EMAIL=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])email=[-0-9a-zA-Z._@]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# CGI Packages List
|
||||
_LB_CGIPACKAGES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])cgipackages=[-0-9a-zA-Z. _+]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# CGI Config for git
|
||||
_LB_CONFIG=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])config=[-a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# Standard options
|
||||
LIVE_IMAGE_TYPE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])binary_images=[-a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_DISTRIBUTION=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])distribution=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_APT=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])apt=[a-u]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# Advanced bootstrap options
|
||||
LIVE_IMAGE_ARCHITECTURE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])architectures=[0-9a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LIVE_IMAGE_ARCHIVE_AREAS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])archive_areas=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# Advanced chroot options
|
||||
LB_CHROOT_FILESYSTEM=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])chroot_filesystem=[0-9a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_LINUX_FLAVOURS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])linux_flavours=[-0-9a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_SECURITY=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])security=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# Advanced binary options
|
||||
LB_APT_INDICES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])apt_indices=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_BOOTAPPEND_INSTALL=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootappend_install=[-0-9a-zA-Z. _+=:/]+' | cut -f2- -d '=' | head -n1)
|
||||
LB_BOOTAPPEND_LIVE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootappend_live=[-0-9a-zA-Z. _+=:/]+' | cut -f2- -d '=' | head -n1)
|
||||
LB_BOOTLOADER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootloader=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_DEBIAN_INSTALLER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])debian_installer=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_ISO_APPLICATION=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_application=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_ISO_PREPARER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_preparer=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_ISO_PUBLISHER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_publisher=[-0-9a-zA-Z. ~;:/_@]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_ISO_VOLUME=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_volume=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_MEMTEST=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])memtest=[0-9a-z+]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_NET_ROOT_PATH=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])net_path=[-0-9a-zA-Z._/]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_NET_ROOT_SERVER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])net_server=[0-9.]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# Advanced source options
|
||||
LB_SOURCE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])source=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
LB_SOURCE_IMAGES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])source_images=[a-z]+' | cut -f 2 -d '=' | head -n1)
|
||||
|
||||
# FIXME: filter invalid options
|
||||
unset QUERY_STRING
|
||||
|
||||
if [ -z "${_EMAIL}" ]
|
||||
then
|
||||
echo "<h2><div style='color: red;'>Error: No email address specified.</div></h2>"
|
||||
|
||||
sed -e "s/VERSION/${VERSION}/" \
|
||||
-e "s/DATE/`date +%Y%m%d-%H:%M`/" \
|
||||
"${_TEMPLATES}"/form.html
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
# Getting build identifier
|
||||
_BUILD=$(date +%Y%m%d.%H%M%S.%N)
|
||||
|
||||
# Getting number of builds pending.
|
||||
_QUEUENUM=$(ls "${_TEMPDIR}"/*.build | wc -l)
|
||||
|
||||
#echo "${QUERY_STRING}"
|
||||
# Sending html confirmation
|
||||
# Note: On each string remember to use a delimeter that is not in the string.
|
||||
sed -e "s/BUILD/${_BUILD}/g" \
|
||||
-e "s/EMAIL/${_EMAIL}/" \
|
||||
-e "s/QUEUENUM/${_QUEUENUM}/" \
|
||||
-e "s/LIVE_IMAGE_TYPE/${LIVE_IMAGE_TYPE}/" \
|
||||
-e "s/LB_DISTRIBUTION/${LB_DISTRIBUTION}/" \
|
||||
-e "s#_LB_CONFIG#${_LB_CONFIG}#" \
|
||||
-e "s/LB_APT/${LB_APT}/" \
|
||||
-e "s/_LB_CGIPACKAGES/${_LB_CGIPACKAGES}/" \
|
||||
-e "s/LIVE_IMAGE_ARCHITECTURE/${LIVE_IMAGE_ARCHITECTURE}/" \
|
||||
-e "s/LIVE_IMAGE_ARCHIVE_AREAS/${LIVE_IMAGE_ARCHIVE_AREAS}/" \
|
||||
-e "s/LB_CHROOT_FILESYSTEM/${LB_CHROOT_FILESYSTEM}/" \
|
||||
-e "s/LB_LINUX_FLAVOURS/${LB_LINUX_FLAVOURS}/" \
|
||||
-e "s/LB_SECURITY/${LB_SECURITY}/" \
|
||||
-e "s/LB_APT_INDICES/${LB_APT_INDICES}/" \
|
||||
-e "s#LB_BOOTAPPEND_INSTALL#${LB_BOOTAPPEND_INSTALL}#" \
|
||||
-e "s#LB_BOOTAPPEND_LIVE#${LB_BOOTAPPEND_LIVE}#" \
|
||||
-e "s/LB_BOOTLOADER/${LB_BOOTLOADER}/" \
|
||||
-e "s/LB_DEBIAN_INSTALLER/${LB_DEBIAN_INSTALLER}/" \
|
||||
-e "s#LB_ISO_APPLICATION#${LB_ISO_APPLICATION}#" \
|
||||
-e "s#LB_ISO_PREPARER#${LB_ISO_PREPARER}#" \
|
||||
-e "s#LB_ISO_PUBLISHER#${LB_ISO_PUBLISHER}#" \
|
||||
-e "s#LB_ISO_VOLUME#${LB_ISO_VOLUME}#" \
|
||||
-e "s/LB_MEMTEST/${LB_MEMTEST}/" \
|
||||
-e "s#LB_NET_ROOT_PATH#${LB_NET_ROOT_PATH}#" \
|
||||
-e "s/LB_NET_ROOT_SERVER/${LB_NET_ROOT_SERVER}/" \
|
||||
-e "s#SERVER#${_SERVER}#g" \
|
||||
-e "s/LB_SOURCE_IMAGES/${LB_SOURCE_IMAGES}/" \
|
||||
-e "s/LB_SOURCE/${LB_SOURCE}/" \
|
||||
"${_TEMPLATES}"/build.html
|
||||
|
||||
# Creating temporary directory
|
||||
mkdir -p "${_TEMPDIR}"
|
||||
|
||||
# Writing build file
|
||||
cat > "${_TEMPDIR}"/"${_BUILD}".build << EOF
|
||||
# live-build-cgi "${VERSION}" build file
|
||||
# `date -R`
|
||||
|
||||
_BUILD="${_BUILD}"
|
||||
_EMAIL="${_EMAIL}"
|
||||
|
||||
REMOTE_ADDR="${REMOTE_ADDR}"
|
||||
|
||||
# CGI Packages List
|
||||
_LB_CGIPACKAGES="${_LB_CGIPACKAGES}"
|
||||
|
||||
# CGI Config for git
|
||||
_LB_CONFIG="${_LB_CONFIG}"
|
||||
|
||||
# Standard options
|
||||
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE}"
|
||||
LB_DISTRIBUTION="${LB_DISTRIBUTION}"
|
||||
LB_APT="${LB_APT}"
|
||||
|
||||
# Advanced bootstrap options
|
||||
LIVE_IMAGE_ARCHITECTURE="${LIVE_IMAGE_ARCHITECTURE}"
|
||||
LIVE_IMAGE_ARCHIVE_AREAS="${LIVE_IMAGE_ARCHIVE_AREAS}"
|
||||
|
||||
# Advanced chroot options
|
||||
LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}"
|
||||
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS}"
|
||||
LB_SECURITY="${LB_SECURITY}"
|
||||
|
||||
# Advanced binary options
|
||||
LB_APT_INDICES="${LB_APT_INDICES}"
|
||||
LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}"
|
||||
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}"
|
||||
LB_BOOTLOADER="${LB_BOOTLOADER}"
|
||||
LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER}"
|
||||
LB_ISO_APPLICATION="${LB_ISO_APPLICATION}"
|
||||
LB_ISO_PREPARER="${LB_ISO_PREPARER}"
|
||||
LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}"
|
||||
LB_ISO_VOLUME="${LB_ISO_VOLUME}"
|
||||
LB_MEMTEST="${LB_MEMTEST}"
|
||||
LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH}"
|
||||
LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER}"
|
||||
|
||||
# Advanced source options
|
||||
LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}"
|
||||
LB_SOURCE="${LB_SOURCE}"
|
||||
|
||||
EOF
|
||||
|
||||
echo "$(date +%b\ %d\ %H:%M:%S) ${_HOSTNAME} live-build-cgi: add web build (${_BUILD}) from ${REMOTE_ADDR}." >> /var/log/live/live-build-request
|
||||
echo "$(date +%b\ %d\ %H:%M:%S) ${_HOSTNAME} live-build-cgi: options ${_BUILD} |email ${_EMAIL}|binary_images ${LIVE_IMAGE_TYPE}|distribution ${LB_DISTRIBUTION}|config ${_LB_CONFIG}|apt ${LB_APT}|cgipackages ${_LB_CGIPACKAGES}|architectures ${LIVE_IMAGE_ARCHITECTURE}|archive_areas ${LIVE_IMAGE_ARCHIVE_AREAS}|chroot_filesystem ${LB_CHROOT_FILESYSTEM}|linux_flavours ${LB_LINUX_FLAVOURS}|security ${LB_SECURITY}|apt_indices ${LB_APT_INDICES}|bootappend_install ${LB_BOOTAPPEND_INSTALL}|bootappend_live ${LB_BOOTAPPEND_LIVE}|bootloader ${LB_BOOTLOADER}|debian_installer ${LB_DEBIAN_INSTALLER}|iso_application ${LB_ISO_APPLICATION}|iso_preparer ${LB_ISO_PREPARER}|iso_publisher ${LB_ISO_PUBLISHER}|iso_volume ${LB_ISO_VOLUME}|memtest ${LB_MEMTEST}|net_path ${LB_NET_ROOT_PATH}|net_server ${LB_NET_ROOT_SERVER}|source_images ${LB_SOURCE_IMAGES}|sources ${LB_SOURCE}" >> /var/log/live/live-build-request
|
||||
fi
|
||||
|
||||
sed -e "s/VERSION/${VERSION}/" "${_TEMPLATES}"/footer.html
|
|
@ -0,0 +1,200 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## 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.
|
||||
|
||||
# Including common functions
|
||||
. /usr/lib/live/build.sh
|
||||
|
||||
# Reading defaults
|
||||
if [ -r /etc/default/live-build-cgi ]
|
||||
then
|
||||
. /etc/default/live-build-cgi
|
||||
else
|
||||
echo "E: /etc/default/live-build-cgi missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Exit if disabled
|
||||
if [ "${_WEBBUILD}" != "true" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
_HOSTNAME="$(hostname -f)"
|
||||
|
||||
# Turn on debug if true
|
||||
if [ "${_DEBUG}" = "true" ]
|
||||
then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Locknum sets the lock enumeration for multiple instances of l-b-cgi
|
||||
_LOCKNUM="$(expr 1 + $(expr $(date +%M) % ${_INSTANCES}))"
|
||||
|
||||
# Checking lock file
|
||||
if [ -f /var/lock/live-build-cgi-${_LOCKNUM}.lock ]
|
||||
then
|
||||
echo "E: live-build-cgi instance ${_LOCKNUM} already/still running."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Creating lock trap
|
||||
trap "test -f /var/lock/live-build-cgi-${_LOCKNUM}.lock && rm -f /var/lock/live-build-cgi-${_LOCKNUM}.lock; exit 0" 0 1 2 3 9 15
|
||||
|
||||
# Creating lock file
|
||||
touch /var/lock/live-build-cgi-${_LOCKNUM}.lock
|
||||
|
||||
# Cleanup old builds: cron should be run at least once per hour to take effect
|
||||
if ls "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`* > /dev/null 2>&1
|
||||
then
|
||||
rm -rf "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`*
|
||||
|
||||
echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: remove web build (`date -d yesterday +%Y%m%d.%H`*)." >> /var/log/live/live-build
|
||||
fi
|
||||
|
||||
# Ok from here spin through the live-build-cgi files we have waiting to build
|
||||
#if ls "${_TEMPDIR}"/*.build > /dev/null 2>&1
|
||||
if Find_files ${_TEMPDIR}/*.build
|
||||
then
|
||||
_FILE=$(ls "${_TEMPDIR}"/*.build | sort | head -1)
|
||||
# Pull in variables from the build file.
|
||||
. "${_FILE}"
|
||||
|
||||
# Drop out some build data for information if something goes wrong.
|
||||
echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: begin web build (${_BUILD})." >> /var/log/live/live-build
|
||||
|
||||
# Clone the git config to target build directory
|
||||
git clone ${_LB_GIT} "${_TEMPDIR}"/"${_BUILD}" >> /var/log/live/live-build
|
||||
_ERRORGIT="${?}"
|
||||
|
||||
# Moving build file to the tempdir and remove from submission area.
|
||||
mv "${_TEMPDIR}"/"${_BUILD}".build "${_TEMPDIR}"/"${_BUILD}"/
|
||||
|
||||
# Sanity check to default to something since we are going to build from git clone.
|
||||
if [ -z "${_LB_CONFIG}" ]
|
||||
then
|
||||
_LB_CONFIG="standard"
|
||||
fi
|
||||
|
||||
# Now set a variable for the correct build path
|
||||
_BUILD_PATH="${_TEMPDIR}/${_BUILD}/images/${_LB_CONFIG}"
|
||||
|
||||
_DATE_START="`date -R`"
|
||||
echo "Begin live-build-cgi: ${_DATE_START}" > "${_BUILD_PATH}"/log
|
||||
echo "Info live-build-cgi: Config tree cloned from ${_LB_GIT} for build ${_BUILD}" >> "${_BUILD_PATH}"/log
|
||||
|
||||
# Creating directory for the config/package-lists
|
||||
mkdir -p "${_BUILD_PATH}"/config/package-lists
|
||||
|
||||
# Add cgipackages.list.chroot
|
||||
if [ -n "${_LB_CGIPACKAGES}" ]
|
||||
then
|
||||
echo "${_LB_CGIPACKAGES}" > "${_BUILD_PATH}"/config/package-lists/cgipackages.list.chroot
|
||||
fi
|
||||
|
||||
# Generating config here
|
||||
if [ "${_ERRORGIT}" -eq "0" ]
|
||||
then
|
||||
cd "${_BUILD_PATH}"
|
||||
# Do config with git and stack on config file params to build
|
||||
lb config ${_CGI_CONFIG_APPEND} --apt "${LB_APT}" --distribution "${LB_DISTRIBUTION}" --binary-images "${LB_BINARY_IMAGES}" --architectures "${LIVE_IMAGE_ARCHITECTURE}" --archive-areas "${LIVE_IMAGE_ARCHIVE_AREAS}" --chroot-filesystem "${LB_CHROOT_FILESYSTEM}" --linux-flavours "${LB_LINUX_FLAVOURS}" --security "${LB_SECURITY}" --apt-indices "${LB_APT_INDICES}" --bootappend-install "${LB_BOOTAPPEND_INSTALL}" --bootappend-live "${LB_BOOTAPPEND_LIVE}" --bootloader "${LB_BOOTLOADER}" --debian-installer "${LB_DEBIAN_INSTALLER}" --iso-application "${LB_ISO_APPLICATION}" --iso-preparer "${LB_ISO_PREPARER}" --iso-publisher "${LB_ISO_PUBLISHER}" --iso-volume "${LB_ISO_VOLUME}" --memtest "${LB_MEMTEST}" --net-root-path "${LB_NET_ROOT_PATH}" --net-root-server "${LB_NET_ROOT_SERVER}" --source-images "${LB_SOURCE_IMAGES}" --source "${LB_SOURCE}"
|
||||
_ERRORCONFIG="${?}"
|
||||
else
|
||||
echo "Config stage skipped. The git clone produced an error: ${_ERRORGIT}" >> "${_BUILD_PATH}"/log
|
||||
fi
|
||||
|
||||
# Run build if config went ok
|
||||
if [ "${_ERRORCONFIG}" -eq "0" ]
|
||||
then
|
||||
# We need to finish script.
|
||||
set +e
|
||||
lb build noauto >> "${_BUILD_PATH}"/log 2>&1
|
||||
_ERRORBUILD="${?}"
|
||||
else
|
||||
echo "Build stage skipped. Config produced an error: ${_ERRORCONFIG}" >> "${_BUILD_PATH}"/log
|
||||
fi
|
||||
|
||||
_DATE_END="`date -R`"
|
||||
echo "End: ${_DATE_END}" >> "${_BUILD_PATH}"/log
|
||||
|
||||
# Creating image directory
|
||||
mkdir -p "${_DESTDIR}"/"${_BUILD}"
|
||||
|
||||
# Creating mail and logging.
|
||||
if [ "${_ERRORGIT}" -eq "0" ] && [ "${_ERRORCONFIG}" -eq "0" ] && [ "${_ERRORBUILD}" -eq "0" ]
|
||||
then
|
||||
_STATUS="maybe-successful"
|
||||
echo "${REMOTE_ADDR} - - `date +[%d/%b/%Y:%H:%m:%S\ %z]` \"${_BUILD} ${LIVE_IMAGE_ARCHITECTURE}/${LB_DISTRIBUTION}/${_LB_CGIPACKAGES}\" 200 - \"-\" \"\"">>/var/log/live/live-build-cgi-status
|
||||
else
|
||||
_STATUS="maybe-failed"
|
||||
echo "${REMOTE_ADDR} - - `date +[%d/%b/%Y:%H:%m:%S\ %z]` \"${_BUILD} ${LIVE_IMAGE_ARCHITECTURE}/${LB_DISTRIBUTION}/${_LB_CGIPACKAGES}\" 404 - \"-\" \"\"">>/var/log/live/live-build-cgi-status
|
||||
fi
|
||||
|
||||
sed -e "s/BUILD/${_BUILD}/g" \
|
||||
-e "s/EMAIL/${_EMAIL}/" \
|
||||
-e "s/VERSION/${VERSION}/" \
|
||||
-e "s/DATE_START/${_DATE_START}/" \
|
||||
-e "s/DATE_END/${_DATE_END}/" \
|
||||
-e "s/STATUS/${_STATUS}/" \
|
||||
-e "s#SERVER#${_SERVER}#" \
|
||||
"${_TEMPLATES}"/mail.txt > "${_DESTDIR}"/"${_BUILD}"/mail
|
||||
|
||||
cat >> "${_DESTDIR}"/"${_BUILD}"/mail << EOF
|
||||
|
||||
---
|
||||
|
||||
Here's a list of all build-options that were used to build your image:
|
||||
|
||||
EOF
|
||||
|
||||
cat "${_TEMPDIR}"/"${_BUILD}"/"${_BUILD}".build >> "${_DESTDIR}"/"${_BUILD}"/mail
|
||||
|
||||
# Moving live-image-* files
|
||||
if Find_files ${_BUILD_PATH}/live-image-*
|
||||
then
|
||||
mv "${_BUILD_PATH}"/live-image-* "${_DESTDIR}"/"${_BUILD}"
|
||||
fi
|
||||
|
||||
# Moving build
|
||||
mv "${_TEMPDIR}"/"${_BUILD}"/"${_BUILD}".build "${_DESTDIR}"/"${_BUILD}"/build
|
||||
|
||||
# Moving log
|
||||
mv "${_BUILD_PATH}"/log "${_DESTDIR}"/"${_BUILD}"
|
||||
|
||||
# Generating md5sum
|
||||
cd "${_DESTDIR}"/"${_BUILD}"
|
||||
md5sum * > md5sum
|
||||
cd "${OLDPWD}"
|
||||
|
||||
# Sending mail
|
||||
cat "${_DESTDIR}"/"${_BUILD}"/mail | /usr/sbin/sendmail -t
|
||||
|
||||
# Unmounting devpts-live
|
||||
#if ls "${_TEMPDIR}"/"${_BUILD}"/chroot/dev/pts/* > /dev/null 2>&1
|
||||
if Find_files ${_BUILD_PATH}/chroot/dev/pts/*
|
||||
then
|
||||
umount "${_BUILD_PATH}"/chroot/dev/pts
|
||||
fi
|
||||
|
||||
# Unmounting proc
|
||||
if [ -f "${_BUILD_PATH}"/chroot/proc/version ]
|
||||
then
|
||||
umount "${_BUILD_PATH}"/chroot/proc
|
||||
fi
|
||||
|
||||
# Unmounting sysfs
|
||||
if [ -d "${_BUILD_PATH}"/chroot/sys/kernel ]
|
||||
then
|
||||
umount "${_BUILD_PATH}"/chroot/sys
|
||||
fi
|
||||
|
||||
# Removing build directory
|
||||
rm -rf "${_TEMPDIR}"/"${_BUILD}"
|
||||
|
||||
echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: end web build (${_BUILD}: ${_STATUS})." >> /var/log/live/live-build
|
||||
fi
|
|
@ -0,0 +1,7 @@
|
|||
# /etc/crontab - system-wide crontab
|
||||
|
||||
SHELL=/bin/sh
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# m h dom mon dow user command
|
||||
*/1 * * * * root /etc/cron.hourly/live-build-cgi > /dev/null 2>&1
|
|
@ -0,0 +1,19 @@
|
|||
# Defaults for /etc/cron.daily/live-build-cgi
|
||||
|
||||
_WEBBUILD="false"
|
||||
|
||||
_MODE="debian"
|
||||
|
||||
_DEBUG="false"
|
||||
|
||||
_INSTANCES="1"
|
||||
|
||||
_DESTDIR="/srv/debian-live/build/www"
|
||||
_TEMPLATES="/usr/share/live/build/templates/cgi/${_MODE}"
|
||||
_TEMPDIR="/srv/debian-live/build/tmp"
|
||||
|
||||
_SERVER="http://live-systems.org/build"
|
||||
|
||||
_LB_GIT="git://live-systems.org/git/live-images.git"
|
||||
|
||||
_CGI_CONFIG_APPEND=""
|
|
@ -0,0 +1,11 @@
|
|||
# /etc/logrotate.d/live-build
|
||||
|
||||
/var/log/live
|
||||
{
|
||||
compress
|
||||
copytruncate
|
||||
missingok
|
||||
monthly
|
||||
notifempty
|
||||
rotate 24
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## 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.
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
# Including common functions
|
||||
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
||||
|
||||
# Setting static variables
|
||||
DESCRIPTION="$(Echo 'utility to build live systems')"
|
||||
HELP="FIXME"
|
||||
USAGE="FIXME"
|
||||
|
||||
case "${1}" in
|
||||
-h|--help)
|
||||
if [ -x "$(which man 2>/dev/null)" ]
|
||||
then
|
||||
man lb
|
||||
exit 0
|
||||
else
|
||||
${0} --usage
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
|
||||
""|-u|--usage)
|
||||
Usage
|
||||
;;
|
||||
|
||||
-v|--version)
|
||||
echo "${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
COMMAND="${1}"
|
||||
shift
|
||||
|
||||
ENV=""
|
||||
|
||||
if [ "${COMMAND}" != "config" ]
|
||||
then
|
||||
# Checking user account
|
||||
if [ "$(id -u)" -ne "0" ]
|
||||
then
|
||||
Echo_error "need root privileges"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for _FILE in config/environment config/environment.binary
|
||||
do
|
||||
if [ -e "${_FILE}" ]
|
||||
then
|
||||
ENV="${ENV} $(grep -v '^#' ${_FILE})"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -x "${LIVE_BUILD}/scripts/build/${COMMAND}" ]
|
||||
then
|
||||
# User has live-build copied locally in the system
|
||||
SCRIPT="${LIVE_BUILD}/scripts/build/${COMMAND}"
|
||||
elif [ -x "${LIVE_BUILD}/components/${COMMAND}" ]
|
||||
then
|
||||
# User has live-build copied locally in the system
|
||||
SCRIPT="${LIVE_BUILD}/components/${COMMAND}"
|
||||
elif [ -x "local/live-build/scripts/build/${COMMAND}" ]
|
||||
then
|
||||
# User has live-build copied locally in the config
|
||||
SCRIPT="local/live-build/scripts/build/${COMMAND}"
|
||||
elif [ -x /usr/lib/live/build/${COMMAND} ]
|
||||
then
|
||||
# User has live-build installed in the system
|
||||
SCRIPT=/usr/lib/live/build/"${COMMAND}"
|
||||
elif [ -x "$(which ${COMMAND} 2>/dev/null)" ]
|
||||
then
|
||||
# User has live-build commands in path
|
||||
SCRIPT="${COMMAND}"
|
||||
else
|
||||
Echo_error "no such script: ${COMMAND}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Echo "[%s] %s" "$(date +'%F %T')" "lb ${COMMAND} $(echo ${@})"
|
||||
${ENV} exec "${SCRIPT}" "${@}"
|
||||
;;
|
||||
esac
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,7 +22,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
if command -v man >/dev/null
|
||||
if [ -x "$(which man 2>/dev/null)" ]
|
||||
then
|
||||
man live-build
|
||||
else
|
81
frontend/lb
81
frontend/lb
|
@ -1,81 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 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.
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
# Including common functions
|
||||
[ -n "${LIVE_BUILD}" ] && [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
||||
|
||||
# Setting static variables
|
||||
PROGRAM="${FRONTEND}"
|
||||
DESCRIPTION="Utility to build live systems"
|
||||
USAGE="lb {clean|config|build}"
|
||||
|
||||
# This bits of code relies on the fact that we only accept
|
||||
# options without values before the real command.
|
||||
GLOBAL_ARGS=""
|
||||
while true; do
|
||||
case $1 in
|
||||
-*)
|
||||
GLOBAL_ARGS="${GLOBAL_ARGS:+$GLOBAL_ARGS }$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Arguments $GLOBAL_ARGS
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
Echo_error "Missing sub-command"
|
||||
Usage --fail
|
||||
fi
|
||||
|
||||
COMMAND="${1}"
|
||||
shift
|
||||
|
||||
if [ -x "${LIVE_BUILD}/scripts/build/${COMMAND}" ]; then
|
||||
# User has live-build copied locally in the system
|
||||
SCRIPT="${LIVE_BUILD}/scripts/build/${COMMAND}"
|
||||
elif [ -x "local/live-build/scripts/build/${COMMAND}" ]; then
|
||||
# User has live-build copied locally in the config
|
||||
SCRIPT="local/live-build/scripts/build/${COMMAND}";
|
||||
elif [ -x /usr/lib/live/build/${COMMAND} ]; then
|
||||
# User has live-build installed in the system
|
||||
SCRIPT=/usr/lib/live/build/"${COMMAND}"
|
||||
else
|
||||
Echo_error "Unknown command: ${COMMAND}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${COMMAND}" != "config" ]; then
|
||||
# Checking user account
|
||||
if [ "$(id -u)" -ne "0" ]; then
|
||||
Echo_error "Root privileges needed!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ENV=""
|
||||
for _FILE in config/environment config/environment.binary; do
|
||||
if [ -e "${_FILE}" ]; then
|
||||
ENV="${ENV} $(grep -v '^#' ${_FILE})"
|
||||
fi
|
||||
done
|
||||
|
||||
_CMD_LABEL="lb ${COMMAND}"
|
||||
if [ "${_COLOR_OUT}" = "true" ]; then
|
||||
_CMD_LABEL="${CYAN}${_CMD_LABEL}${NO_COLOR}"
|
||||
fi
|
||||
Echo "[%s] ${_CMD_LABEL} %s" "$(date +'%F %T')" "$(echo ${GLOBAL_ARGS} ${@})"
|
||||
|
||||
exec /usr/bin/env ${ENV} "${SCRIPT}" ${GLOBAL_ARGS} "${@}"
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## 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
|
||||
|
@ -16,14 +15,18 @@ Find_files ()
|
|||
|
||||
In_list ()
|
||||
{
|
||||
local NEEDLE="${1}"
|
||||
NEEDLES="${1}"
|
||||
shift
|
||||
|
||||
local ITEM
|
||||
for ITEM in "${@}"; do
|
||||
if [ "${NEEDLE}" = "${ITEM}" ]; then
|
||||
return 0
|
||||
fi
|
||||
for ITEM in ${@}
|
||||
do
|
||||
for NEEDLE in ${NEEDLES}
|
||||
do
|
||||
if [ "${NEEDLE}" = "${ITEM}" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
return 1
|
||||
|
@ -31,11 +34,8 @@ In_list ()
|
|||
|
||||
Truncate ()
|
||||
{
|
||||
local FILE
|
||||
for FILE in "${@}"; do
|
||||
if [ ! -L ${FILE} ]
|
||||
then
|
||||
: > ${FILE}
|
||||
fi
|
||||
for FILE in ${@}
|
||||
do
|
||||
: > ${FILE}
|
||||
done
|
||||
}
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## 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.
|
||||
|
||||
|
||||
Check_architectures ()
|
||||
{
|
||||
ARCHITECTURES="${@}"
|
||||
VALID="false"
|
||||
|
||||
for ARCHITECTURE in ${ARCHITECTURES}
|
||||
do
|
||||
if [ "$(echo ${LIVE_IMAGE_ARCHITECTURE} | grep ${ARCHITECTURE})" ]
|
||||
then
|
||||
VALID="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${ARCHITECTURES}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ]
|
||||
then
|
||||
VALID="true"
|
||||
|
||||
if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURES} was not found"
|
||||
VALID="false"
|
||||
fi
|
||||
|
||||
if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable"
|
||||
VALID="false"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ "${VALID}" = "false" ]
|
||||
then
|
||||
Echo_warning "skipping %s, foreign architecture(s)." "${0}"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
Check_crossarchitectures ()
|
||||
{
|
||||
if [ -x /usr/bin/dpkg ]
|
||||
then
|
||||
HOST="$(dpkg --print-architecture)"
|
||||
else
|
||||
HOST="$(uname -m)"
|
||||
fi
|
||||
|
||||
case "${HOST}" in
|
||||
amd64|i386|x86_64)
|
||||
CROSS="amd64 i386"
|
||||
;;
|
||||
|
||||
powerpc|ppc64)
|
||||
CROSS="powerpc ppc64"
|
||||
;;
|
||||
|
||||
*)
|
||||
CROSS="${HOST}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${LIVE_IMAGE_ARCHITECTURE}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ]
|
||||
then
|
||||
|
||||
if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURES} was not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ]
|
||||
then
|
||||
Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable"
|
||||
exit 0
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
Check_architectures "${CROSS}"
|
||||
}
|
||||
|
||||
Check_multiarchitectures ()
|
||||
{
|
||||
if [ "$(echo ${LIVE_IMAGE_ARCHITECTURE} | wc -w)" -gt "1" ]
|
||||
then
|
||||
# First, only support multiarch on iso
|
||||
case "${LIVE_IMAGE_TYPE}" in
|
||||
iso*)
|
||||
# Assemble multi-arch
|
||||
case "${LB_CURRENT_ARCHITECTURE}" in
|
||||
amd64)
|
||||
DESTDIR="${DESTDIR}.amd"
|
||||
DESTDIR_LIVE="${DESTDIR_LIVE}.amd"
|
||||
DESTDIR_INSTALL="${DESTDIR_INSTALL}.amd"
|
||||
;;
|
||||
|
||||
i386)
|
||||
DESTDIR="${DESTDIR}.386"
|
||||
DESTDIR_LIVE="${DESTDIR_LIVE}.386"
|
||||
DESTDIR_INSTALL="${DESTDIR_INSTALL}.386"
|
||||
;;
|
||||
|
||||
powerpc)
|
||||
DESTDIR="${DESTDIR}.ppc"
|
||||
DESTDIR_LIVE="${DESTDIR_LIVE}.ppc"
|
||||
DESTDIR_INSTALL="${DESTDIR_INSTALL}.ppc"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## 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
|
||||
|
@ -11,95 +10,73 @@
|
|||
|
||||
Arguments ()
|
||||
{
|
||||
local LONGOPTS="breakpoints,color,debug,force,help,no-color,quiet,usage,verbose,version"
|
||||
local SHORTOPTS="huv"
|
||||
ARGUMENTS="$(getopt --longoptions breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options c:huv --shell sh -- "${@}")"
|
||||
|
||||
local ARGUMENTS
|
||||
local ERR=0
|
||||
ARGUMENTS="$(getopt --shell sh --name "${PROGRAM}" --longoptions $LONGOPTS --options $SHORTOPTS -- "${@}")" || ERR=$?
|
||||
|
||||
if [ $ERR -eq 1 ]; then
|
||||
Echo_error "invalid argument(s)"
|
||||
exit 1
|
||||
elif [ $ERR -ne 0 ]; then
|
||||
Echo_error "getopt failure"
|
||||
if [ "${?}" != "0" ]
|
||||
then
|
||||
Echo_error "terminating" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "${ARGUMENTS}"
|
||||
|
||||
while true; do
|
||||
local ARG="${1}"
|
||||
case "${ARG}" in
|
||||
--breakpoints|--color|--debug|--force|-h|--help|--no-color|--quiet|-u|--usage|--verbose|-v|--version)
|
||||
Handle_common_option "${ARG}"
|
||||
while true
|
||||
do
|
||||
case "${1}" in
|
||||
--breakpoints)
|
||||
_BREAKPOINTS="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-c|--conffile)
|
||||
_CONFFILE="${2}"
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--debug)
|
||||
_DEBUG="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
--force)
|
||||
_FORCE="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
Man
|
||||
shift
|
||||
;;
|
||||
|
||||
--quiet)
|
||||
_QUIET="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-u|--usage)
|
||||
Usage
|
||||
shift
|
||||
;;
|
||||
|
||||
--verbose)
|
||||
_VERBOSE="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-v|--version)
|
||||
echo "${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
|
||||
*)
|
||||
Echo_error "Internal error, unhandled option: %s" "${ARG}"
|
||||
Echo_error "internal error %s" "${0}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Handle_common_option ()
|
||||
{
|
||||
case "${1}" in
|
||||
--breakpoints)
|
||||
_BREAKPOINTS="true"
|
||||
;;
|
||||
|
||||
--color)
|
||||
_COLOR="true"
|
||||
_COLOR_OUT="true"
|
||||
_COLOR_ERR="true"
|
||||
;;
|
||||
|
||||
--no-color)
|
||||
_COLOR="false"
|
||||
_COLOR_OUT="false"
|
||||
_COLOR_ERR="false"
|
||||
;;
|
||||
|
||||
--debug)
|
||||
_DEBUG="true"
|
||||
;;
|
||||
|
||||
--force)
|
||||
_FORCE="true"
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
Man
|
||||
;;
|
||||
|
||||
--quiet)
|
||||
_QUIET="true"
|
||||
;;
|
||||
|
||||
-u|--usage)
|
||||
Usage --exit
|
||||
;;
|
||||
|
||||
--verbose)
|
||||
_VERBOSE="true"
|
||||
;;
|
||||
|
||||
-v|--version)
|
||||
echo "${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
Echo_error "Internal error: Unknown common option '%s'" "${1}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## 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
|
||||
|
@ -11,7 +10,7 @@
|
|||
|
||||
Breakpoint ()
|
||||
{
|
||||
local NAME="${1}"
|
||||
NAME="${1}"
|
||||
|
||||
if [ "${_BREAKPOINTS}" = "true" ]
|
||||
then
|
||||
|
|
|
@ -1,38 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
## live-build(7) - System Build Scripts
|
||||
## Copyright (C) 2016-2020 The Debian Live team
|
||||
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
||||
## 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.
|
||||
|
||||
|
||||
Restore_package_cache ()
|
||||
Restore_cache ()
|
||||
{
|
||||
local DIRECTORY="cache/packages.${1}"
|
||||
DIRECTORY="${1}"
|
||||
|
||||
if [ "${LB_CACHE}" = "true" ] && [ "${LB_CACHE_PACKAGES}" = "true" ]
|
||||
then
|
||||
if [ -e "${DIRECTORY}" ]
|
||||
then
|
||||
# Restore old cache
|
||||
if [ "$(stat --printf %d ${DIRECTORY}/)" = "$(stat --printf %d chroot/var/cache/apt/archives/)" ]
|
||||
if [ "$(stat --printf %d ${DIRECTORY})" = "$(stat --printf %d chroot/var/cache/apt/archives)" ]
|
||||
then
|
||||
# with hardlinks
|
||||
find "${DIRECTORY}" -name "*.deb" -print0 | xargs -0 --no-run-if-empty cp -fl -t chroot/var/cache/apt/archives
|
||||
find "${DIRECTORY}" -name "*.deb" | xargs cp -fl -t chroot/var/cache/apt/archives
|
||||
else
|
||||
# without hardlinks
|
||||
find "${DIRECTORY}" -name "*.deb" -print0 | xargs -0 --no-run-if-empty cp -t chroot/var/cache/apt/archives
|
||||
find "${DIRECTORY}" -name "*.deb" | xargs cp -t chroot/var/cache/apt/archives
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Save_package_cache ()
|
||||
Save_cache ()
|
||||
{
|
||||
local DIRECTORY="cache/packages.${1}"
|
||||
DIRECTORY="${1}"
|
||||
|
||||
if [ "${LB_CACHE}" = "true" ] && [ "${LB_CACHE_PACKAGES}" = "true" ]
|
||||
then
|
||||
|
@ -47,7 +46,6 @@ Save_package_cache ()
|
|||
mkdir -p "${DIRECTORY}"
|
||||
|
||||
# Saving new cache
|
||||
local PACKAGE
|
||||
for PACKAGE in chroot/var/cache/apt/archives/*.deb
|
||||
do
|
||||
if [ -e "${DIRECTORY}"/"$(basename ${PACKAGE})" ]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue