diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..8a7c7365f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: grml diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml new file mode 100644 index 000000000..6b385e8e0 --- /dev/null +++ b/.github/workflows/pr-review.yml @@ -0,0 +1,41 @@ +# PR Review workflows. + +name: pr-review +on: + workflow_dispatch: + pull_request: + push: +jobs: + shellcheck-code: + name: shellcheck main code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + path: "." + pattern: | + grml-live + scripts/*.sh + remaster/grml-live-remaster + config/hooks/* + config/scripts/* + check_all_files_with_shebangs: "false" + + shellcheck-tests: + name: shellcheck test scripts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + path: tests + pattern: | + *.sh + check_all_files_with_shebangs: "false" diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml new file mode 100644 index 000000000..9558c0b9a --- /dev/null +++ b/.github/workflows/test-build.yml @@ -0,0 +1,79 @@ +name: test-build +on: + workflow_dispatch: + pull_request: + push: + schedule: + - cron: "30 3 * * 2" + +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true +jobs: + build-debian: + strategy: + # Keep other matrix jobs running, even if one fails. + fail-fast: false + matrix: + host_release: + - unstable + - trixie + - bookworm + + # We want a working shell, qemu, python and docker. Specific version should not matter (much). + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - run: ./test/gha-build-deb.sh + name: "Build .deb for ${{matrix.host_release}}" + env: + HOST_RELEASE: ${{matrix.host_release}} + + - name: Archive built .deb + uses: actions/upload-artifact@v4 + with: + name: deb-${{matrix.host_release}} + if-no-files-found: error + path: | + *.deb + + build-iso: + strategy: + fail-fast: false + matrix: + host_release: + - bookworm + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: ./test/gha-build-iso.sh initial + name: "Build ISO on ${{matrix.host_release}}" + env: + HOST_RELEASE: ${{matrix.host_release}} + + - name: Archive built ISO + if: always() + uses: actions/upload-artifact@v4 + with: + name: grml-live-build-result-initial-${{matrix.host_release}} + if-no-files-found: error + path: | + results-initial/* + + - run: ./test/gha-build-iso.sh build-only-twice + name: "Repack ISO twice on ${{matrix.host_release}}" + env: + HOST_RELEASE: ${{matrix.host_release}} + + - name: Archive repacked ISO + if: always() + uses: actions/upload-artifact@v4 + with: + name: grml-live-build-result-repack-${{matrix.host_release}} + if-no-files-found: error + path: | + results-build-only-second/* diff --git a/.gitignore b/.gitignore index eb882d124..4dbad4b82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -etc/grml/fai/config/basefiles -etc/grml/fai/make-fai-nfsroot.conf -etc/grml/fai/nfsroot.conf +config/basefiles diff --git a/README.md b/README.md index 218b1bbb1..24e2940e9 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ set `GRML_FAI_CONFIG`, the `SCRIPTS_DIRECTORY`, the `LIVE_CONF` and the templates option so that it does not use the config files of an installed `grml-live` package: - # export GRML_FAI_CONFIG=$(pwd)/etc/grml/fai + # export GRML_FAI_CONFIG=$(pwd)/config # export SCRIPTS_DIRECTORY=$(pwd)/scripts # export LIVE_CONF=$(pwd)/etc/grml/grml-live.conf # export TEMPLATE_DIRECTORY=$(pwd)/templates diff --git a/TODO b/TODO index 549c31a02..d6230eec0 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,7 @@ Patches, ideas and feedback welcome. * if a stage fails inside grml-live the stage is skipped on next execution → try to find a better way how to clean up the stage and re-execute it again -* support something like a directory /etc/grml/fai/chroot_packages to install +* support something like a directory $GRML_FAI_CONFIG/chroot_packages to install additional Debian packages without the need for a Debian repository * support multiple kernel versions installed in one single live-system diff --git a/build-driver/build b/build-driver/build new file mode 100755 index 000000000..c206b9567 --- /dev/null +++ b/build-driver/build @@ -0,0 +1,14 @@ +#!/bin/bash +# +# Entrypoint from CI jobs +# Only valid assumptions: +# - apt sources.list are valid +# - first param is path to grml-live checkout +# - remaining params are job config, so to say +set -x +GRML_LIVE_PATH=$1 +PYTHONPATH="$GRML_LIVE_PATH"/build-driver +echo -e "\e[0Ksection_start:$(date +%s):startupdeps[collapsed=true]\r\e[0KInstall dependencies for build.py" +apt satisfy -q -y --no-install-recommends 'python3-minimal, python3-yaml' +echo -e "\e[0Ksection_end:$(date +%s):startupdeps\r\e[0K" +exec "$PYTHONPATH"/build.py "$@" diff --git a/build-driver/build.py b/build-driver/build.py new file mode 100755 index 000000000..b134065cb --- /dev/null +++ b/build-driver/build.py @@ -0,0 +1,543 @@ +#!/usr/bin/env python3 +# +# Main entry point for CI builds. +# We are started by ./build, which in turn is started by the CI config. +# Dependencies can be available, if ./build installs them first. +# +from pathlib import Path +import datetime +import contextlib +import subprocess +import os +import shutil +import time +import sys +import tempfile +from dataclasses import dataclass + +import yaml + +TOOL_DIR = Path(__file__).parent + + +@dataclass(frozen=True) +class JobProperties: + job_timestamp: datetime.datetime + job_name: str + arch: str + classes: list + debian_suite: str + version: str + release_name: str + grml_name: str + iso_name: str # name of the resulting .ISO files + sources_name: str # name of the resulting sources tarball + logs_name: str # name of the resulting logs directory + + +def usage(program_name): + message = f""" +Usage: {program_name} grml_live_path build_mode config_file flavor arch ... + +Examples: + {program_name} /build/job/grml-live release ./config/release-pre2024.XX-rc0 small amd64 + {program_name} /build/job/grml-live daily ./config/daily small amd64 testing + """ + print(message.strip(), file=sys.stderr) + + +def run_x(args, check: bool = True, **kwargs): + # str-ify Paths, not necessary, but for readability in logs. + args = [arg if isinstance(arg, str) else str(arg) for arg in args] + args_str = '" "'.join(args) + print(f'D: Running "{args_str}"', flush=True) + return subprocess.run(args, check=check, **kwargs) + + +@contextlib.contextmanager +def ci_section(title: str, *, collapsed: bool = True): + section_key = f"sec{time.time()}" + collapsed_str = "[collapsed=true]" if collapsed else "" + print(f"\x1b[0Ksection_start:{int(time.time())}:{section_key}{collapsed_str}\r\x1b[0K{title}", flush=True) + yield + print(f"\x1b[0Ksection_end:{int(time.time())}:{section_key}\r\x1b[0K", flush=True) + + +def is_docker(): + return ( + Path("/.dockerenv").exists() + or Path("/run/.containerenv").exists() + or (Path("/proc/1/cgroup").exists() and b"devices:/docker" in Path("/proc/1/cgroup").read_bytes()) + ) + + +def is_ci(): + return os.getenv("CI", "false") == "true" + + +def apt_satisfy(deps: str): + run_x( + ["apt-get", "satisfy", "-q", "-y", "--no-install-recommends", deps.strip()], + env=dict(os.environ) | {"DEBIAN_FRONTEND": "noninteractive"}, + ) + + +def print_grml_live_version(grml_live_path: Path): + result = run_x(["git", "describe", "--always"], cwd=grml_live_path, capture_output=True) + version = result.stdout.strip().decode() + print(f"I: grml-live version: {version}") + + +def run_grml_live( + grml_live_path: Path, + output_dir: Path, + arch: str, + classes: list, + debian_suite: str, + version: str, + release_name: str, + grml_name: str, + iso_name: str, + old_iso_path: Path | None, +): + env = dict(os.environ) + grml_fai_config = grml_live_path / "config" + env.update( + { + "GRML_FAI_CONFIG": str(grml_fai_config), + "SCRIPTS_DIRECTORY": str(grml_live_path / "scripts"), + "LIVE_CONF": str(grml_live_path / "etc" / "grml" / "grml-live.conf"), + "TEMPLATE_DIRECTORY": str(grml_live_path / "templates"), + } + ) + + if not old_iso_path: + with ci_section("Creating basefile using mmdebstrap"): + basefiles_path = grml_fai_config / "basefiles" + basefiles_path.mkdir(exist_ok=True) + basefile = basefiles_path / f"{arch.upper()}.tar.gz" + args = [ + "mmdebstrap", + "--format=tar", + "--variant=required", + "--verbose", + "--include=netbase", + debian_suite, + basefile, + ] + run_x(args) + + grml_live_cmd = [ + grml_live_path / "grml-live", + "-F", # do not prompt + "-V", # verbose + "-A", # cleanup afterwards + "-a", + arch, + "-c", + ",".join(classes), + "-s", + debian_suite, + "-v", + version, + "-r", + release_name, + "-g", + grml_name, + "-i", + iso_name, + "-o", + output_dir, + ] + if old_iso_path: + grml_live_cmd += ["-b", "-e", old_iso_path] + with ci_section("Building with grml-live", collapsed=False): + fixup_fai() + run_x(grml_live_cmd, env=env) + + +def fixup_fai(): + # Workaround for fai, necessary to build in docker where /dev/pts is unavailable. + # apt prints: E: Can not write log (Is /dev/pts mounted?) - posix_openpt (19: No such device) + fai_subroutines = Path("/usr/lib/fai/subroutines") + old_code = fai_subroutines.read_text().splitlines() + filtered_code = "\n".join([line for line in old_code if "task_error 472" not in line]) + fai_subroutines.write_text(filtered_code) + + +def upload_daily(job_name: str, build_dir: Path, job_timestamp: datetime.datetime): + ssh_key = os.getenv("DAILY_UPLOAD_SSH_KEY") + remote = os.getenv("DAILY_UPLOAD_REMOTE") + stamped_dirname = job_timestamp.strftime("%Y-%m-%d_%H_%M_%S") + with ci_section("Uploading to daily.grml.org"): + run_x( + [ + TOOL_DIR / "upload-daily.py", + ssh_key, + f"{remote}{job_name}", + build_dir, + job_name, + stamped_dirname, + ] + ) + + +def get_dpkg_list_path_for_build(build_dir: Path) -> Path: + return build_dir / "grml_logs" / "fai" / "dpkg.list" + + +def generate_changes_list( + build_dir: Path, + output_filename: str, + old_dpkg_list: Path, + build_job_name: str, + build_version: str, +): + package_prefix = "grml" + git_url_base = "https://github.com/grml" + git_workspace = Path("/tmp") / "changes-git-workspace" + output_file = build_dir / "grml_logs" / output_filename + new_dpkg_list = get_dpkg_list_path_for_build(build_dir) + + with ci_section(f"Generating changes list {output_file!s}"): + run_x( + [ + TOOL_DIR / "generate-changes-list.py", + output_file, + new_dpkg_list, + old_dpkg_list, + package_prefix, + git_url_base, + git_workspace, + build_job_name, + build_version, + ] + ) + + +@contextlib.contextmanager +def results_mover(build_dir: Path, output_dir: Path): + try: + yield + except Exception: + print("E: Caught fatal exception") + raise + finally: + print(f"I: moving build results from {build_dir} to {output_dir}") + if output_dir.exists(): + raise RuntimeError(f"output_dir {output_dir} exists, but shutil.move requires it not to") + shutil.move(build_dir, output_dir) + + +def download_file(url: str, local_path: Path): + """Download URL url into local_path, using curl. Raises on failure.""" + run_x(["curl", "-#fSL", "--output", local_path, url]) + + +def skip_sources_requested(build_config: dict, env: dict) -> bool: + if env.get("SKIP_SOURCES", "") == "1": + return True + if build_config.get("skip_sources", False) is True: + return True + return False + + +def get_grml_live_classes(arch: str, flavor: str, classes_for_mode: list[str], skip_sources: bool) -> list[str]: + base_classes = [ + "DEBORPHAN", + "GRMLBASE", + f"GRML_{flavor.upper()}", + "RELEASE", + arch.upper(), + "IGNORE", + ] + if skip_sources: + print("I: SKIP_SOURCES=1, skipping source download (either from config or ENV)") + else: + base_classes += ["SOURCES"] + return base_classes + classes_for_mode + + +def build( + build_dir: Path, + old_dpkg_list_daily: Path | None, + old_dpkg_list_last_release: Path | None, + job_properties: JobProperties, + grml_live_path: Path, + old_iso_path: Path | None, +): + run_grml_live( + grml_live_path, + build_dir, + job_properties.arch, + job_properties.classes, + job_properties.debian_suite, + job_properties.version, + job_properties.release_name, + job_properties.grml_name, + job_properties.iso_name, + old_iso_path, + ) + + if old_dpkg_list_daily: + generate_changes_list( + build_dir, + "changes-last-daily.txt", + old_dpkg_list_daily, + job_properties.job_name, + job_properties.version, + ) + + if old_dpkg_list_last_release: + generate_changes_list( + build_dir, + "changes-last-release.txt", + old_dpkg_list_last_release, + job_properties.job_name, + job_properties.version, + ) + + +def load_config(build_config_file: str) -> dict: + with Path(build_config_file).open() as stream: + return yaml.safe_load(stream) + + +def bail(message: str) -> int: + print(f"E: {message}", file=sys.stderr) + return 2 + + +def install_debian_dependencies(): + # TODO: read (some!) deps from grml-live/debian/control + with ci_section("Installing dependencies from Debian"): + apt_satisfy( + """ + ca-certificates , + git , + bc , + bzip2 , + curl , + dosfstools , + fai-client (>= 3.4.0) , + jo , + mmdebstrap , + moreutils , + mtools , + python3-paramiko , + rsync , + squashfs-tools (>= 1:4.2-0~bpo60) , + xorriso , + imagemagick , + """ + ) + + +def download_old_dpkg_list_last_release(tmp_dir: Path, last_release_version: str | None, flavor: str, arch: str) -> Path | None: + if last_release_version is None: + return None + + path = tmp_dir / "dpkg.list.previous_release" + url = f"https://ftp-master.grml.org/grml-{last_release_version}-metadata/grml-{flavor}-{last_release_version}-{arch}/dpkg.list" + with ci_section(f"Downloading old dpkg.list {url} to {path!s}"): + try: + download_file(url, path) + return path + except Exception as except_inst: + print(f"E: ignoring error while downloading {url}: {except_inst}") + return None + + +def download_old_iso(tmp_dir: Path, old_iso_url: str) -> Path | None: + path = tmp_dir / "old.iso" + + with ci_section(f"Downloading old ISO {old_iso_url} to {path!s}"): + download_file(old_iso_url, path) + + return path + + +def download_old_sources(tmp_dir: Path, old_iso_url: str) -> Path | None: + path = tmp_dir / "old-sources.tar" + + # https://.../2024-12-18_10_03_44/grml_isos/grml...iso + # => https://.../2024-12-18_10_03_44/ , _, grml...iso + old_base_url, _, old_iso_name = old_iso_url.rsplit("/", 2) + # grml-something.iso => grml-something-sources.tar + old_sources_name = old_iso_name.rsplit(".", 1)[0] + "-sources.tar" + old_sources_url = f"{old_base_url}/{old_sources_name}" + + with ci_section(f"Downloading old Sources {old_sources_url} to {path!s}"): + download_file(old_sources_url, path) + + return path + + +def main(program_name: str, argv: list[str]) -> int: + print(f"I: {program_name} started with {argv=}") + try: + grml_live_path = Path(argv.pop(0)) + build_mode = argv.pop(0) + build_config_file = argv.pop(0) + if build_mode == "release": + flavor = argv.pop(0) + arch = argv.pop(0) + debian_suite = "" # filled from config + classes_for_mode = ["SNAPSHOT", "NO_ONLINE"] + upload_to_daily = False + + elif build_mode == "daily": + flavor = argv.pop(0) + arch = argv.pop(0) + debian_suite = argv.pop(0) + classes_for_mode = [] + upload_to_daily = os.getenv("DO_DAILY_UPLOAD", "") == "1" + + else: + return bail(f"build_mode {build_mode} not understood, valid options are: release, daily") + + except IndexError: + usage(program_name) + return 2 + + if arch not in ("amd64", "i386", "arm64"): + return bail(f"unknown build_arch: {arch}") + + if not is_ci(): + print("I: No CI variable found, assuming local test build") + if not is_docker(): + return bail("E: Not running inside docker, exiting to avoid data damage") + + build_config = load_config(build_config_file) + + skip_sources = skip_sources_requested(build_config, dict(os.environ)) + # skip SOURCES in release mode as grml-live would re-download all sources, + # possibly mismatching the versions. Also we do not prepare a working DNS, + # so it would just fail. In the future, grml-live should support reusing + # the sources tarball and fetching just the necessary differences. + classes = get_grml_live_classes(arch, flavor, classes_for_mode, skip_sources or build_mode == "release") + + build_grml_name = f"grml-{flavor}-{arch}" + last_release_version = build_config["last_release"] + + # build_grml_live_branch = os.getenv("USE_GRML_LIVE_BRANCH", "master") + + # We try to construct an ISO name like this: + # daily: grml-full-daily20230201build20unstable-amd64.iso + # release: grml-full-2024.12-arm64.iso + # Note that release builds do not carry the debian suite in their name. + + if build_mode == "release": + old_iso_url = build_config["base_iso"][flavor][arch] + build_version = build_config["release_version"] + artifact_basename = f"grml-{flavor}-{build_version}-{arch}" + + job_properties = JobProperties( + job_timestamp=datetime.datetime.now(), + job_name=f"{build_grml_name}-release", + arch=arch, + classes=classes, + # XXX: should load this from ISO or metadata file + debian_suite=build_config["debian_suite"], + # f.e. "pre2024.11-rc0" + version=build_version, + # f.e. "Glumpad Grumbirn" + release_name=build_config["release_name"], + grml_name=build_grml_name, + iso_name=f"{artifact_basename}.iso", + sources_name=f"{artifact_basename}-sources.tar", + logs_name=f"{artifact_basename}-logs", + ) + + elif build_mode == "daily": + old_iso_url = None + date_stamp = datetime.datetime.now().strftime("%Y%m%d") + CI_PIPELINE_IID = os.getenv("CI_PIPELINE_IID", "0") + build_version = f"d{date_stamp}b{CI_PIPELINE_IID}" + build_release_name = f"daily{date_stamp}build{CI_PIPELINE_IID}{debian_suite}" + artifact_basename = f"grml-{flavor}-{build_release_name}-{arch}" + + job_properties = JobProperties( + job_timestamp=datetime.datetime.now(), + job_name=f"{build_grml_name}-{debian_suite}", + arch=arch, + classes=classes, + debian_suite=debian_suite, + version=build_version, + release_name=build_release_name, + grml_name=build_grml_name, + iso_name=f"{artifact_basename}.iso", + sources_name=f"{artifact_basename}-sources.tar", + logs_name=f"{artifact_basename}-logs", + ) + + else: + raise ValueError(f"unexpected {build_mode=}") + + print(f"I: {job_properties=}") + print(f"I: {last_release_version=}") + + print_grml_live_version(grml_live_path) + + source_dir = Path(os.getcwd()) + cache_dir = source_dir / "cached" + output_dir = source_dir / "results" + print(f"I: {source_dir=}") + print(f"I: {cache_dir=}") + print(f"I: {output_dir=}") + + # avoid building on mounted volume + tmp_root = Path(tempfile.gettempdir()) + tmp_dir = Path(tempfile.mkdtemp(dir=tmp_root)) + build_dir = Path(tempfile.mkdtemp(dir=tmp_root)) + + # Do it now, as the next block needs curl installed. + install_debian_dependencies() + + old_dpkg_list_previous_build = cache_dir / "dpkg.list" + old_dpkg_list_last_release = download_old_dpkg_list_last_release(tmp_dir, last_release_version, flavor, arch) + if old_iso_url is None: + old_iso_path = None + else: + old_iso_path = download_old_iso(tmp_dir, old_iso_url) + if skip_sources or old_iso_url is None: + old_sources_path = None + else: + old_sources_path = download_old_sources(tmp_dir, old_iso_url) + + with results_mover(build_dir, output_dir): + build( + build_dir, + old_dpkg_list_previous_build, + old_dpkg_list_last_release, + job_properties, + grml_live_path, + old_iso_path, + ) + + # Remove the sources *directory*, to not have the sources twice in the CI artifacts. + grml_sources_directory = build_dir / "grml_sources" + if grml_sources_directory.exists(): + print(f"I: Removing {grml_sources_directory}") + shutil.rmtree(grml_sources_directory, ignore_errors=True) + + if old_sources_path: + old_sources_path.rename(build_dir / job_properties.sources_name) + + # Copy dpkg.list from grml_logs into cache for next iteration. + new_dpkg_list = get_dpkg_list_path_for_build(build_dir) + old_dpkg_list_previous_build.parent.mkdir(exist_ok=True) + shutil.copyfile(new_dpkg_list, old_dpkg_list_previous_build) + + (build_dir / "grml_logs").rename(build_dir / job_properties.logs_name) + + if upload_to_daily: + upload_daily(job_properties.job_name, build_dir, job_properties.job_timestamp) + + print("I: Success.") + + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv.pop(0), sys.argv)) diff --git a/build-driver/generate-changes-list.py b/build-driver/generate-changes-list.py new file mode 100755 index 000000000..f4b002ce1 --- /dev/null +++ b/build-driver/generate-changes-list.py @@ -0,0 +1,252 @@ +#!/usr/bin/env python3 +import os +import subprocess +import sys +import re +from pathlib import Path + +IGNORED_PEOPLE = set( + "GitHub", +) + + +class Listener: + def __init__(self): + self.failed = False + + def error(self, message: str): + raise NotImplementedError + + def info(self, message: str): + raise NotImplementedError + + def warn(self, message: str): + raise NotImplementedError + + +class CliListener(Listener): + def error(self, message: str): + self.failed = True + sys.stderr.write(f"E: {message}\n") + + def info(self, message: str): + sys.stdout.write(f"I: {message}\n") + + def warn(self, message: str): + sys.stdout.write(f"W: {message}\n") + + +def run_x(args, check: bool = True, **kwargs): + # str-ify Paths, not necessary, but for readability in logs. + args = [arg if isinstance(arg, str) else str(arg) for arg in args] + args_str = '" "'.join(args) + print(f'D: Running "{args_str}"', flush=True) + return subprocess.run(args, check=check, **kwargs) + + +def parse_package_list(s: str) -> dict: + package_dict = {} + for line in s.split("\n"): + match = re.match(r"^ii\s+(\S+)\s+(\S+)\s", line) + if match: + package_dict[match[1]] = match[2] + return package_dict + + +def sort_people(people: list[str]) -> list[str]: + """Sort list of names, ignoring case""" + return sorted(people, key=lambda v: v.upper()) + + +def unique_case_insensitive(strings: list[str]): + seen = set() + unique_strings = [] + for string in strings: + upper = string.upper() + if upper in seen: + continue + seen.add(upper) + unique_strings.append(string) + return unique_strings + + +def build_changes( + output_filename: Path, + dpkg_list_new: Path, + dpkg_list_old: Path, + package_prefix: str, + git_url_base: str, + git_repo_workspace: Path, + job_name: str, + build_id: str, + listener: Listener, +): + git_repo_workspace.mkdir(parents=True, exist_ok=True) + all_people = [] + + changelog = f"""------------------------------------------------------------------------ +Generated by CI for job {job_name} {build_id} +------------------------------------------------------------------------ +""" + + if not dpkg_list_new.exists(): + listener.error(f"Could not read package list {dpkg_list_new}") + return + + packages = parse_package_list(dpkg_list_new.read_text()) + packages_old = {} + try: + packages_old = parse_package_list(dpkg_list_old.read_text()) + except Exception as e: + listener.info(f"While parsing old package list: {e}") + + debian_changes = {"removed": [], "added": [], "changed": []} + + for package in set(packages_old) - set(packages): + if re.match(f"^{package_prefix}", package): + changelog += f"""Package {package}: Removed. +------------------------------------------------------------------------ +""" + else: + debian_changes["removed"].append(package) + + for package, version in packages.items(): + old_version = packages_old.get(package) + if re.match(f"^{package_prefix}", package): + try: + listener.info(f"Generating changes list for package {package}...") + if old_version: + listener.info(f"Version {old_version} -> {version}") + if old_version == version: + continue + + git_url = f"{git_url_base}/{package}" + gitpath = fetch_grml_package_repo(git_repo_workspace, package, git_url) + + if old_version: + range = f"v{old_version}..v{version}" + else: + range = f"v{version}" + + commits, people = get_grml_package_changes(gitpath, range) + people = [person for person in people if person not in IGNORED_PEOPLE] + all_people.extend(people) + commit_list = "\n ".join(commits) + people_list = "\n ".join(sort_people(people)) + changelog += f"""Package {package}: {range} {'(new)' if not old_version else ''} + {commit_list} +People: + {people_list} +------------------------------------------------------------------------ +""" + except Exception as e: + listener.warn(f"Generating change report for package {package} failed: {e}") + changelog += f"""Package {package}: [failed] +------------------------------------------------------------------------ +""" + + else: + if old_version: + if old_version == version: + continue + debian_changes["changed"].append(f"{package} {old_version} -> {version}") + else: + debian_changes["added"].append(package) + + all_people = unique_case_insensitive(all_people) + all_people_list = "\n ".join(sort_people(all_people)) + changelog += f"""All involved people: + {all_people_list} +------------------------------------------------------------------------ +""" + + changelog += """Changes to Debian package list: + Added: + {} + Changed: + {} + Removed: + {} +------------------------------------------------------------------------ +""".format( + "\n ".join(sorted(debian_changes["added"])).strip(), + "\n ".join(sorted(debian_changes["changed"])).strip(), + "\n ".join(sorted(debian_changes["removed"])).strip(), + ) + + output_filename.write_text(changelog) + + +def main() -> int: + if len(sys.argv) != 9: + print( + f"Usage: {sys.argv[0]} output_filename dpkg_list_new dpkg_list_old package_prefix git_url_base git_repo_workspace job_name build_id" + ) + return 2 + + listener = CliListener() + try: + build_changes( + Path(sys.argv[1]), + Path(sys.argv[2]), + Path(sys.argv[3]), + sys.argv[4], + sys.argv[5], + Path(sys.argv[6]), + sys.argv[7], + sys.argv[8], + listener, + ) + except Exception as except_inst: + listener.error(f"Uncaught exception: {except_inst}") + + if listener.failed: + return 1 + return 0 + + +def fetch_grml_package_repo(git_repo_workspace: Path, package: str, git_url: str) -> Path: + """Clone and update git repository.""" + gitpath = git_repo_workspace / f"{package}.git" + if not gitpath.exists(): + env = dict(os.environ) | {"GIT_TERMINAL_PROMPT": "0"} + run_x( + ["git", "clone", "--bare", "--single-branch", git_url, gitpath], + cwd=git_repo_workspace, + env=env, + ) + if not gitpath.exists(): + raise Exception("Repository not found") + + # update repo + run_x(["git", "remote", "set-url", "origin", git_url], cwd=gitpath) + run_x(["git", "remote", "update", "--prune"], cwd=gitpath).check_returncode() + return gitpath + + +def get_grml_package_changes(gitpath: Path, range: str) -> tuple[list[str], list[str]]: + trailers = ["Thanks", "Reported-By"] + + git_format = "--format=tformat:Commit: %H %s%nAuthor: %aN%nCommitter: %cN%n" + for trailer in trailers: + git_format += f"%(trailers:key={trailer})%n" + + git_log = run_x(["git", "log", git_format, range], cwd=gitpath, capture_output=True) + + changes = [] + people = [] + for line in git_log.stdout.decode().splitlines(): + line = line.strip() + if not line: + continue + key, value = line.split(": ", 1) + if key == "Commit": + changes.append(value) + else: + people.append(value) + + return changes, unique_case_insensitive(people) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/build-driver/pyproject.toml b/build-driver/pyproject.toml new file mode 100644 index 000000000..ff80772fc --- /dev/null +++ b/build-driver/pyproject.toml @@ -0,0 +1,9 @@ +[tool.pycodestyle] +max-line-length = 120 + +[tool.black] +line-length = 120 +target-version = ['py311'] + +[tool.pyupgrade] +version-option = '--py311-plus' diff --git a/build-driver/upload-daily.py b/build-driver/upload-daily.py new file mode 100755 index 000000000..7bbfdbc6d --- /dev/null +++ b/build-driver/upload-daily.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python3 +import paramiko +import pathlib +import sys +from stat import S_ISDIR + + +def sftp_isdir(sftp, path: str): + try: + return S_ISDIR(sftp.stat(path).st_mode) + except IOError: + return False + + +def sftp_rm_r(sftp, remote_dir: str): + files = sftp.listdir(remote_dir) + remote_path = pathlib.Path(remote_dir) + + for f in files: + filepath = (remote_path / f).as_posix() + if sftp_isdir(sftp, filepath): + sftp_rm_r(sftp, filepath) + else: + sftp.remove(filepath) + + sftp.rmdir(remote_dir) + + +def upload_dir(sftp, local_dir: pathlib.Path, remote_dir: str): + remote_root = pathlib.Path(remote_dir) + seen = set() + for local_path in local_dir.rglob("*"): + if not local_path.is_file(): + continue + + relative_path = local_path.relative_to(local_dir) + remote_path = remote_root / relative_path + + for parent in reversed(remote_path.parents): + parent = parent.as_posix() + if parent in seen: + continue + try: + sftp.stat(parent) + except FileNotFoundError: + sftp.mkdir(parent) + seen.add(parent) + + print("Uploading", local_path, "to", remote_path) + sftp.put(local_path.as_posix(), remote_path.as_posix()) + + +def main(): + keyfile = sys.argv[1] + # user@remote.host:/grml64-small_sid + remote_site_and_path = sys.argv[2] + # /tmp/builddir + local_dir = pathlib.Path(sys.argv[3]) + # grml64-small_sid + job_name = sys.argv[4] + # 2024-11-09_01_31_01 + stamped_dirname = sys.argv[5] + + remote_site = remote_site_and_path.split(":")[0] + remote_path = remote_site_and_path.split(":")[1] + remote_host = remote_site.split("@")[1] + remote_user = remote_site.split("@")[0] + + pkey = paramiko.Ed25519Key.from_private_key_file(keyfile) + + transport = paramiko.Transport((remote_host, 22)) + transport.connect(username=remote_user, pkey=pkey) + + sftp = paramiko.SFTPClient.from_transport(transport) + assert sftp is not None + + versions = [path for path in sorted(sftp.listdir(remote_path)) if not path.endswith("/latest")] + for version in versions[:-14]: + print("Removing old version", version) + sftp_rm_r(sftp, f"{remote_path}/{version}") + + remote_stamped = f"{remote_path}/{stamped_dirname}" + upload_dir(sftp, local_dir, remote_stamped) + + remote_latest = f"{remote_path}/latest" + try: + sftp.mkdir(remote_latest) + except IOError: + pass + try: + sftp.mkdir(remote_latest + "/grml_isos") + except IOError: + pass + + real_iso_name = next(local_dir.glob("grml_isos/*iso")).name + real_checksum_name = next(local_dir.glob("grml_isos/*iso.sha256")).name + old_latest_iso_name = f"{job_name}_latest.iso" + old_latest_checksum_name = f"{job_name}_latest.iso.sha256" + latest_iso_name = f"{job_name}-latest.iso" + latest_checksum_name = f"{job_name}-latest.iso.sha256" + + real_sources_name = next(local_dir.glob("grml*-sources.tar")).name + latest_sources_name = f"{job_name}-latest-sources.tar" + + for symlink, real in [ + (latest_iso_name, real_iso_name), + (latest_checksum_name, real_checksum_name), + (old_latest_iso_name, real_iso_name), + (old_latest_checksum_name, real_checksum_name), + ]: + remote_symlink = f"{remote_latest}/{symlink}" + remote_real = f"../{stamped_dirname}/grml_isos/{real}" + print("Updating symlink", remote_symlink, "to", remote_real) + try: + sftp.unlink(remote_symlink) + except FileNotFoundError: + pass + sftp.symlink(remote_real, remote_symlink) + + + for symlink, real in [ + (latest_iso_name, real_iso_name), + (latest_checksum_name, real_checksum_name), + ]: + remote_symlink = f"{remote_latest}/grml_isos/{symlink}" + remote_real = f"../../{stamped_dirname}/grml_isos/{real}" + print("Updating symlink", remote_symlink, "to", remote_real) + try: + sftp.unlink(remote_symlink) + except FileNotFoundError: + pass + sftp.symlink(remote_real, remote_symlink) + + + for symlink, real in [ + (latest_sources_name, real_sources_name), + ]: + remote_symlink = f"{remote_latest}/{symlink}" + remote_real = f"../{stamped_dirname}/{real}" + print("Updating symlink", remote_symlink, "to", remote_real) + try: + sftp.unlink(remote_symlink) + except FileNotFoundError: + pass + sftp.symlink(remote_real, remote_symlink) + + sftp.close() + transport.close() + + +if __name__ == "__main__": + main() diff --git a/etc/grml/fai/config/class/GRMLBASE.var b/config/class/GRMLBASE.var similarity index 74% rename from etc/grml/fai/config/class/GRMLBASE.var rename to config/class/GRMLBASE.var index caf5098bc..dd2a6b9b8 100644 --- a/etc/grml/fai/config/class/GRMLBASE.var +++ b/config/class/GRMLBASE.var @@ -13,13 +13,7 @@ TIMEZONE=UTC # root password for the new installed linux system; md5 and crypt are possible ROOTPW='x' -# Retrieve sources and store theme -# FAI_DEBSOURCESDIR=/grml/sources/ - # Maximum number of packages installed at a time, # needs to be quite high so we can override installation # of specific packages through the IGNORE class. MAXPACKAGES=3000 - -# Do not check package names whether they are valid, but report failure instead. -# FAI_DISABLE_PACKAGE_NAME_CHECK=1 diff --git a/etc/grml/fai/config/debconf/GRMLBASE b/config/debconf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/debconf/GRMLBASE rename to config/debconf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE b/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE similarity index 54% rename from etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE rename to config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE index a3a0b0737..393b7df72 100644 --- a/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE +++ b/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE @@ -1,7 +1,4 @@ -// Installed via ${GRML_FAI_CONFIG}/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE - -// work around http://trac.lighttpd.net/trac/ticket/657 -Acquire::http::Pipeline-Depth 0; // added by grml-live +// Installed via ${GRML_FAI_CONFIG}/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE // Recommends just pull in way tooooo much packages, so disable it: APT::Install-Recommends false; // added by grml-live diff --git a/etc/grml/fai/config/files/etc/apt/apt.conf.d/20pdiffs/GRMLBASE b/config/files/etc/apt/apt.conf.d/20pdiffs/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/apt/apt.conf.d/20pdiffs/GRMLBASE rename to config/files/etc/apt/apt.conf.d/20pdiffs/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/apt/preferences/GRMLBASE b/config/files/etc/apt/preferences.d/15grml.pref/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/apt/preferences/GRMLBASE rename to config/files/etc/apt/preferences.d/15grml.pref/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM similarity index 71% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM rename to config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM index 6d48e201f..26657edb3 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM +++ b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM @@ -1,6 +1,6 @@ # official debian repository: - deb http://ftp.debian.org/debian/ bookworm main contrib non-free-firmware non-free - deb-src http://ftp.debian.org/debian/ bookworm main contrib non-free-firmware non-free + deb http://deb.debian.org/debian/ bookworm main contrib non-free-firmware non-free + deb-src http://deb.debian.org/debian/ bookworm main contrib non-free-firmware non-free # security updates: deb http://security.debian.org/debian-security bookworm-security main contrib non-free-firmware non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE similarity index 66% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE rename to config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE index 54eb57f98..b0471a431 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE +++ b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE @@ -1,6 +1,6 @@ # official debian repository: - deb http://ftp.debian.org/debian/ bullseye main contrib non-free - deb-src http://ftp.debian.org/debian/ bullseye main contrib non-free + deb http://deb.debian.org/debian/ bullseye main contrib non-free + deb-src http://deb.debian.org/debian/ bullseye main contrib non-free # security updates: deb http://security.debian.org/debian-security bullseye-security main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE similarity index 60% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE rename to config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE index 3585bfba5..0aef8048f 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE +++ b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE @@ -1,11 +1,11 @@ # official debian repository: - deb http://ftp.debian.org/debian/ stable main contrib non-free-firmware non-free - deb-src http://ftp.debian.org/debian/ stable main contrib non-free-firmware non-free + deb http://deb.debian.org/debian/ stable main contrib non-free-firmware non-free + deb-src http://deb.debian.org/debian/ stable main contrib non-free-firmware non-free # security updates: deb http://security.debian.org/debian-security stable-security main contrib non-free-firmware non-free deb-src http://security.debian.org/debian-security stable-security main contrib non-free-firmware non-free # backports: - deb http://ftp.debian.org/debian/ stable-backports main contrib non-free-firmware non-free - deb-src http://ftp.debian.org/debian/ stable-backports main contrib non-free-firmware non-free + deb http://deb.debian.org/debian/ stable-backports main contrib non-free-firmware non-free + deb-src http://deb.debian.org/debian/ stable-backports main contrib non-free-firmware non-free diff --git a/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING new file mode 100644 index 000000000..319cc8de7 --- /dev/null +++ b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING @@ -0,0 +1,7 @@ +# official debian repository: + deb http://deb.debian.org/debian/ testing main contrib non-free-firmware non-free + deb-src http://deb.debian.org/debian/ testing main contrib non-free-firmware non-free + +# security updates: + deb http://security.debian.org/debian-security/ testing-security main contrib non-free-firmware non-free + deb-src http://security.debian.org/debian-security/ testing-security main contrib non-free-firmware non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE similarity index 71% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE rename to config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE index 7403459fd..dc3b6c1a4 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE +++ b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE @@ -1,6 +1,6 @@ # official debian repository: - deb http://ftp.debian.org/debian/ trixie main contrib non-free-firmware non-free - deb-src http://ftp.debian.org/debian/ trixie main contrib non-free-firmware non-free + deb http://deb.debian.org/debian/ trixie main contrib non-free-firmware non-free + deb-src http://deb.debian.org/debian/ trixie main contrib non-free-firmware non-free # security updates: deb http://security.debian.org/debian-security trixie-security main contrib non-free-firmware non-free diff --git a/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE new file mode 100644 index 000000000..784e7387e --- /dev/null +++ b/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE @@ -0,0 +1,3 @@ +# official debian repository: + deb http://deb.debian.org/debian/ unstable main contrib non-free-firmware non-free + deb-src http://deb.debian.org/debian/ unstable main contrib non-free-firmware non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-live.list/GRMLBASE b/config/files/etc/apt/sources.list.d/grml-live.list/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/grml-live.list/GRMLBASE rename to config/files/etc/apt/sources.list.d/grml-live.list/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE b/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE rename to config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE b/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE rename to config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE b/config/files/etc/apt/sources.list/GRMLBASE similarity index 86% rename from etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE rename to config/files/etc/apt/sources.list/GRMLBASE index 84a9c7619..ec65bc2c0 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE +++ b/config/files/etc/apt/sources.list/GRMLBASE @@ -1,6 +1,6 @@ ################################################################### # Installed via grml-live's -# ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRMLBASE +# ${GRML_FAI_CONFIG}/files/etc/apt/sources.list/GRMLBASE ################################################################### ##### IMPORTANT NOTE ############################################## diff --git a/etc/grml/fai/config/files/etc/apt/trusted.gpg.d/grml-archive-keyring.gpg/GRMLBASE b/config/files/etc/apt/trusted.gpg.d/grml-archive-keyring.gpg/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/apt/trusted.gpg.d/grml-archive-keyring.gpg/GRMLBASE rename to config/files/etc/apt/trusted.gpg.d/grml-archive-keyring.gpg/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE b/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE similarity index 84% rename from etc/grml/fai/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE rename to config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE index 646e4e256..5e014f4b3 100644 --- a/etc/grml/fai/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE +++ b/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE @@ -1,8 +1,8 @@ # cloud-init configuration for Grml live system. # # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/51-cloud-init script, using -# ${GRML_FAI_CONFIG}/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/51-cloud-init script, using +# ${GRML_FAI_CONFIG}/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE system_info: # This will affect which distro class gets used diff --git a/etc/grml/fai/config/files/etc/default/console-setup/GRMLBASE b/config/files/etc/default/console-setup/GRMLBASE similarity index 69% rename from etc/grml/fai/config/files/etc/default/console-setup/GRMLBASE rename to config/files/etc/default/console-setup/GRMLBASE index de998f3ee..4ee35227b 100644 --- a/etc/grml/fai/config/files/etc/default/console-setup/GRMLBASE +++ b/config/files/etc/default/console-setup/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/26-console-setup script, using -# ${GRML_FAI_CONFIG}/config/files/etc/default/console-setup/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/26-console-setup script, using +# ${GRML_FAI_CONFIG}/files/etc/default/console-setup/GRMLBASE # CONFIGURATION FILE FOR SETUPCON # Consult the console-setup(5) manual page. diff --git a/etc/grml/fai/config/files/etc/firefox-esr/firefox-esr.js/GRML_FULL b/config/files/etc/firefox-esr/firefox-esr.js/GRML_FULL similarity index 100% rename from etc/grml/fai/config/files/etc/firefox-esr/firefox-esr.js/GRML_FULL rename to config/files/etc/firefox-esr/firefox-esr.js/GRML_FULL diff --git a/etc/grml/fai/config/files/etc/fstab/GRMLBASE b/config/files/etc/fstab/GRMLBASE similarity index 74% rename from etc/grml/fai/config/files/etc/fstab/GRMLBASE rename to config/files/etc/fstab/GRMLBASE index ffd52b7e3..90d253604 100644 --- a/etc/grml/fai/config/files/etc/fstab/GRMLBASE +++ b/config/files/etc/fstab/GRMLBASE @@ -1,14 +1,10 @@ # /etc/fstab - static file system information # # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/30-fstab script, using -# ${GRML_FAI_CONFIG}/config/files/etc/fstab/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/30-fstab script, using +# ${GRML_FAI_CONFIG}/files/etc/fstab/GRMLBASE # # -proc /proc proc rw,nosuid,nodev,noexec 0 0 -none /proc/bus/usb usbfs defaults,noauto 0 0 -sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0 -devpts /dev/pts devpts noauto,mode=0622 0 0 /dev/fd0 /media/floppy auto user,noauto,exec 0 0 /dev/external /media/external auto user,noauto,exec,rw,uid=USERNAME,gid=USERNAME 0 0 /dev/external1 /media/external1 auto user,noauto,exec,rw,uid=USERNAME,gid=USERNAME 0 0 diff --git a/etc/grml/fai/config/files/etc/hosts/GRMLBASE b/config/files/etc/hosts/GRMLBASE similarity index 66% rename from etc/grml/fai/config/files/etc/hosts/GRMLBASE rename to config/files/etc/hosts/GRMLBASE index 678c9e489..4d7d1c8cf 100644 --- a/etc/grml/fai/config/files/etc/hosts/GRMLBASE +++ b/config/files/etc/hosts/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/34-hosts script, using -# ${GRML_FAI_CONFIG}/config/files/etc/hosts/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/34-hosts script, using +# ${GRML_FAI_CONFIG}/files/etc/hosts/GRMLBASE 127.0.0.1 $HOSTNAME localhost diff --git a/etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE b/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE rename to config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/locale.conf/GRMLBASE b/config/files/etc/locale.conf/GRMLBASE similarity index 62% rename from etc/grml/fai/config/files/etc/locale.conf/GRMLBASE rename to config/files/etc/locale.conf/GRMLBASE index 37206c411..5fc3be75b 100644 --- a/etc/grml/fai/config/files/etc/locale.conf/GRMLBASE +++ b/config/files/etc/locale.conf/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/25-locales script, using -# ${GRML_FAI_CONFIG}/config/files/etc/locale.conf/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/25-locales script, using +# ${GRML_FAI_CONFIG}/files/etc/locale.conf/GRMLBASE ################################################################################ # This file lists the locales configuration as used by e.g. systemd-firstboot LANG=C.UTF-8 diff --git a/config/files/etc/locale.gen/GRMLBASE b/config/files/etc/locale.gen/GRMLBASE new file mode 100644 index 000000000..e0ca7bb2c --- /dev/null +++ b/config/files/etc/locale.gen/GRMLBASE @@ -0,0 +1,18 @@ +# This file was deployed via grml-live's +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/25-locales script, using +# ${GRML_FAI_CONFIG}/files/etc/locale.gen/GRMLBASE +################################################################################ +# This file lists locales that you wish to have built. You can find a list +# of valid supported locales at /usr/share/i18n/SUPPORTED. Other +# combinations are possible, but may not be well tested. If you change +# this file, you need to rerun locale-gen. + +# XXX GENERATED XXX +# +# NOTE!!! If you change this file by hand, and want to continue +# maintaining manually, remove the above line. Otherwise, use the command +# "dpkg-reconfigure locales" to manipulate this file. You can manually +# change this file without affecting the use of debconf, however, since it +# does read in your changes. + +en_US.UTF-8 UTF-8 diff --git a/etc/grml/fai/config/files/etc/locale.gen/LOCALES b/config/files/etc/locale.gen/LOCALES similarity index 94% rename from etc/grml/fai/config/files/etc/locale.gen/LOCALES rename to config/files/etc/locale.gen/LOCALES index bd90f599e..5e88a050f 100644 --- a/etc/grml/fai/config/files/etc/locale.gen/LOCALES +++ b/config/files/etc/locale.gen/LOCALES @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/25-locales script, using -# ${GRML_FAI_CONFIG}/config/files/etc/locale.gen/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/25-locales script, using +# ${GRML_FAI_CONFIG}/files/etc/locale.gen/GRMLBASE ################################################################################ # This file lists locales that you wish to have built. You can find a list # of valid supported locales at /usr/share/i18n/SUPPORTED. Other diff --git a/etc/grml/fai/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE b/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE similarity index 77% rename from etc/grml/fai/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE rename to config/files/etc/modprobe.d/loop-part.conf/GRMLBASE index 1c34127be..bb39ab551 100644 --- a/etc/grml/fai/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE +++ b/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/39-modprobe script, using -# ${GRML_FAI_CONFIG}/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/39-modprobe script, using +# ${GRML_FAI_CONFIG}/files/etc/modprobe.d/loop-part.conf/GRMLBASE # # Filename: /etc/modprobe.d/loop-part.conf # Purpose: Enable partitions for loop devices per default in Grml diff --git a/etc/grml/fai/config/files/etc/modules/GRMLBASE b/config/files/etc/modules-load.d/grml.conf/GRMLBASE similarity index 71% rename from etc/grml/fai/config/files/etc/modules/GRMLBASE rename to config/files/etc/modules-load.d/grml.conf/GRMLBASE index df9caa591..ef9ee41e9 100644 --- a/etc/grml/fai/config/files/etc/modules/GRMLBASE +++ b/config/files/etc/modules-load.d/grml.conf/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/41-modules script, using -# ${GRML_FAI_CONFIG}/config/files/etc/modules/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/41-modules script, using +# ${GRML_FAI_CONFIG}/files/etc/modules-load.d/grml.conf/GRMLBASE ################################################################################ # This file should contain the names of kernel modules that are # to be loaded at boot time, one per line. Comments begin with diff --git a/etc/grml/fai/config/files/etc/motd/GRMLBASE b/config/files/etc/motd/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/motd/GRMLBASE rename to config/files/etc/motd/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/network/interfaces/GRMLBASE b/config/files/etc/network/interfaces/GRMLBASE similarity index 63% rename from etc/grml/fai/config/files/etc/network/interfaces/GRMLBASE rename to config/files/etc/network/interfaces/GRMLBASE index dae8e214a..de5b967c0 100644 --- a/etc/grml/fai/config/files/etc/network/interfaces/GRMLBASE +++ b/config/files/etc/network/interfaces/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/35-network script, using -# ${GRML_FAI_CONFIG}/config/files/etc/network/interfaces/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/35-network script, using +# ${GRML_FAI_CONFIG}/files/etc/network/interfaces/GRMLBASE # interfaces(5) file used by ifup(8) and ifdown(8) @@ -10,4 +10,3 @@ source /etc/network/interfaces.d/* # The loopback interface auto lo iface lo inet loopback - diff --git a/etc/grml/fai/config/files/etc/sudoers/GRMLBASE b/config/files/etc/sudoers.d/user-nopasswd/GRMLBASE similarity index 58% rename from etc/grml/fai/config/files/etc/sudoers/GRMLBASE rename to config/files/etc/sudoers.d/user-nopasswd/GRMLBASE index 7a4634283..b2418abf1 100644 --- a/etc/grml/fai/config/files/etc/sudoers/GRMLBASE +++ b/config/files/etc/sudoers.d/user-nopasswd/GRMLBASE @@ -1,28 +1,12 @@ -# sudoers file. -# This file MUST be edited with the "visudo" command as root. -# See the man page for details on how to write a sudoers file. - # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/20-sudo script, using -# ${GRML_FAI_CONFIG}/config/files/etc/sudoers/GRMLBASE - -# Host alias specification - -# User alias specification - -# Cmnd alias specification - -# User privilege specification -root ALL=(ALL) ALL +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/20-sudo script, using +# ${GRML_FAI_CONFIG}/files/etc/sudoers.d/user-nopasswd/GRMLBASE # WARNING: This allows the unprivileged $USERNAME user to start commands as root # WARNING: This is totally insecure and (almost) makes $USERNAME a second root account. # WARNING: Never allow external access to the $USERNAME user!!! $USERNAME ALL=NOPASSWD: ALL -# Path used for every command run from sudo -Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - # allow editing of files with editor: # $USERNAME ALL=NOPASSWD: sudoedit diff --git a/config/files/etc/systemd/logind.conf.d/grml.conf/GRMLBASE b/config/files/etc/systemd/logind.conf.d/grml.conf/GRMLBASE new file mode 100644 index 000000000..f9372eeee --- /dev/null +++ b/config/files/etc/systemd/logind.conf.d/grml.conf/GRMLBASE @@ -0,0 +1,6 @@ +# This file was deployed via grml-live. +# See logind.conf(5) for details + +[Login] +NAutoVTs=12 +HandleLidSwitch=ignore diff --git a/etc/grml/fai/config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE b/config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE similarity index 83% rename from etc/grml/fai/config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE rename to config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE index 9bdfedeca..b78f831cb 100644 --- a/etc/grml/fai/config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE +++ b/config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE @@ -8,7 +8,5 @@ enable gpm.service enable grml-autoconfig.service enable debug-shell.service enable resolvconf.service -enable rsyslog.socket -enable rsyslog.service disable * diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE similarity index 93% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE index e640aff7e..56568b18a 100644 --- a/etc/grml/fai/config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE +++ b/config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE @@ -7,6 +7,7 @@ StandardInput=tty StandardOutput=tty TTYPath=/dev/tty1 TTYVTDisallocate=no +WorkingDirectory=~ ExecStart= ExecStart=-/usr/share/grml-scripts/run-welcome diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty10.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty10.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty10.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty10.service.d/override.conf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty11.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty11.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty11.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty11.service.d/override.conf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty12.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty12.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty12.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty12.service.d/override.conf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE similarity index 92% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE index 87b9e670c..4d072031c 100644 --- a/etc/grml/fai/config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE +++ b/config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE @@ -6,6 +6,7 @@ Restart=always StandardInput=tty StandardOutput=tty TTYPath=/dev/tty2 +WorkingDirectory=~ ExecStart= ExecStart=-/usr/share/grml-scripts/run-screen diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE similarity index 92% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE index 786468e0f..8970a58d8 100644 --- a/etc/grml/fai/config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE +++ b/config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE @@ -6,6 +6,7 @@ Restart=always StandardInput=tty StandardOutput=tty TTYPath=/dev/tty3 +WorkingDirectory=~ ExecStart= ExecStart=-/usr/share/grml-scripts/run-screen diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE similarity index 92% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE index a94f83a6b..93150b38d 100644 --- a/etc/grml/fai/config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE +++ b/config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE @@ -7,6 +7,7 @@ StandardInput=tty StandardOutput=tty TTYPath=/dev/tty4 User=$USERNAME +WorkingDirectory=~ ExecStart= ExecStart=-/usr/share/grml-scripts/run-screen diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty5.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty5.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty5.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty5.service.d/override.conf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty6.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty6.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty6.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty6.service.d/override.conf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/getty@tty7.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/getty@tty7.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/getty@tty7.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/getty@tty7.service.d/override.conf/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/grml-boot.target/GRMLBASE b/config/files/etc/systemd/system/grml-boot.target/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/grml-boot.target/GRMLBASE rename to config/files/etc/systemd/system/grml-boot.target/GRMLBASE diff --git a/etc/grml/fai/config/files/etc/systemd/system/serial-getty@.service.d/override.conf/GRMLBASE b/config/files/etc/systemd/system/serial-getty@.service.d/override.conf/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/etc/systemd/system/serial-getty@.service.d/override.conf/GRMLBASE rename to config/files/etc/systemd/system/serial-getty@.service.d/override.conf/GRMLBASE diff --git a/config/files/etc/systemd/system/ssh.service.d/keygen.conf/GRMLBASE b/config/files/etc/systemd/system/ssh.service.d/keygen.conf/GRMLBASE new file mode 100644 index 000000000..4c82f6046 --- /dev/null +++ b/config/files/etc/systemd/system/ssh.service.d/keygen.conf/GRMLBASE @@ -0,0 +1,4 @@ +# This file was deployed via grml-live. + +[Service] +ExecStartPre=-/usr/bin/ssh-keygen -A diff --git a/etc/grml/fai/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE b/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE similarity index 50% rename from etc/grml/fai/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE rename to config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE index c248a47e2..415c8b90f 100644 --- a/etc/grml/fai/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE +++ b/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/85-systemd script, using -# ${GRML_FAI_CONFIG}/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/85-systemd script, using +# ${GRML_FAI_CONFIG}/files/etc/tmpfiles.d/man-db.conf/GRMLBASE # Override default (age set to 1w) to avoid disappearing mandb caches d /var/cache/man 0755 man man - diff --git a/etc/grml/fai/config/files/usr/share/doc/grml-docs/startpage.html/GRMLBASE b/config/files/usr/share/doc/grml-docs/startpage.html/GRMLBASE similarity index 100% rename from etc/grml/fai/config/files/usr/share/doc/grml-docs/startpage.html/GRMLBASE rename to config/files/usr/share/doc/grml-docs/startpage.html/GRMLBASE diff --git a/etc/grml/fai/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE b/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE similarity index 96% rename from etc/grml/fai/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE rename to config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE index ce17ae149..aa8b9e281 100755 --- a/etc/grml/fai/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE +++ b/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE @@ -1,8 +1,8 @@ #!/bin/sh # # This file was deployed via grml-live's -# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/42-branding script, using -# ${GRML_FAI_CONFIG}/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE +# ${GRML_FAI_CONFIG}/scripts/GRMLBASE/42-branding script, using +# ${GRML_FAI_CONFIG}/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE # # Filename: /usr/share/initramfs-tools/scripts/init-top/grml # Purpose: Early boot progress handler diff --git a/etc/grml/fai/config/grml/squashfs-excludes b/config/grml/squashfs-excludes similarity index 87% rename from etc/grml/fai/config/grml/squashfs-excludes rename to config/grml/squashfs-excludes index fed1ce979..bdb06c947 100644 --- a/etc/grml/fai/config/grml/squashfs-excludes +++ b/config/grml/squashfs-excludes @@ -1,3 +1,4 @@ +dev/* run/* var/run/* var/lock/* diff --git a/etc/grml/fai/config/hooks/instsoft.GRMLBASE b/config/hooks/instsoft.GRMLBASE similarity index 75% rename from etc/grml/fai/config/hooks/instsoft.GRMLBASE rename to config/hooks/instsoft.GRMLBASE index 2c4a880e5..b28748aaa 100755 --- a/etc/grml/fai/config/hooks/instsoft.GRMLBASE +++ b/config/hooks/instsoft.GRMLBASE @@ -9,11 +9,18 @@ set -u set -e +# shellcheck source=/dev/null +. "$GRML_LIVE_CONFIG" + +# FAI sets ${target}, but shellcheck does not know that. +target=${target:?} + # if hooks/updatebase.GRMLBASE fails for whatever reason # and can't skip instsoft.GRMLBASE we have to make sure # we exit here as well if [ -n "$BUILD_ONLY" ] ; then - "Exiting hooks/instsoft.GRMLBASE as BUILD_ONLY environment is set." + echo "Exiting hooks/instsoft.GRMLBASE as BUILD_ONLY environment is set." + echo "W: This place was reached because updatebase.GRMLBASE failed." exit 0 fi @@ -23,22 +30,18 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then # /etc/resolv.conf is usually a symlink, pointing out of the chroot. # Make it a file with known contents. rm -f "${target}"/etc/resolv.conf - cat /etc/resolv.conf >> "$target"/etc/resolv.conf + cat /etc/resolv.conf >> "${target}"/etc/resolv.conf - if [ -r $target/etc/policy-rc.d.conf ] ; then - sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf + if [ -r "${target}"/etc/policy-rc.d.conf ] ; then + sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" "${target}"/etc/policy-rc.d.conf fi # we definitely don't want to fail running fai sofupdate just # because of some well known bugs: - [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d - cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF -// Check all packages whether they has critical bugs before they are installed. -// If you don't like it, comment it out. -//DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"}; -//DPkg::Tools::Options::/usr/sbin/apt-listbugs ""; -//DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2"; -EOF + [ -d "${target}"/etc/apt/apt.conf.d ] || mkdir "${target}"/etc/apt/apt.conf.d + if [ -e "${target}"/etc/apt/apt.conf.d/10apt-listbugs ]; then + mv "${target}"/etc/apt/apt.conf.d/10apt-listbugs "${target}"/etc/apt/apt.conf.d/10apt-listbugs.disabled + fi # work around /etc/kernel/postinst.d/zz-update-grub failing # inside openvz environment, see #597084 @@ -86,11 +89,14 @@ EOF if $ROOTCMD test -x /usr/bin/aptitude ; then if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then + # shellcheck disable=SC2086 # APTITUDE_OPTS needs word-splitting. APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS safe-upgrade else + # shellcheck disable=SC2086 # APTITUDE_OPTS needs word-splitting. APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS upgrade fi else + # shellcheck disable=SC2086 # APTGET_OPTS needs word-splitting. APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y $APTGET_OPTS --force-yes upgrade fi @@ -98,7 +104,7 @@ EOF fi # no softupdate but fresh installation -echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running" +echo "Action ${FAI_ACTION} of FAI (hooks/instsoft.GRMLBASE) via grml-live running" # work around /etc/kernel/postinst.d/zz-update-grub failing # inside openvz environment, see #597084 @@ -119,25 +125,19 @@ fi # we definitely don't want to fail running fai dirinstall just # because of some well known bugs: -[ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d -cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF -// Check all packages whether they has critical bugs before they are installed. -// If you don't like it, comment it out. -//DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"}; -//DPkg::Tools::Options::/usr/sbin/apt-listbugs ""; -//DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2"; -EOF - -# make sure /dev/MAKEDEV is available: -if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then - ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV +[ -d "${target}"/etc/apt/apt.conf.d ] || mkdir "${target}"/etc/apt/apt.conf.d +if [ -e "${target}"/etc/apt/apt.conf.d/10apt-listbugs ]; then + mv "${target}"/etc/apt/apt.conf.d/10apt-listbugs "${target}"/etc/apt/apt.conf.d/10apt-listbugs.disabled fi # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)): -if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then - rm -f "$target"/usr/sbin/invoke-rc.d +if [ -L "${target}"/usr/sbin/invoke-rc.d ] ; then + rm -f "${target}"/usr/sbin/invoke-rc.d $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d fi +echo "[instsoft] Removing FAI diversion of /sbin/init to avoid Debian bug #1056151 for fai < 6.2.3" +fai-divert -r /sbin/init || true + ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/hooks/instsoft.ZFS b/config/hooks/instsoft.ZFS similarity index 80% rename from etc/grml/fai/config/hooks/instsoft.ZFS rename to config/hooks/instsoft.ZFS index 2e8a072b0..3ab8da1f4 100755 --- a/etc/grml/fai/config/hooks/instsoft.ZFS +++ b/config/hooks/instsoft.ZFS @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # We don't want to install build-essential, dkms et al via package_config # because they will end up bloating the iso; it seems cleaner to install # them, build the zfs modules, then remove them. @@ -29,9 +32,10 @@ echo "$0: Installing latest kernel and its headers, as well as build-essential." # keeping track of what gets installed. This is an ugly hack and should not # be needed, but without it the resulting ISO is hundreds of megabytes # larger. I hope this kludge can go away eventually. -extra_packages=($($ROOTCMD apt-get --assume-no --download-only --mark-auto -u install \ +mapfile -t extra_packages < <($ROOTCMD \ + apt-get --assume-no --download-only --mark-auto -u install \ build-essential linux-image-amd64 linux-headers-amd64 \ - | sed '0,/The following NEW packages will be installed/d;/^[^ ]/,$d')) + | sed -e '0,/The following NEW packages will be installed/d;/^[^ ]/,$d' -e 's/\s/\n/g' | sed '/^$/d') $ROOTCMD apt-get --yes --mark-auto -u install build-essential linux-image-amd64 linux-headers-amd64 # Remove all but the latest kernel (TODO: support passing in the desired @@ -54,7 +58,11 @@ else fi echo "$0: Installing zfs-dkms itself." -extra_packages=(${extra_packages[@]} $($ROOTCMD apt-get --assume-no --download-only --mark-auto -u install zfs-dkms | sed '0,/The following NEW packages will be installed/d;/^[^ ]/,$d')) +mapfile -t zfs_packages < <($ROOTCMD \ + apt-get --assume-no --download-only --mark-auto -u install \ + zfs-dkms \ + | sed -e '0,/The following NEW packages will be installed/d;/^[^ ]/,$d' -e 's/\s/\n/g' | sed '/^$/d') +extra_packages=("${extra_packages[@]}" "${zfs_packages[@]}") $ROOTCMD apt-get --yes --mark-auto -u install zfs-dkms # Now invoke the dkms kernel postinst script for the only kernel that's left @@ -66,16 +74,16 @@ $ROOTCMD /etc/kernel/postinst.d/dkms "$kernelversion" tempfile=$(mktemp) echo "$0: Saving built modules into a backup file (removing the dkms package will remove them, but we'll put them back)." -$ROOTCMD tar cf - /lib/modules/$kernelversion/updates/dkms >$tempfile +$ROOTCMD tar cf - "/lib/modules/$kernelversion/updates/dkms" >"$tempfile" echo "$0: Removing packages only needed to build zfs modules." -remove_packages=($(echo "${extra_packages[@]}" zfs-dkms '^linux-headers-.*' build-essential $pahole | tr ' ' '\n' | sort -u)) -$ROOTCMD apt-get --yes --purge --autoremove remove ${remove_packages[@]} +remove_packages=("${extra_packages[@]}" zfs-dkms '^linux-headers-.*' build-essential "$pahole") +$ROOTCMD apt-get --yes --purge --autoremove remove "${remove_packages[@]}" echo "$0: Trying extra hard to get rid of auto-installed packages. This is a hack that is one of the ways we're trying to work around a perceived bug in apt autoremove and should be a no-op." $ROOTCMD apt-get --yes --purge autoremove echo "$0: Restoring backed-up kernel modules." -$ROOTCMD tar xf - <$tempfile -rm $tempfile -$ROOTCMD depmod -a $kernelversion +$ROOTCMD tar xf - <"$tempfile" +rm "$tempfile" +$ROOTCMD depmod -a "$kernelversion" echo "$0: Completed successfully. Enjoy your zfs." diff --git a/etc/grml/fai/config/hooks/savelog.LAST.source b/config/hooks/savelog.LAST.source similarity index 94% rename from etc/grml/fai/config/hooks/savelog.LAST.source rename to config/hooks/savelog.LAST.source index de671e5f4..f9386f2f9 100755 --- a/etc/grml/fai/config/hooks/savelog.LAST.source +++ b/config/hooks/savelog.LAST.source @@ -4,7 +4,7 @@ # print errors and warnings found to error.log # WARNING: This will only work with english error messages! -errfile=$LOGDIR/error.log +errfile="$LOGDIR"/error.log # Define grep patterns. Do not start or end with an empty line! globalerrorpatterns="error @@ -109,15 +109,15 @@ $myerrorpatterns" ignorepatterns="$globalignorepatterns $myignorepatterns" -cd $LOGDIR || exit 3 -if [ -s $errfile ]; then +cd "$LOGDIR" || exit 3 +if [ -s "$errfile" ]; then echo "Errorfile already exists. Aborting." exit fi -grep -i "$errorpatterns" *.log | grep -vi "$ignorepatterns" > $errfile +grep -i "$errorpatterns" ./*.log | grep -vi "$ignorepatterns" > "$errfile" -if [ -s $errfile ]; then +if [ -s "$errfile" ]; then echo "ERRORS found in log files. See $errfile." else echo "Congratulations! No errors found in log files." diff --git a/etc/grml/fai/config/hooks/updatebase.GRMLBASE b/config/hooks/updatebase.GRMLBASE similarity index 70% rename from etc/grml/fai/config/hooks/updatebase.GRMLBASE rename to config/hooks/updatebase.GRMLBASE index 65881267e..b10c158fe 100755 --- a/etc/grml/fai/config/hooks/updatebase.GRMLBASE +++ b/config/hooks/updatebase.GRMLBASE @@ -8,15 +8,20 @@ set -u set -e + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # visualize chroot inside zsh: -echo grml_chroot > $target/etc/debian_chroot +echo grml_chroot > "${target}"/etc/debian_chroot -echo "$HOSTNAME" > $target/etc/hostname +echo "$HOSTNAME" > "${target}"/etc/hostname if [ -n "${APT_PROXY:-}" ] ; then - cat > $target/etc/apt/apt.conf.d/90grml-apt-proxy.conf < "$target"/etc/apt/apt.conf.d/90grml-apt-proxy.conf < ${target}/etc/udev/kernel-upgrade -fi - # install all apt related files -fcopy -i -B -v -r /etc/apt +fcopy -M -i -B -v -r /etc/apt # install packages from a repository of a specific date if [ -n "${WAYBACK_DATE:-}" ] ; then echo "Wayback date '$WAYBACK_DATE' identified, enabling for snapshot.debian.org usage." - perl -pi -e "s#^(\s+)(deb.* )(.*://ftp.debian.org.*?)\s+([a-z-]+)\s+(.*)\$#\$1\$2 [check-valid-until=no] http://snapshot.debian.org/archive/debian/$WAYBACK_DATE/ \$4 \$5#" \ + perl -pi -e "s#^(\s+)(deb.* )(.*://deb.debian.org.*?)\s+([a-z-]+)\s+(.*)\$#\$1\$2 [check-valid-until=no] http://snapshot.debian.org/archive/debian/$WAYBACK_DATE/ \$4 \$5#" \ "${target}/etc/apt/sources.list.d/debian.list" perl -pi -e "s#^(\s+)(deb.* )(.*://security.debian.org.*?)\s+([a-z-/]+)\s+(.*)\$#\$1\$2 [check-valid-until=no] http://snapshot.debian.org/archive/debian-security/$WAYBACK_DATE/ \$4 \$5#" \ diff --git a/etc/grml/fai/config/package_config/DEBIAN_BOOKWORM b/config/package_config/DEBIAN_BOOKWORM similarity index 100% rename from etc/grml/fai/config/package_config/DEBIAN_BOOKWORM rename to config/package_config/DEBIAN_BOOKWORM diff --git a/etc/grml/fai/config/package_config/DEBIAN_STABLE b/config/package_config/DEBIAN_STABLE similarity index 100% rename from etc/grml/fai/config/package_config/DEBIAN_STABLE rename to config/package_config/DEBIAN_STABLE diff --git a/etc/grml/fai/config/package_config/DEBIAN_TESTING b/config/package_config/DEBIAN_TESTING similarity index 65% rename from etc/grml/fai/config/package_config/DEBIAN_TESTING rename to config/package_config/DEBIAN_TESTING index 9a7cc249d..f0d63fcf3 100644 --- a/etc/grml/fai/config/package_config/DEBIAN_TESTING +++ b/config/package_config/DEBIAN_TESTING @@ -7,4 +7,13 @@ PACKAGES install # towards dhcpcd only for Debian trixie/testing and newer. Also see # https://bugs.debian.org/1051421 and # https://github.com/grml/grml-live/issues/138 -dhcpcd +dhcpcd-base + +# Required for ping to work in trixie and newer. +# https://github.com/grml/grml-live/issues/160 +linux-sysctl-defaults + + +PACKAGES install AMD64 +# UEFI 32bit boot support, available in Debian/trixie and newer +grub-efi-ia32-unsigned diff --git a/etc/grml/fai/config/package_config/DEBIAN_TRIXIE b/config/package_config/DEBIAN_TRIXIE similarity index 65% rename from etc/grml/fai/config/package_config/DEBIAN_TRIXIE rename to config/package_config/DEBIAN_TRIXIE index 9a7cc249d..f0d63fcf3 100644 --- a/etc/grml/fai/config/package_config/DEBIAN_TRIXIE +++ b/config/package_config/DEBIAN_TRIXIE @@ -7,4 +7,13 @@ PACKAGES install # towards dhcpcd only for Debian trixie/testing and newer. Also see # https://bugs.debian.org/1051421 and # https://github.com/grml/grml-live/issues/138 -dhcpcd +dhcpcd-base + +# Required for ping to work in trixie and newer. +# https://github.com/grml/grml-live/issues/160 +linux-sysctl-defaults + + +PACKAGES install AMD64 +# UEFI 32bit boot support, available in Debian/trixie and newer +grub-efi-ia32-unsigned diff --git a/etc/grml/fai/config/package_config/DEBIAN_UNSTABLE b/config/package_config/DEBIAN_UNSTABLE similarity index 65% rename from etc/grml/fai/config/package_config/DEBIAN_UNSTABLE rename to config/package_config/DEBIAN_UNSTABLE index 9a7cc249d..f0d63fcf3 100644 --- a/etc/grml/fai/config/package_config/DEBIAN_UNSTABLE +++ b/config/package_config/DEBIAN_UNSTABLE @@ -7,4 +7,13 @@ PACKAGES install # towards dhcpcd only for Debian trixie/testing and newer. Also see # https://bugs.debian.org/1051421 and # https://github.com/grml/grml-live/issues/138 -dhcpcd +dhcpcd-base + +# Required for ping to work in trixie and newer. +# https://github.com/grml/grml-live/issues/160 +linux-sysctl-defaults + + +PACKAGES install AMD64 +# UEFI 32bit boot support, available in Debian/trixie and newer +grub-efi-ia32-unsigned diff --git a/etc/grml/fai/config/package_config/GRMLBASE b/config/package_config/GRMLBASE similarity index 96% rename from etc/grml/fai/config/package_config/GRMLBASE rename to config/package_config/GRMLBASE index 48c68afb4..5b9c746da 100644 --- a/etc/grml/fai/config/package_config/GRMLBASE +++ b/config/package_config/GRMLBASE @@ -12,6 +12,7 @@ eject fdisk file gpm +grml2usb grml-autoconfig grml-crypt grml-debian-keyring @@ -28,8 +29,9 @@ grml-tips grml-udev-config hdparm hwinfo +ifupdown initramfs-tools -isolinux +iputils-ping kbd less live-boot-grml live-boot-grml-doc @@ -40,10 +42,8 @@ openssh-client openssh-server pciutils physlock -pxelinux resolvconf rsync -rsyslog strace udev usbutils @@ -81,15 +81,17 @@ PACKAGES install I386 grub-pc grub-efi-amd64-bin grub-efi-ia32-bin +isolinux +pxelinux syslinux syslinux-common syslinux-utils -grml2usb PACKAGES install AMD64 grub-pc grub-efi-amd64-bin grub-efi-ia32-bin +isolinux +pxelinux syslinux syslinux-common syslinux-utils -grml2usb PACKAGES install ARM64 grub-efi-arm64-bin diff --git a/etc/grml/fai/config/package_config/GRML_FULL b/config/package_config/GRML_FULL similarity index 98% rename from etc/grml/fai/config/package_config/GRML_FULL rename to config/package_config/GRML_FULL index 2e1ba65f0..502e42763 100644 --- a/etc/grml/fai/config/package_config/GRML_FULL +++ b/config/package_config/GRML_FULL @@ -100,14 +100,13 @@ e2fsprogs exfat-fuse exfatprogs f2fs-tools -genisoimage jfsutils ntfs-3g -reiserfsprogs tcplay xfsdump xfsprogs xmount +xorriso # foreign os support/recovery chntpw @@ -120,10 +119,8 @@ mtools cpp sqlite3 whois -xorriso # install linux -cdebootstrap crosshurd debootstrap kexec-tools @@ -180,6 +177,7 @@ netcat-openbsd nethogs netsniff-ng nmap +openssh-client-ssh1 radvd rdnssd rfkill @@ -188,7 +186,6 @@ sipcalc snmp socat speedtest-cli -ssh ssmping tcpdump tcptraceroute @@ -224,6 +221,9 @@ zip apg pwgen +# privacy tools +scdaemon + # popular VCS to pull config from git @@ -322,7 +322,6 @@ xterm # x86 hardware support acpi -acpi-support irqbalance lm-sensors lshw diff --git a/etc/grml/fai/config/package_config/GRML_SMALL b/config/package_config/GRML_SMALL similarity index 69% rename from etc/grml/fai/config/package_config/GRML_SMALL rename to config/package_config/GRML_SMALL index 6f08f38e6..d8124746f 100644 --- a/etc/grml/fai/config/package_config/GRML_SMALL +++ b/config/package_config/GRML_SMALL @@ -1,121 +1,166 @@ PACKAGES install +grml-paste +grml-quickconfig-standard + +# base os apt -atftp -attr -bash -binutils -bridge-utils bsdextrautils bsdutils -btrfs-progs -buffer -chntpw -coreutils -cpio -cryptsetup -cu dctrl-tools -diffutils +dos2unix +findutils +htop +libnss-myhostname +locales +lsof +mount +ntpsec-ntpdate +passwd +procps +psmisc +sudo +sysvinit-utils +tree +tzdata +util-linux + +# deploy on remote sites +ppp +pppoeconf + +# disk subsystems support/debugging +cryptsetup disktype dmsetup -dos2unix +gdisk +lsscsi +ncdu +smartmontools + +# disk partitioning/boot +kpartx +mbr +parted + +# disk wiping +nwipe +wipe + +# editors +ed +vim-tiny +xxd + +# filesystem support +attr +btrfs-progs dosfstools e2fsprogs -ed -ethtool f2fs-tools -findutils -fsarchiver -gddrescue -gdisk -grml-paste -grml-quickconfig-standard -htop +jfsutils +ntfs-3g +xfsprogs + +# foreign os support/recovery +chntpw +mtools + +# generic tools +whois + +# install linux +kexec-tools +mmdebstrap + +# networking +atftp +bridge-utils +ethtool ifenslave ifupdown -imvirt iperf3 iproute2 iptstate iputils-ping iw -jfsutils -kexec-tools -kpartx ldnsutils -lftp -libnss-myhostname -links -locales -lsof -lsscsi -mawk -mbr -memtester -mmdebstrap -mount -mtools mtr-tiny -ncdu ndisc6 +net-tools netbase netcat-openbsd -net-tools -ntfs-3g -ntpsec-ntpdate -nwipe -parted -partimage -passwd -patch -ppp -pppoeconf -procps -psmisc -qemu-guest-agent -qrencode +openssh-client-ssh1 rdnssd -reiserfsprogs rfkill -rpcbind -screen -sed ser2net -setserial -smartmontools -statserial -sudo -sysvinit-utils -tar tcpdump telnet tmate -tmux -tree tsocks -tzdata +vlan + +# network transfers +lftp +partimage +rpcbind + +# packers/unpackers +cpio +tar unp unzip -util-linux -vlan -wget -whois -wipe -xfsprogs -xxd zip -zsh + +# recovery +gddrescue + +# restore from backup +fsarchiver + +# compressions for backup/restore zstd +# serial +cu +setserial +statserial + +# shell +bash +binutils +buffer +coreutils +diffutils +mawk +patch +qrencode +screen +sed +tmux +zsh + +# system info/mgmt +memtester + +# virtualization support +imvirt +qemu-guest-agent + +# web +links +wget + # special terminal output toilet PACKAGES install I386 linux-image-686 +memtest86+ PACKAGES install AMD64 linux-image-amd64 +memtest86+ PACKAGES install ARM64 linux-image-arm64 diff --git a/etc/grml/fai/config/package_config/IGNORE b/config/package_config/IGNORE similarity index 100% rename from etc/grml/fai/config/package_config/IGNORE rename to config/package_config/IGNORE diff --git a/etc/grml/fai/config/package_config/LATEX b/config/package_config/LATEX similarity index 100% rename from etc/grml/fai/config/package_config/LATEX rename to config/package_config/LATEX diff --git a/etc/grml/fai/config/package_config/XORG b/config/package_config/XORG similarity index 100% rename from etc/grml/fai/config/package_config/XORG rename to config/package_config/XORG diff --git a/etc/grml/fai/config/package_config/ZFS b/config/package_config/ZFS similarity index 100% rename from etc/grml/fai/config/package_config/ZFS rename to config/package_config/ZFS diff --git a/etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist b/config/scripts/DEBORPHAN/10-whitelist similarity index 93% rename from etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist rename to config/scripts/DEBORPHAN/10-whitelist index ec97fc417..d3b63024a 100755 --- a/etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist +++ b/config/scripts/DEBORPHAN/10-whitelist @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/DEBORPHAN/10-whitelist +# Filename: ${GRML_FAI_CONFIG}/scripts/DEBORPHAN/10-whitelist # Purpose: whitelist packages to keep with deborphan # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # workaround for dnsutils transitional package, we can drop this as soon as the # bind9-dnsutils package is available in all our supported Debian releases if [[ -r "${target}/usr/share/doc/dnsutils" ]] && [ -x "${target}/usr/bin/deborphan" ] ; then diff --git a/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot b/config/scripts/DEBORPHAN/98-clean-chroot similarity index 82% rename from etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot rename to config/scripts/DEBORPHAN/98-clean-chroot index dce15d484..6cc310abe 100755 --- a/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot +++ b/config/scripts/DEBORPHAN/98-clean-chroot @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/DEBORPHAN/98-clean-chroot +# Filename: ${GRML_FAI_CONFIG}/scripts/DEBORPHAN/98-clean-chroot # Purpose: drop as many packages from grml as possible # Authors: (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # remove all packages not necessary anymore: echo "Executing apt-get -y --purge autoremove" $ROOTCMD apt-get -y --purge autoremove @@ -20,6 +23,7 @@ PURGE_PACKAGES=$($ROOTCMD dpkg --list | awk '/^rc/ {print $2}') if [ -n "$PURGE_PACKAGES" ] ; then echo "Getting rid of packages which have been removed but not yet purged: $PURGE_PACKAGES" + # shellcheck disable=SC2086 # PURGE_PACKAGES needs word-splitting. $ROOTCMD dpkg --purge $PURGE_PACKAGES fi @@ -29,6 +33,7 @@ if [ -x "$target"/usr/bin/deborphan ] ; then # remove packages until deborphan does not find anymore: while [ "$($ROOTCMD deborphan)" != "" ] ; do echo "Executing deborphan" + # shellcheck disable=SC2046 # deborphan result needs word-splitting. $ROOTCMD apt-get -y --purge remove $($ROOTCMD deborphan) done fi diff --git a/etc/grml/fai/config/scripts/GRMLBASE/01-packages b/config/scripts/GRMLBASE/01-packages similarity index 94% rename from etc/grml/fai/config/scripts/GRMLBASE/01-packages rename to config/scripts/GRMLBASE/01-packages index aae58ae82..181eaef74 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/01-packages +++ b/config/scripts/GRMLBASE/01-packages @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/01-packages +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/01-packages # Purpose: check for packages that have been requested but could not be installed # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + echo -n > "${LOGDIR}"/package_errors.log # ensure we start with an empty file if ! [ -e "${LOGDIR}"/software.log ] ; then diff --git a/etc/grml/fai/config/scripts/GRMLBASE/02-run b/config/scripts/GRMLBASE/02-run similarity index 85% rename from etc/grml/fai/config/scripts/GRMLBASE/02-run rename to config/scripts/GRMLBASE/02-run index b133a62af..d81c75fc1 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/02-run +++ b/config/scripts/GRMLBASE/02-run @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/02-run +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/02-run # Purpose: cleanup after initscripts postinst for /run # Authors: grml-team (grml.org) # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # This is what initscripts would do if everything would be fine. if [ -L "$target/run" ] ; then rm -f "$target/run" diff --git a/config/scripts/GRMLBASE/03-get-sources b/config/scripts/GRMLBASE/03-get-sources new file mode 100755 index 000000000..e3166431b --- /dev/null +++ b/config/scripts/GRMLBASE/03-get-sources @@ -0,0 +1,56 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/03-get-sources +# Purpose: download sources of Debian packages +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +if ifclass SOURCES ; then + echo "Class SOURCES set, retrieving source packages." +else + echo "Class SOURCES not set, nothing to do." + exit 0 +fi + +set -u + +ERRORS_LOG=$(mktemp) +SOURCES_PATH=/grml-live/grml_sources/ + +bailout() { + rm -f "$ERRORS_LOG" +} + +mkdir -p "${target}${SOURCES_PATH}" + +$ROOTCMD apt-get update + +# Collect *source* package names +# shellcheck disable=SC2016 # Embedded $ is correct. +$ROOTCMD dpkg-query -W -f='${Source} ${Package}\n' | sed -e 's/^ //' | awk '{ print $1 }' | sort -u | \ + chroot "${target}" /bin/bash -c "cd \"${SOURCES_PATH}\" && xargs --max-args=32 --max-procs=12 apt-get --download-only source" 2> "${ERRORS_LOG}" + +if grep -q '^E:' "${ERRORS_LOG}" ; then + echo "Errors noticed while retrieving sources:" >&2 + cat "${ERRORS_LOG}" >&2 + bailout + exit 1 +elif grep -q '^W:' "${ERRORS_LOG}" ; then + echo "Warnings noticed while retrieving sources (not failing the build though):" + cat "${ERRORS_LOG}" +elif grep -q '.' "${ERRORS_LOG}" ; then + echo "Unclassified problems noticed while retrieving sources:" >&2 + cat "${ERRORS_LOG}" >&2 + bailout + exit 1 +fi + + +bailout + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/05-hostname b/config/scripts/GRMLBASE/05-hostname similarity index 71% rename from etc/grml/fai/config/scripts/GRMLBASE/05-hostname rename to config/scripts/GRMLBASE/05-hostname index cf55d8dea..3af8ddeef 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/05-hostname +++ b/config/scripts/GRMLBASE/05-hostname @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/05-hostname +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/05-hostname # Purpose: set hostname of live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,18 +9,22 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" # the hostname of the chroot usually isn't the same as the one for the live-system BUILD_HOSTNAME="$($ROOTCMD hostname)" [ -n "$BUILD_HOSTNAME" ] || BUILD_HOSTNAME="grml" -echo "$HOSTNAME" > $target/etc/hostname -echo "$HOSTNAME" > $target/etc/mailname +echo "$HOSTNAME" > "$target"/etc/hostname +echo "$HOSTNAME" > "$target"/etc/mailname -if [ -r $target/etc/postfix/main.cf ] ; then - sed -i "s/^mydestination = .*/mydestination = $HOSTNAME, localhost, localhost.localdomain/" $target/etc/postfix/main.cf - sed -i "s/^myhostname = .*/myhostname = $HOSTNAME/" $target/etc/postfix/main.cf +if [ -r "$target"/etc/postfix/main.cf ] ; then + sed -i "s/^mydestination = .*/mydestination = $HOSTNAME, localhost, localhost.localdomain/" "$target"/etc/postfix/main.cf + sed -i "s/^myhostname = .*/myhostname = $HOSTNAME/" "$target"/etc/postfix/main.cf echo "postfix postfix/mailname string $HOSTNAME" | $ROOTCMD debconf-set-selections echo "postfix postfix/destinations string ${HOSTNAME}, localhost.grml.org, localhost" \ | $ROOTCMD debconf-set-selections diff --git a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup b/config/scripts/GRMLBASE/15-initsetup similarity index 59% rename from etc/grml/fai/config/scripts/GRMLBASE/15-initsetup rename to config/scripts/GRMLBASE/15-initsetup index 4b63a99b9..25e541133 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup +++ b/config/scripts/GRMLBASE/15-initsetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/15-initsetup +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/15-initsetup # Purpose: configure init system for the live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,6 +8,11 @@ set -u set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" systemd_setup() { @@ -21,6 +26,16 @@ systemd_setup() { $ROOTCMD systemctl preset-all $ROOTCMD systemctl set-default grml-boot.target + + # ldconfig.service updates the dynamic linker cache. This is not really + # useful on a live OS image, where the installed packages do not change + # on startup. As this is quite costly, disable it. + $ROOTCMD systemctl mask ldconfig.service + + # systemd-journal-catalog-update.service updates the journald catalog + # cache. Do this once here, and not on each live OS image boot. + $ROOTCMD systemctl mask systemd-journal-catalog-update.service + $ROOTCMD journalctl --update-catalog } systemd_setup diff --git a/etc/grml/fai/config/scripts/GRMLBASE/16-depmod b/config/scripts/GRMLBASE/16-depmod similarity index 72% rename from etc/grml/fai/config/scripts/GRMLBASE/16-depmod rename to config/scripts/GRMLBASE/16-depmod index 047a50ec9..46cde6ca0 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/16-depmod +++ b/config/scripts/GRMLBASE/16-depmod @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/16-depmod +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/16-depmod # Purpose: set up kernel's modules.dep # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,13 +9,16 @@ set -u set -e -if ! [ -x $target/sbin/depmod ] ; then +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +if ! [ -x "$target"/sbin/depmod ] ; then echo "Warning: depmod not installed" exit 0 fi -for kernel in ${target}/boot/vmlinuz-* ; do - kernelversion=${kernel##$target} +for kernel in "$target"/boot/vmlinuz-* ; do + kernelversion=${kernel##"$target"} kernelversion=${kernelversion##/boot/vmlinuz-} echo "Updating modules.dep for kernel ${kernelversion}" diff --git a/etc/grml/fai/config/scripts/GRMLBASE/18-timesetup b/config/scripts/GRMLBASE/18-timesetup similarity index 73% rename from etc/grml/fai/config/scripts/GRMLBASE/18-timesetup rename to config/scripts/GRMLBASE/18-timesetup index d44efb262..b88da943d 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/18-timesetup +++ b/config/scripts/GRMLBASE/18-timesetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/18-timesetup +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/18-timesetup # Purpose: apply default time and timezone settings # Authors: (c) Thomas Lehmann # Bug-Reports: send to author and see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # tell if hwclock is running in UTC or local time # by default it's set to UTC=no if [ -n "$UTC" ] && [ "$UTC" = "yes" ] ; then @@ -20,14 +23,14 @@ fi if [ -n "$TIMEZONE" ] ; then echo "Setting default timezone to $TIMEZONE" # update debconf - area=$(echo $TIMEZONE | cut -d '/' -f1) - zone=$(echo $TIMEZONE | cut -d '/' -f2) + area=$(echo "$TIMEZONE" | cut -d '/' -f1) + zone=$(echo "$TIMEZONE" | cut -d '/' -f2) echo "tzdata tzdata/Areas select $area" | $ROOTCMD debconf-set-selections echo "tzdata tzdata/Zones/$area select $zone" | $ROOTCMD debconf-set-selections # update files - echo $TIMEZONE > $target/etc/timezone - rm -f $target/etc/localtime - cp -f $target/usr/share/zoneinfo/$TIMEZONE $target/etc/localtime + echo "$TIMEZONE" > "$target"/etc/timezone + rm -f "$target"/etc/localtime + cp -f "$target"/usr/share/zoneinfo/"$TIMEZONE" "$target"/etc/localtime fi ## END OF FILE ################################################################ diff --git a/etc/grml/fai/config/scripts/GRMLBASE/20-sudo b/config/scripts/GRMLBASE/20-sudo similarity index 57% rename from etc/grml/fai/config/scripts/GRMLBASE/20-sudo rename to config/scripts/GRMLBASE/20-sudo index f6934ea7d..6ecbc9467 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/20-sudo +++ b/config/scripts/GRMLBASE/20-sudo @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/20-sudo +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/20-sudo # Purpose: configure sudo setup of the live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,12 +8,17 @@ set -u set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" -fcopy -v /etc/sudoers -sed -i "s/\$USERNAME/$USERNAME/" $target/etc/sudoers -chmod 440 $target/etc/sudoers -chown 0:0 $target/etc/sudoers +fcopy -m root,root,0440 -v /etc/sudoers.d/user-nopasswd +sed -i "s/\$USERNAME/$USERNAME/" "$target"/etc/sudoers.d/user-nopasswd +chmod 440 "$target"/etc/sudoers.d/user-nopasswd +chown 0:0 "$target"/etc/sudoers.d/user-nopasswd ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup b/config/scripts/GRMLBASE/21-usersetup similarity index 67% rename from etc/grml/fai/config/scripts/GRMLBASE/21-usersetup rename to config/scripts/GRMLBASE/21-usersetup index 50d43e613..31ed4218b 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup +++ b/config/scripts/GRMLBASE/21-usersetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/21-usersetup +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/21-usersetup # Purpose: adjust user setup of the live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,25 +8,30 @@ set -u set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" -if grep -q "$USERNAME:x:1000" $target/etc/group ; then +if grep -q "$USERNAME:x:1000" "$target"/etc/group ; then echo "group $USERNAME exists already, skipping" else - $ROOTCMD addgroup --gid 1000 $USERNAME + $ROOTCMD addgroup --gid 1000 "$USERNAME" fi -if grep -q "$USERNAME:x:1000" $target/etc/passwd ; then +if grep -q "$USERNAME:x:1000" "$target"/etc/passwd ; then echo "user $USERNAME exists already, skipping" else - $ROOTCMD useradd -d /home/$USERNAME -m -s /bin/zsh -g 1000 $USERNAME + $ROOTCMD useradd -d /home/"$USERNAME" -m -s /bin/zsh -g 1000 "$USERNAME" fi # make sure to add the user to all relevant groups: add_user_to_group() { [ -n "$1" ] || return 1 - if grep -q $1 $target/etc/group ; then - grep "$1:x:.*$USERNAME" $target/etc/group || $ROOTCMD adduser $USERNAME $1 + if grep -q "$1" "$target"/etc/group ; then + $ROOTCMD adduser --quiet "$USERNAME" "$1" fi } @@ -55,12 +60,12 @@ add_user_to_group video add_user_to_group vlock add_user_to_group voice -sed -i 's/^root::/root:*:/' $target/etc/shadow -sed -i "s/^$USERNAME:!:/$USERNAME:*:/" $target/etc/shadow +sed -i 's/^root::/root:*:/' "$target"/etc/shadow +sed -i "s/^$USERNAME:!:/$USERNAME:*:/" "$target"/etc/shadow if $ROOTCMD [ -r /bin/zsh ] ; then $ROOTCMD chsh -s /bin/zsh root - $ROOTCMD chsh -s /bin/zsh $USERNAME + $ROOTCMD chsh -s /bin/zsh "$USERNAME" fi ## END OF FILE ################################################################# diff --git a/etc/grml/fai/config/scripts/GRMLBASE/25-locales b/config/scripts/GRMLBASE/25-locales similarity index 80% rename from etc/grml/fai/config/scripts/GRMLBASE/25-locales rename to config/scripts/GRMLBASE/25-locales index 59a4e7160..32b10c39f 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/25-locales +++ b/config/scripts/GRMLBASE/25-locales @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/25-locales +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/25-locales # Purpose: locales (language) configuration of the live system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,12 +9,15 @@ set -u set -e -# set up /etc/locale.gen, only GRML_FULL and LOCALES have -# the full setup, GRMLBASE installs a minimal configuration -fcopy -v /etc/locale.gen +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# set up /etc/locale.gen, GRMLBASE installs a minimal configuration. +# Only if the LOCALES class is added you get a fuller set of locales. +fcopy -M -v /etc/locale.gen # set up /etc/locale.conf, to avoid systemd-firstboot prompting for user input -fcopy -v /etc/locale.conf +fcopy -M -v /etc/locale.conf # get rid of locales unless using class LOCALES set +u @@ -23,7 +26,7 @@ set -u echo 'Removing /usr/share/locale' # get rid of the original - rm -rf $target/usr/share/locale + rm -rf "$target"/usr/share/locale # restore *empty* directories because otherwise installation/upgrade of packages might fail [ -d "$target"/usr/share/locale ] || mkdir "$target"/usr/share/locale @@ -45,7 +48,7 @@ if $ROOTCMD dpkg --list localepurge 2>&1 | grep -q '^ii' ; then $ROOTCMD dpkg-reconfigure -f noninteractive localepurge fi -if ! [ -x $target/usr/sbin/localepurge ] ; then +if ! [ -x "$target"/usr/sbin/localepurge ] ; then echo "Warning: localepurge not installed" else echo "Running localepurge." @@ -55,7 +58,7 @@ fi if $ROOTCMD dpkg-query -s locales-all >/dev/null 2>&1 ; then echo "locales-all installed, skipping locales generation" else - if ! [ -x ${target}/usr/sbin/locale-gen ] ; then + if ! [ -x "$target"/usr/sbin/locale-gen ] ; then echo 'Warning: locale-gen [package locales] not installed' else echo "Running locale-gen" diff --git a/etc/grml/fai/config/scripts/GRMLBASE/26-console-setup b/config/scripts/GRMLBASE/26-console-setup similarity index 64% rename from etc/grml/fai/config/scripts/GRMLBASE/26-console-setup rename to config/scripts/GRMLBASE/26-console-setup index 4bf7f3c32..d4fa6c8b8 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/26-console-setup +++ b/config/scripts/GRMLBASE/26-console-setup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/26-console-setup +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/26-console-setup # Purpose: console-setup configuration of the live system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,7 +9,12 @@ set -u set -e -fcopy -v /etc/default/console-setup +fcopy -M -v /etc/default/console-setup + +# Have setupcon write its cache into /etc/console-setup, to avoid doing +# this on each live boot. +rm -f "${target}"/etc/console-setup/cached* +$ROOTCMD setupcon --save-only ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/30-fstab b/config/scripts/GRMLBASE/30-fstab similarity index 73% rename from etc/grml/fai/config/scripts/GRMLBASE/30-fstab rename to config/scripts/GRMLBASE/30-fstab index c316ec6ec..c30b5f833 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/30-fstab +++ b/config/scripts/GRMLBASE/30-fstab @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/30-fstab +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/30-fstab # Purpose: create initial /etc/fstab for use on live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,10 +8,15 @@ set -u set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" -fcopy -v /etc/fstab -sed -i "s/uid=USERNAME,gid=USERNAME/uid=$USERNAME,gid=$USERNAME/" $target/etc/fstab +fcopy -M -v /etc/fstab +sed -i "s/uid=USERNAME,gid=USERNAME/uid=$USERNAME,gid=$USERNAME/" "$target"/etc/fstab ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/31-motd b/config/scripts/GRMLBASE/31-motd similarity index 84% rename from etc/grml/fai/config/scripts/GRMLBASE/31-motd rename to config/scripts/GRMLBASE/31-motd index b1ed247d1..eaab7d494 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/31-motd +++ b/config/scripts/GRMLBASE/31-motd @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/31-motd +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/31-motd # Purpose: replace motd # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,7 +9,7 @@ set -u set -e -fcopy -v /etc/motd +fcopy -M -v /etc/motd ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/32-xorg b/config/scripts/GRMLBASE/32-xorg similarity index 70% rename from etc/grml/fai/config/scripts/GRMLBASE/32-xorg rename to config/scripts/GRMLBASE/32-xorg index 238af5da5..f94cf535b 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/32-xorg +++ b/config/scripts/GRMLBASE/32-xorg @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/32-xorg +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/32-xorg # Purpose: make sure there does not exist /etc/X11/xorg.conf by default # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,13 +9,16 @@ set -u set -e -if [ -r "$target/etc/X11/xorg.conf" ] ; then +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +if [ -r "$target"/etc/X11/xorg.conf ] ; then mv -f "$target"/etc/X11/xorg.conf "$target"/etc/X11/xorg.conf.debian fi -if [ "$(readlink $target/etc/X11/X)" = "/bin/true" ] ; then +if [ "$(readlink "$target"/etc/X11/X)" = "/bin/true" ] ; then echo "Warning: /etc/X11/X is a symlink to /bin/true - fixing for you">&2 - ln -sf /usr/bin/Xorg $target/etc/X11/X + ln -sf /usr/bin/Xorg "$target"/etc/X11/X fi ## END OF FILE ################################################################# diff --git a/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup b/config/scripts/GRMLBASE/33-aptsetup similarity index 69% rename from etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup rename to config/scripts/GRMLBASE/33-aptsetup index 234bd1a7c..c1c8b64be 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup +++ b/config/scripts/GRMLBASE/33-aptsetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/33-aptsetup +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/33-aptsetup # Purpose: configure Debian package management of live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,10 +8,14 @@ set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # use snapshot.debian.org based on build date for release if ifclass RELEASE ; then set -u - perl -pi -e 'BEGIN { $d="'$(date +%Y%m%d)'"; } s#^(\s+)(deb.* )(.*://ftp.debian.org.*?)\s+([a-z-]+)\s+(.*)$#$1$2http://snapshot.debian.org/archive/debian/$d/ $4 $5#' \ + current_date=$(date +%Y%m%d) + perl -pi -e 'BEGIN { $d="'"$current_date"'"; } s#^(\s+)(deb.* )(.*://deb.debian.org.*?)\s+([a-z-]+)\s+(.*)$#$1$2http://snapshot.debian.org/archive/debian/$d/ $4 $5#' \ "${target}/etc/apt/sources.list.d/debian.list" fi diff --git a/etc/grml/fai/config/scripts/GRMLBASE/34-hosts b/config/scripts/GRMLBASE/34-hosts similarity index 69% rename from etc/grml/fai/config/scripts/GRMLBASE/34-hosts rename to config/scripts/GRMLBASE/34-hosts index a08c3b9cc..fea788299 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/34-hosts +++ b/config/scripts/GRMLBASE/34-hosts @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/34-hosts +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/34-hosts # Purpose: configure /etc/hosts of live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,12 +8,17 @@ set -u set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" -fcopy -v /etc/hosts +fcopy -M -v /etc/hosts # replace $HOSTNAME with the real hostname: -sed -i "s/\$HOSTNAME/$HOSTNAME/" $target/etc/hosts +sed -i "s/\$HOSTNAME/$HOSTNAME/" "$target"/etc/hosts ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/35-network b/config/scripts/GRMLBASE/35-network similarity index 82% rename from etc/grml/fai/config/scripts/GRMLBASE/35-network rename to config/scripts/GRMLBASE/35-network index a87d75130..0cf914553 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/35-network +++ b/config/scripts/GRMLBASE/35-network @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/35-network +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/35-network # Purpose: set up /etc/network/interfaces of live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,7 +9,7 @@ set -u set -e -fcopy -v /etc/network/interfaces +fcopy -M -v /etc/network/interfaces ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/38-udev b/config/scripts/GRMLBASE/38-udev similarity index 90% rename from etc/grml/fai/config/scripts/GRMLBASE/38-udev rename to config/scripts/GRMLBASE/38-udev index d5c89d1f3..951caecb6 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/38-udev +++ b/config/scripts/GRMLBASE/38-udev @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/38-udev +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/38-udev # Purpose: configure udev of live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + CONFFILE="$target/etc/udev/rules.d/70-persistent-net.rules" STRING='This file was automatically generated by the /lib/udev/write_net_rules' diff --git a/config/scripts/GRMLBASE/39-modprobe b/config/scripts/GRMLBASE/39-modprobe new file mode 100755 index 000000000..13f698e78 --- /dev/null +++ b/config/scripts/GRMLBASE/39-modprobe @@ -0,0 +1,19 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/39-modprobe +# Purpose: adjust modprobe configuration +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +set -u +set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# Install all present modprobe.d configuration files +fcopy -M -v -i -r /etc/modprobe.d + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/41-modules b/config/scripts/GRMLBASE/41-modules similarity index 74% rename from etc/grml/fai/config/scripts/GRMLBASE/41-modules rename to config/scripts/GRMLBASE/41-modules index dd90ff33f..a84967aa8 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/41-modules +++ b/config/scripts/GRMLBASE/41-modules @@ -1,6 +1,6 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/41-modules -# Purpose: set up /etc/modules +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/41-modules +# Purpose: set up /etc/modules-load.d # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. @@ -9,7 +9,7 @@ set -u set -e -fcopy -v /etc/modules +fcopy -M -i -B -v -r /etc/modules-load.d ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/42-branding b/config/scripts/GRMLBASE/42-branding similarity index 68% rename from etc/grml/fai/config/scripts/GRMLBASE/42-branding rename to config/scripts/GRMLBASE/42-branding index 66746d972..d42d0bd99 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/42-branding +++ b/config/scripts/GRMLBASE/42-branding @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/42-branding +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/42-branding # Purpose: install branding files # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,9 +9,8 @@ set -u set -e -fcopy -v /usr/share/initramfs-tools/scripts/init-top/grml -fcopy -v /usr/share/grml/desktop-bg.png -fcopy -v /usr/share/doc/grml-docs/startpage.html +fcopy -m root,root,0755 -v /usr/share/initramfs-tools/scripts/init-top/grml +fcopy -M -v /usr/share/doc/grml-docs/startpage.html ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/44-grub b/config/scripts/GRMLBASE/44-grub similarity index 91% rename from etc/grml/fai/config/scripts/GRMLBASE/44-grub rename to config/scripts/GRMLBASE/44-grub index d00d376e0..21661176b 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/44-grub +++ b/config/scripts/GRMLBASE/44-grub @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/44-grub +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/44-grub # Purpose: build grub core.img to use outside # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ diff --git a/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images b/config/scripts/GRMLBASE/45-grub-images similarity index 82% rename from etc/grml/fai/config/scripts/GRMLBASE/45-grub-images rename to config/scripts/GRMLBASE/45-grub-images index 76c0e1054..09b457c38 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images +++ b/config/scripts/GRMLBASE/45-grub-images @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/45-grub-images # Purpose: create grub images for use in ISO # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,12 @@ set -e set -u +# shellcheck source=/dev/null +. "$GRML_LIVE_CONFIG" + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + TMP_CONFIG="/tmp/grub_config_efi" # this allows us to find this specific Grml ISO, @@ -36,7 +42,7 @@ if ifclass ARM64 ; then # NOTE: efi_uga (EFI Universal Graphics Adapter) is deprecated + unavailable on arm64 ADDITIONAL_MODULES[arm64-efi]="efi_gop" # no efi_uga available else - echo "/usr/lib/grub/arm64-efi/moddep.lst.lst could not be found, skipping." + echo "/usr/lib/grub/arm64-efi/moddep.lst could not be found, skipping." echo "NOTE: grub-efi-arm64-bin not installed?" fi fi @@ -51,7 +57,8 @@ if ifclass AMD64 ; then fi fi -if ifclass I386 ; then +# note: enabled also on AMD64 for UEFI 32bit boot support +if ifclass I386 || ifclass AMD64 ; then if [ -r "${target}"/usr/lib/grub/i386-efi/moddep.lst ] ; then ARCHS+=(i386-efi) ADDITIONAL_MODULES[i386-efi]="efi_gop efi_uga" @@ -70,10 +77,11 @@ for arch in "${ARCHS[@]}" ; do arm64-efi) filename=/boot/bootaa64.efi ;; esac - $ROOTCMD grub-mkimage -O $arch -o "$filename" --prefix=/boot/grub/ --config="$TMP_CONFIG" \ + read -r -a modules <<< "${ADDITIONAL_MODULES[$arch]}" + $ROOTCMD grub-mkimage -O "$arch" -o "$filename" --prefix=/boot/grub/ --config="$TMP_CONFIG" \ echo iso9660 part_msdos search_fs_file test \ fat ext2 reiserfs xfs btrfs squash4 part_gpt lvm \ - ${ADDITIONAL_MODULES[$arch]} + "${modules[@]}" done rm -f "${target}/${TMP_CONFIG}" diff --git a/etc/grml/fai/config/scripts/GRMLBASE/46-grml-version b/config/scripts/GRMLBASE/46-grml-version similarity index 77% rename from etc/grml/fai/config/scripts/GRMLBASE/46-grml-version rename to config/scripts/GRMLBASE/46-grml-version index f2e8d0bf9..a11944850 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/46-grml-version +++ b/config/scripts/GRMLBASE/46-grml-version @@ -1,5 +1,5 @@ #!/bin/sh -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/46-grml-version +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/46-grml-version # Purpose: Update grml version in the chroot # Authors: grml-team (grml.org) # Bug-Reports: see http://grml.org/bugs/ @@ -8,13 +8,17 @@ set -u set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" echo "Setting /etc/grml_version to $GRML_NAME $VERSION Release Codename $RELEASENAME [$DATE]" -echo "$GRML_NAME $VERSION Release Codename $RELEASENAME [$DATE]" > $target/etc/grml_version +echo "$GRML_NAME $VERSION Release Codename $RELEASENAME [$DATE]" > "$target"/etc/grml_version chmod 644 "${target}/etc/grml_version" echo "Setting /etc/issue to $GRML_NAME $VERSION" printf "%s %s %s %s\n\n" "$GRML_NAME" "$VERSION" '\n' '\l' > "${target}/etc/issue" chmod 644 "${target}/etc/issue" - diff --git a/etc/grml/fai/config/scripts/GRMLBASE/47-update-wallpaper b/config/scripts/GRMLBASE/47-update-wallpaper similarity index 56% rename from etc/grml/fai/config/scripts/GRMLBASE/47-update-wallpaper rename to config/scripts/GRMLBASE/47-update-wallpaper index bd5f8c464..bb7330a2a 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/47-update-wallpaper +++ b/config/scripts/GRMLBASE/47-update-wallpaper @@ -1,26 +1,33 @@ #!/bin/sh -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/47-update-wallpaper +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/47-update-wallpaper # Purpose: Update the grml wallpaper # Authors: grml-team (grml.org) # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. ################################################################################ +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" -FONTFILE=${FONTFILE:-/usr/share/grml-live/fonts/graphicoreBitmapFont0-Light.otf} TITLE_FONTSIZE=${TITLE_FONTSIZE:-200} VERSION_FONTSIZE=${VERSION_FONTSIZE:-100} -GRML_BG=${GRML_BG:-$target/usr/share/grml/desktop-bg.png} -GRML_WALLPAPER=${GRML_WALLPAPER:-$target/usr/share/grml/desktop.jpg} +GRML_WALLPAPER=${GRML_WALLPAPER:-"$target"/usr/share/grml/desktop.jpg} + +FONTFILE="$TEMPLATE_DIRECTORY"/wallpaper/font.otf +GRML_BG="$TEMPLATE_DIRECTORY"/wallpaper/input.png + +echo "Creating GRMLBASE wallpaper" if [ ! -x "$(which convert)" ]; then - echo "convert not installed, skipping wallpaper." - exit 0 + echo "convert not installed, skipping wallpaper." + exit 0 fi if [ ! -f "$GRML_BG" ]; then - echo "Could not find Grml background image, skipping wallpaper" + echo "Could not find input image $GRML_BG, skipping wallpaper" exit 0 fi @@ -29,11 +36,9 @@ if [ ! -f "$FONTFILE" ]; then exit 0 fi -echo "Creating standard wallpaper" - convert "$GRML_BG" -gravity center \ -fill white -font "$FONTFILE" \ - -pointsize $TITLE_FONTSIZE \ + -pointsize "$TITLE_FONTSIZE" \ -draw "text 0,0 \"$GRML_NAME\"" \ - -pointsize $VERSION_FONTSIZE \ + -pointsize "$VERSION_FONTSIZE" \ -draw "text 0,$((TITLE_FONTSIZE+50)) \"$VERSION\"" "$GRML_WALLPAPER" diff --git a/config/scripts/GRMLBASE/49-sshd b/config/scripts/GRMLBASE/49-sshd new file mode 100755 index 000000000..a91e53146 --- /dev/null +++ b/config/scripts/GRMLBASE/49-sshd @@ -0,0 +1,28 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/49-sshd +# Purpose: adjust sshd configuration file +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +set -u +set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +if ! [ -r "${target}/etc/ssh/sshd_config" ] ; then + echo "File /etc/ssh/sshd_config doesn't exist, skipping execution of script." + exit 0 +fi + +echo "# Installed by grml-live. +# Ensure root login works. Modern openssh-servers default to prohibit-password. +PermitRootLogin yes +# Speedup if DNS is broken/unavailable. +UseDNS no +" > "${target}"/etc/ssh/sshd_config.d/grml-live.conf + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/50-lvm b/config/scripts/GRMLBASE/50-lvm similarity index 88% rename from etc/grml/fai/config/scripts/GRMLBASE/50-lvm rename to config/scripts/GRMLBASE/50-lvm index 1f6527974..be24c54fc 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/50-lvm +++ b/config/scripts/GRMLBASE/50-lvm @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/50-lvm +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/50-lvm # Purpose: adjust LVM configuration # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + if [ -f "${target}/lib/udev/rules.d/69-lvm.rules" ] ; then # lvm2 >=2.03.15 echo "Clearing /lib/udev/rules.d/69-lvm.rules to avoid automatic LVM scanning" echo '# this file was generated by grml-live script GRMLBASE/50-lvm' > "${target}/lib/udev/rules.d/69-lvm.rules" diff --git a/etc/grml/fai/config/scripts/GRMLBASE/51-cloud-init b/config/scripts/GRMLBASE/51-cloud-init similarity index 85% rename from etc/grml/fai/config/scripts/GRMLBASE/51-cloud-init rename to config/scripts/GRMLBASE/51-cloud-init index 017408d00..fd13095a2 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/51-cloud-init +++ b/config/scripts/GRMLBASE/51-cloud-init @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/51-cloud-init +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/51-cloud-init # Purpose: configure cloud-init package # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -12,7 +12,7 @@ set -e # NOTE: this file is relevant only with cloud-init package installed, # though we install it unconditionally via GRMLBASE class to have it # available and configured as shipped by Grml ISOs -fcopy -v /etc/cloud/cloud.cfg.d/42_grml.cfg +fcopy -M -v /etc/cloud/cloud.cfg.d/42_grml.cfg ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/52-mdadm b/config/scripts/GRMLBASE/52-mdadm similarity index 83% rename from etc/grml/fai/config/scripts/GRMLBASE/52-mdadm rename to config/scripts/GRMLBASE/52-mdadm index 625065f73..6525f80e1 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/52-mdadm +++ b/config/scripts/GRMLBASE/52-mdadm @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/52-mdadm +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/52-mdadm # Purpose: adjust mdadm configuration # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + echo "Removing /lib/udev/rules.d/64-md-raid-assembly.rules to avoid automatic mdadm scanning" echo '# this file was generated by grml-live script GRMLBASE/52-mdadm' > "${target}/lib/udev/rules.d/64-md-raid-assembly.rules" diff --git a/etc/grml/fai/config/scripts/GRMLBASE/55-aoetools b/config/scripts/GRMLBASE/55-aoetools similarity index 85% rename from etc/grml/fai/config/scripts/GRMLBASE/55-aoetools rename to config/scripts/GRMLBASE/55-aoetools index eaf18e693..285ceaf05 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/55-aoetools +++ b/config/scripts/GRMLBASE/55-aoetools @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/55-aoetools +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/55-aoetools # Purpose: adjust aoetools configuration # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,6 +8,9 @@ set -eu +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # see https://github.com/grml/grml/issues/32 echo "Removing /usr/lib/modules-load.d/aoetools.conf to avoid automatic aoe discovery" rm -f "${target}/usr/lib/modules-load.d/aoetools.conf" diff --git a/etc/grml/fai/config/scripts/GRMLBASE/80-initramfs b/config/scripts/GRMLBASE/80-initramfs similarity index 67% rename from etc/grml/fai/config/scripts/GRMLBASE/80-initramfs rename to config/scripts/GRMLBASE/80-initramfs index de694cc76..92471c5bb 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/80-initramfs +++ b/config/scripts/GRMLBASE/80-initramfs @@ -1,5 +1,5 @@ #!/bin/sh -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/80-initramfs +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/80-initramfs # Purpose: configure initramfs and rebuild it # Authors: grml-team (grml.org) # Bug-Reports: see http://grml.org/bugs/ @@ -9,18 +9,19 @@ set -u set -e -fcopy -v /etc/initramfs-tools/hooks/000-udev-shutup -fcopy -v /etc/initramfs-tools/conf.d/xz-compress -fcopy -v /etc/initramfs-tools/modules +# FAI sets $target, but shellcheck does not know that. +target=${target:?} -if ! [ -f $target/usr/share/initramfs-tools/scripts/live ] ; then +fcopy -M -v /etc/initramfs-tools/conf.d/xz-compress + +if ! [ -f "$target"/usr/share/initramfs-tools/scripts/live ] ; then echo "Error: live-boot/-initramfs does not seem to be present, can not create initramfs. Exiting.">&2 exit 1 fi echo "Rebuilding initramfs" -for initrd in "$(basename $target/boot/vmlinuz-*)" ; do +for initrd in $(basename "$target"/boot/vmlinuz-*) ; do if ! $ROOTCMD update-initramfs -k "${initrd##vmlinuz-}" -c ; then echo "Creating fresh initramfs did not work, trying update instead:" $ROOTCMD update-initramfs -k "${initrd##vmlinuz-}" -u diff --git a/etc/grml/fai/config/scripts/GRMLBASE/85-systemd b/config/scripts/GRMLBASE/85-systemd similarity index 85% rename from etc/grml/fai/config/scripts/GRMLBASE/85-systemd rename to config/scripts/GRMLBASE/85-systemd index 4ea424743..7f8524ff7 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/85-systemd +++ b/config/scripts/GRMLBASE/85-systemd @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/85-systemd +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/85-systemd # Purpose: configure systemd and related services # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -8,6 +8,8 @@ set -u set -e + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" fcopy -M -i -B -v -r /etc/tmpfiles.d diff --git a/etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives b/config/scripts/GRMLBASE/90-update-alternatives similarity index 90% rename from etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives rename to config/scripts/GRMLBASE/90-update-alternatives index 9c3d1885a..22e6b4bf4 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives +++ b/config/scripts/GRMLBASE/90-update-alternatives @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/90-update-alternatives +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/90-update-alternatives # Purpose: set up /etc/alternatives/* according to grml preferences # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # starting with vim v2:8.1.2136-1 it uses /usr/libexec/vim for the vim.* binaries if $ROOTCMD update-alternatives --list editor 2>/dev/null | grep -q /usr/libexec/vim ; then VIM_PATH=/usr/libexec/vim @@ -52,11 +55,6 @@ if $ROOTCMD update-alternatives --list x-cursor-theme 2>/dev/null | grep -q '/wh $ROOTCMD update-alternatives --set x-cursor-theme /etc/X11/cursors/whiteglass.theme fi -if $ROOTCMD update-alternatives --list x-www-browser 2>/dev/null | grep -q '/iceweasel' ; then - echo "Setting iceweasel as x-www-browser using update-alternatives." - $ROOTCMD update-alternatives --set x-www-browser /usr/bin/iceweasel -fi - if $ROOTCMD update-alternatives --list x-www-browser 2>/dev/null | grep -q '/firefox-esr' ; then echo "Setting firefox-esr as x-www-browser using update-alternatives." $ROOTCMD update-alternatives --set x-www-browser /usr/bin/firefox-esr @@ -74,7 +72,7 @@ fi # sadly isn't available via update-alternates, anyway - use # ntfs-3g (if available) as default for ntfs -if [ -r $target/sbin/mount.ntfs-3g ] || [ -L $target/sbin/mount.ntfs-3g ] ; then +if [ -r "$target"/sbin/mount.ntfs-3g ] || [ -L "$target"/sbin/mount.ntfs-3g ] ; then $ROOTCMD ln -sf /sbin/mount.ntfs-3g /sbin/mount.ntfs fi diff --git a/etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids b/config/scripts/GRMLBASE/91-update-pciids similarity index 82% rename from etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids rename to config/scripts/GRMLBASE/91-update-pciids index 07666b103..2bdb08e9e 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids +++ b/config/scripts/GRMLBASE/91-update-pciids @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/91-update-pciids +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/91-update-pciids # Purpose: update pciids # Authors: (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -13,6 +13,9 @@ fi set -u +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + bailout() { if [ "${1:-}" = "4" ] || [ "${1:-}" = "1" ] ; then echo "Warning: update-pciids returned with exit code ${1:-}." >&2 @@ -31,21 +34,14 @@ bailout() { } -[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT="" - if ! [ -x "${target}/usr/sbin/update-pciids" ] && ! [ -x "${target}/usr/bin/update-pciids" ] ; then echo "Warning: update-pciids not installed (neither /usr/sbin/update-pciids nor /usr/bin/update-pciids exists" exit 0 fi echo "Updating PCI-IDs" -if [ -n "$TIMEOUT" ] ; then - $ROOTCMD timeout $TIMEOUT update-pciids - bailout $? -else - $ROOTCMD update-pciids - bailout $? -fi +$ROOTCMD timeout 10 update-pciids +bailout $? ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam b/config/scripts/GRMLBASE/92-update-freshclam similarity index 81% rename from etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam rename to config/scripts/GRMLBASE/92-update-freshclam index 3275bb113..2ed706238 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam +++ b/config/scripts/GRMLBASE/92-update-freshclam @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/92-update-freshclam +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/92-update-freshclam # Purpose: update freshclam database # Authors: (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -19,6 +19,9 @@ fi set -u +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + bailout() { if [ "${1:-}" = "124" ] ; then echo "Warning: freshclam returned with exit code 124." >&2 @@ -37,21 +40,14 @@ bailout() { exit "${1:-0}" } -[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT="" - -if ! [ -x $target/usr/bin/freshclam ] ; then +if ! [ -x "$target"/usr/bin/freshclam ] ; then echo "freshclam not installed" exit 0 fi echo "Updating clamav database via running freshclam" -if [ -n "$TIMEOUT" ] ; then - $ROOTCMD timeout $TIMEOUT /usr/bin/freshclam - bailout $? -else - $ROOTCMD /usr/bin/freshclam - bailout $? -fi +$ROOTCMD timeout 10 /usr/bin/freshclam +bailout $? ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/config/scripts/GRMLBASE/95-package-information b/config/scripts/GRMLBASE/95-package-information new file mode 100755 index 000000000..b13df9203 --- /dev/null +++ b/config/scripts/GRMLBASE/95-package-information @@ -0,0 +1,53 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/95-package-information +# Purpose: store package information of chroot system +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +set -eu -o pipefail + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +if ! [ -w "${LOGDIR}" ] ; then + echo "Error: can not write to ${LOGDIR}. Exiting.">&2 + exit 1 +fi + +# store package list: +COLUMNS=200 $ROOTCMD dpkg --list > "${LOGDIR}"/dpkg.list +COLUMNS=200 $ROOTCMD dpkg --get-selections > "${LOGDIR}"/dpkg.selections + +# store list of packages sorted by size: +if [ -x "$target"/usr/bin/dpkg-query ] ; then + # shellcheck disable=SC2016 # Embedded $ is correct. + $ROOTCMD dpkg-query -W --showformat='${Package}\t${Installed-Size}\n' > \ + "${LOGDIR}"/packages.size +fi + +# store a list of non-free packages and their licenses +echo "The following packages from the Debian non-free section are included in this release" \ + > "${LOGDIR}"/nonfree-licenses.txt +echo >> "${LOGDIR}"/nonfree-licenses.txt + +# copyright information for non-free packages +non_free_pkgs=$($ROOTCMD apt-cache show '~i' | awk '/^Package: / {pkg=$2} /^Section: non-free/ {print pkg}') + +for pkg in ${non_free_pkgs:-} ; do + echo "Package: ${pkg}" >> "${LOGDIR}"/nonfree-licenses.txt + echo "========================================================================" \ + >> "${LOGDIR}"/nonfree-licenses.txt + if $ROOTCMD test -r "/usr/share/doc/${pkg}/copyright" ; then + $ROOTCMD cat "/usr/share/doc/${pkg}/copyright" >> "${LOGDIR}"/nonfree-licenses.txt + else + echo "${pkg} does not provide a copyright file" >> "${LOGDIR}"/nonfree-licenses.txt + fi + echo >> "${LOGDIR}"/nonfree-licenses.txt +done + +gzip -9 "${LOGDIR}"/nonfree-licenses.txt + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/config/scripts/GRMLBASE/98-clean-chroot b/config/scripts/GRMLBASE/98-clean-chroot new file mode 100755 index 000000000..7e9b1879c --- /dev/null +++ b/config/scripts/GRMLBASE/98-clean-chroot @@ -0,0 +1,209 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/98-clean-chroot +# Purpose: clean up chroot system +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +################################################################################ + +set -u +set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +if ! ls "$target"/boot/config-* &>/dev/null ; then + echo "No kernel config files (/boot/config-*) found. No kernel-image package installed?" >&2 + exit 1 +fi + +echo "Creating ~/.zshrc" +touch "$target"/root/.zshrc + +$ROOTCMD rm -f /etc/apt/apt.conf.d/90grml-apt-proxy.conf + +if [ -x "$target"/usr/sbin/localepurge ] ; then + echo "Running localepurge" + $ROOTCMD localepurge +else + echo "Warning: localepurge not installed" +fi + +# revert dpkg-divert of hooks/instsoft.GRMLBASE, which is +# used to work around /etc/kernel/postinst.d/zz-update-grub failing +# inside openvz environment, see #597084 +if $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/update-grub' ; then + echo "Undoing dpkg-divert of update-grub executable" + $ROOTCMD rm -f /usr/sbin/update-grub + $ROOTCMD dpkg-divert --rename --remove /usr/sbin/update-grub +fi + +# revert dpkg-divert of hooks/instsoft.GRMLBASE, which is +# used to work around a grub-probe<->openvz bug +if $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/grub-probe' ; then + echo "Undoing dpkg-divert of grub-probe executable" + $ROOTCMD rm -f /usr/sbin/grub-probe + $ROOTCMD dpkg-divert --rename --remove /usr/sbin/grub-probe +fi + +# revert udev workaround of hooks/updatebase.GRMLBASE +if grep -q 'updatebase.GRMLBASE' "$target"/etc/udev/kernel-upgrade 2>/dev/null ; then + echo "Removing /etc/udev/kernel-upgrade created by updatebase.GRMLBASE" + $ROOTCMD rm -f /etc/udev/kernel-upgrade +fi + +echo "Cleaning apt places" +$ROOTCMD apt-get check 2>/dev/null +$ROOTCMD dpkg --clear-avail +$ROOTCMD apt-cache gencaches 2>/dev/null +$ROOTCMD apt-get clean + +rm -f "$target"/var/lib/dpkg/status-old "$target"/var/lib/dpkg/available-old + +if ! [ -x "$target"/usr/bin/grep-dctrl ] ; then + echo "Warning: grep-dctrl not installed" +else + echo "Cleaning up /var/lib/dpkg/status" + if $ROOTCMD grep-dctrl -v -F Status "purge ok not-installed" \ + /var/lib/dpkg/status > "$target"/var/lib/dpkg/status.new ; then + mv "$target"/var/lib/dpkg/status.new "$target"/var/lib/dpkg/status + chmod 644 "$target"/var/lib/dpkg/status + chown root:root "$target"/var/lib/dpkg/status + fi +fi + +echo "Removing host ssh-keys" +rm -f "$target"/etc/ssh/*key* + +echo "Removing dbus machine-id" +rm -f "$target"/var/lib/dbus/machine-id + +if [ -d "$target"/var/spool/squid/ ] ; then + echo "Cleaning /var/spool/squid/0*" + rm -rf "$target"/var/spool/squid/0* +fi + +echo "Cleaning and removing some misc files and directories" +find "$target"/etc -type f -name '*.pre_fcopy' -delete +find "$target"/etc -type l -name '*.pre_fcopy' -delete +rm -rf --one-file-system "$target"/etc/sysconfig/* \ + "$target"/etc/motd.dpkg-* "$target"/etc/auto.master.*dpkg* \ + "$target"/etc/samba/*.SID "$target"/etc/samba/*.tdb \ + "$target"/var/log/ksymoops/* \ + "$target"/var/state/* "$target"/var/log/nessus/* \ + "$target"/halt "$target"/reboot "$target"/ash.static \ + "$target"/etc/dhcpc/*.info "$target"/etc/dhcpc/resolv* \ + "$target"/etc/*passwd- "$target"/etc/*shadow- \ + "$target"/etc/*group- "$target"/var/spool/postfix/maildrop/* \ + "$target"/etc/*.old "$target"/etc/*.original \ + "$target"/etc/lvm/.cache "$target"/etc/lvm/cache/.cache \ + "$target"/etc/lvm/backup/* "$target"/tmp/* \ + "$target"/var/tmp/* "$target"/var/backups/* \ + "$target"/var/lib/mysql "$target"/var/log/lilo_log.* "$target"/core* \ + "$target"/etc/blkid.tab + +# remove only "temporary" or saved files in the given directories +nuke(){ + find "$@" \( -name "*.gz" -o -name "*.bz2" -o -name "*.xz" -o -name "*.0" \) -delete +} + +# set all files in the given directories to a length of zero +zero(){ + while IFS= read -r -d '' file ; do + :> "$file" + done < <(find "$@" -type f -size +0 -not -name \*.ini -not -path '*/fai/*' -not -name install_packages.list -print0 2>/dev/null) +} + +echo "Removing possible leftovers from update-pciids runs" +rm -f "${target}"/wget-log* + +echo "Cleaning log and cache directories" +nuke "$target"/var/log "$target"/var/cache +zero "$target"/var/account/pacct \ + "$target"/var/cache/man \ + "$target"/var/lib/games \ + "$target"/var/lib/nfs \ + "$target"/var/lib/xkb \ + "$target"/var/local \ + "$target"/var/log \ + "$target"/var/mail/grml + +if ! [ -x "$target"/usr/sbin/update-ca-certificates ] ; then + echo "Warning: update-ca-certificates not installed" +else + echo "Updating ca-certificates" + $ROOTCMD update-ca-certificates +fi + +# regenerate ls.so.cache +if ! [ -x "$target"/sbin/ldconfig ] ; then + echo "Warning: ldconfig not installed" +else + echo "Updating ld.so.cache" + $ROOTCMD ldconfig +fi + +if ! [ -x "$target"/usr/bin/update-menus ] ; then + echo "Warning: update-menus not installed" +else + echo "Updating windowmanager menus" + $ROOTCMD update-menus -v +fi + +if ! [ -x "$target"/usr/bin/mandb ] ; then + echo "Warning: mandb not installed" +else + echo "Updating mandb" + $ROOTCMD mandb -c + $ROOTCMD man doesnotexist >/dev/null 2>&1 || true +fi + +if ! [ -d "$target"/var/lib/clamav/ ] ; then + echo "Warning: clamav[-freshclam] not installed" +else + echo "Cleaning /var/lib/clamav/" + $ROOTCMD rm -rf /var/lib/clamav/clamav-* + + echo "Setting up daily.cvd and main.cvd symlinks" + if [ -f "$target"/var/lib/clamav/daily.cvd ] ; then + mkdir -p "$target"/usr/share/doc/clamav-freshclam/examples/ + ln -sf /var/lib/clamav/daily.cvd "$target"/usr/share/doc/clamav-freshclam/examples/ + ln -sf /var/lib/clamav/main.cvd "$target"/usr/share/doc/clamav-freshclam/examples/ + fi +fi + +if ! [ -r "$target"/etc/ld.so.nohwcap ] ; then + echo "Creating /etc/ld.so.nohwcap" + touch "$target"/etc/ld.so.nohwcap +fi + +if ! [ -d "$target"/etc/resolvconf ] ; then + echo "Warning: resolvconf not installed" +else + echo "Setting up resolvconf" + rm -f "$target"/etc/resolvconf/resolv.conf.d/original + rm -f "$target"/etc/resolv.conf + ln -s /run/resolvconf/resolv.conf "$target"/etc/resolv.conf +fi + +# make sure we don't leak any mdadm configurations +# that are present on the build system to the live system +if [ -f "$target/etc/mdadm/mdadm.conf" ] ; then + echo "Found /etc/mdadm/mdadm.conf, getting rid of any possible enabled ARRAY settings." + sed -i '/^ARRAY/d' "$target"/etc/mdadm/mdadm.conf +fi + +if ! $ROOTCMD test -x /usr/bin/updatedb ; then + echo "Warning: updatedb not installed" +else + echo "Updating locate-database" + $ROOTCMD updatedb --prunepaths='/tmp /usr/tmp /var/tmp /grml /root /proc /sys' +fi + +if [ -r "$target"/etc/machine-id ] ; then + echo "Removing /etc/machine-id generated by systemd" + rm -f "$target"/etc/machine-id +fi + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build b/config/scripts/GRMLBASE/99-finish-grml-build similarity index 62% rename from etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build rename to config/scripts/GRMLBASE/99-finish-grml-build index 0f1b9d6d4..827f2a0b8 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build +++ b/config/scripts/GRMLBASE/99-finish-grml-build @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/99-finish-grml-build +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/99-finish-grml-build # Purpose: finalize grml chroot build # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,18 +9,21 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + # Restore original state from softupdate: -if [ -r $target/etc/policy-rc.d.conf ] ; then - sed -i "s/EXITSTATUS='101'/EXITSTATUS='0'/" $target/etc/policy-rc.d.conf +if [ -r "$target"/etc/policy-rc.d.conf ] ; then + sed -i "s/EXITSTATUS='101'/EXITSTATUS='0'/" "$target"/etc/policy-rc.d.conf fi # remove an existing /etc/debian_chroot file: -if [ -r $target/etc/debian_chroot ] ; then - rm -f $target/etc/debian_chroot +if [ -r "$target"/etc/debian_chroot ] ; then + rm -f "$target"/etc/debian_chroot fi # /etc/grml_cd makes the live system recognizable as a live system -touch $target/etc/grml_cd +touch "$target"/etc/grml_cd ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRML_FULL/01-firefox b/config/scripts/GRML_FULL/01-firefox similarity index 81% rename from etc/grml/fai/config/scripts/GRML_FULL/01-firefox rename to config/scripts/GRML_FULL/01-firefox index 64dc868d1..c2c9178b0 100755 --- a/etc/grml/fai/config/scripts/GRML_FULL/01-firefox +++ b/config/scripts/GRML_FULL/01-firefox @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRML_FULL/01-firefox +# Filename: ${GRML_FAI_CONFIG}/scripts/GRML_FULL/01-firefox # Purpose: set startpage of Firefox and further configuration defaults # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,7 +9,7 @@ set -u set -e -fcopy -i -B -v /etc/firefox-esr/firefox-esr.js +fcopy -M -i -B -v /etc/firefox-esr/firefox-esr.js ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives b/config/scripts/GRML_SMALL/90-update-alternatives similarity index 86% rename from etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives rename to config/scripts/GRML_SMALL/90-update-alternatives index afd440d57..1d0853203 100755 --- a/etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives +++ b/config/scripts/GRML_SMALL/90-update-alternatives @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/90-update-alternatives +# Filename: ${GRML_FAI_CONFIG}/scripts/GRMLBASE/90-update-alternatives # Purpose: set up /etc/alternatives/* according to grml preferences # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -9,13 +9,16 @@ set -u set -e +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + ## Editor: # Too many people don't expect to get that, so use it only for grml-small # avoid "debug: unbound variable": set +u if ifclass GRML_SMALL ; then set -u - if [ -r $target/usr/bin/vim.tiny ] ; then + if [ -r "$target"/usr/bin/vim.tiny ] ; then # update-alternates does not work without /usr/share/man because # it configures (in our case non-existent) manpages as well :-/ # $ROOTCMD update-alternatives --set editor /usr/bin/vim.tiny diff --git a/config/scripts/LATEX/98-clean-chroot b/config/scripts/LATEX/98-clean-chroot new file mode 100755 index 000000000..b7716a7a0 --- /dev/null +++ b/config/scripts/LATEX/98-clean-chroot @@ -0,0 +1,25 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/LATEX/98-clean-chroot +# Purpose: remove some large LaTeX documentation directories +# Authors: (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +################################################################################ + +set -u +set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +rm -rf "${target}"/usr/share/doc/texlive-latex-recommended/latex/ \ + "${target}"/usr/share/doc/texlive-latex-base/latex/ \ + "${target}"/usr/share/doc/texlive-base-bin/pdftex/thanh/ \ + "${target}"/usr/share/doc/texlive-latex-base/latex/base/ \ + "${target}"/usr/share/doc/texlive-latex-base/latex/hyperref/ \ + "${target}"/usr/share/doc/texlive-latex-base/generic/babel/ \ + "${target}"/usr/share/doc/texlive-latex-recommended/latex/koma-script/ \ + "${target}"/usr/share/doc/texmf/pgf/pgfmanual.pdf.gz + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/config/scripts/RELEASE/98-clean-chroot b/config/scripts/RELEASE/98-clean-chroot new file mode 100755 index 000000000..4e013ca7c --- /dev/null +++ b/config/scripts/RELEASE/98-clean-chroot @@ -0,0 +1,60 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/RELEASE/98-clean-chroot +# Purpose: clean up $HOMEs for release +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +set -u +set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null +. "$GRML_LIVE_CONFIG" + +echo "Removing /var/lib/apt/lists/*-stuff, dpkg-status-old and pkgcache.bin" +rm -f "$target"/var/lib/apt/lists/*Packages \ + "$target"/var/lib/apt/lists/*Release \ + "$target"/var/lib/apt/lists/*Sources \ + "$target"/var/lib/apt/lists/*Index* \ + "$target"/var/lib/apt/lists/*Translation* \ + "$target"/var/lib/apt/lists/*.gpg \ + "$target"/var/cache/apt-show-versions/* \ + "$target"/var/cache/debconf/*.dat-old \ + "$target"/var/cache/apt/*.bin + +echo "Removing /var/lib/aptitude/pkgstates.old" +rm -f "$target"/var/lib/aptitude/pkgstates.old + +echo "Removing all files inside /root" +rm -rf "$target"/root +mkdir -m 0755 "$target"/root + +echo "Removing all files inside /home/${USERNAME}" +rm -rf "${target}/home/${USERNAME:?}" +mkdir -m 0755 "${target}/home/${USERNAME}" +$ROOTCMD chown "${USERNAME}:${USERNAME}" "/home/${USERNAME}" + +echo "Syncing /home/${USERNAME}/ with data from /etc/skel/:" +$ROOTCMD su -s /bin/sh "${USERNAME}" -c "rsync -Hav /etc/skel/ /home/${USERNAME}/" + + +# Initialize zsh caches so first startup on Live CD is faster. +echo "exit" | $ROOTCMD zsh -l -s -i +echo "exit" | $ROOTCMD setpriv --reuid="${USERNAME}" --regid="${USERNAME}" --clear-groups --reset-env zsh -l -s -i + +echo "Listing homedir of user root:" +ls -la "$target"/root +echo "Listing homedir of user ${USERNAME}:" +ls -la "$target"/home/"${USERNAME}" + +# "assert" zcompdump was created. +echo "Checking existence of /root/.zcompdump and /home/${USERNAME}/.zcompdump" +ls -la "$target"/root/.zcompdump +ls -la "$target"/home/"${USERNAME}"/.zcompdump + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/RELEASE/99-update-wallpaper b/config/scripts/RELEASE/99-update-wallpaper similarity index 61% rename from etc/grml/fai/config/scripts/RELEASE/99-update-wallpaper rename to config/scripts/RELEASE/99-update-wallpaper index 675f63a2d..aca821640 100755 --- a/etc/grml/fai/config/scripts/RELEASE/99-update-wallpaper +++ b/config/scripts/RELEASE/99-update-wallpaper @@ -1,19 +1,24 @@ #!/bin/sh -# Filename: ${GRML_FAI_CONFIG}/config/scripts/RELEASE/99-update-wallpaper +# Filename: ${GRML_FAI_CONFIG}/scripts/RELEASE/99-update-wallpaper # Purpose: Update the grml wallpaper # Authors: grml-team (grml.org) # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. ################################################################################ +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +# shellcheck source=/dev/null . "$GRML_LIVE_CONFIG" -FONTFILE=${FONTFILE:-/usr/share/grml-live/fonts/graphicoreBitmapFont0-Light.otf} TITLE_FONTSIZE=${TITLE_FONTSIZE:-200} -GRML_BG=${GRML_BG:-$target/usr/share/grml/desktop-bg.png} GRML_WALLPAPER=${GRML_WALLPAPER:-$target/usr/share/grml/desktop.jpg} -echo "Creating release wallpaper" +FONTFILE="$TEMPLATE_DIRECTORY"/wallpaper/font.otf +GRML_BG="$TEMPLATE_DIRECTORY"/wallpaper/input.png + +echo "Creating RELEASE wallpaper" if [ ! -x "$(which convert)" ]; then echo "convert not installed, skipping release wallpaper." @@ -21,18 +26,16 @@ if [ ! -x "$(which convert)" ]; then fi if [ ! -f "$GRML_BG" ]; then - echo "Could not find Grml background image, skipping release wallpaper" + echo "Could not find input image $GRML_BG, skipping wallpaper" exit 0 fi if [ ! -f "$FONTFILE" ]; then - echo "Could not find font $FONTFILE, skipping release wallpaper" + echo "Could not find font $FONTFILE, skipping wallpaper" exit 0 fi - convert "$GRML_BG" -gravity center \ -fill white -font "$FONTFILE" \ - -pointsize $TITLE_FONTSIZE \ + -pointsize "$TITLE_FONTSIZE" \ -draw "text 0,0 \"$VERSION\"" "$GRML_WALLPAPER" - diff --git a/config/scripts/REMOVE_DOCS/98-clean-chroot b/config/scripts/REMOVE_DOCS/98-clean-chroot new file mode 100755 index 000000000..73dc6a0b4 --- /dev/null +++ b/config/scripts/REMOVE_DOCS/98-clean-chroot @@ -0,0 +1,36 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/scripts/REMOVE_DOCS/98-clean-chroot +# Purpose: remove docs in Grml chroot +# Authors: (c) Michael Prokop +# License: This file is licensed under the GPL v2. +################################################################################ + +set -u +set -e + +# FAI sets $target, but shellcheck does not know that. +target=${target:?} + +echo "Cleaning documentation directories" +if [ -d "$target"/usr/share/doc/grml-docs ] ; then + mv "$target"/usr/share/doc/grml-docs "$target"/tmp/ +fi + +rm -rf "$target"/usr/share/doc +mkdir "$target"/usr/share/doc + +if [ -d "$target"/tmp/grml-docs ] ; then + mv "$target"/tmp/grml-docs "$target"/usr/share/doc/grml-docs +fi + +rm -rf "$target"/usr/share/gtk-doc/ \ + "$target"/usr/share/man/ \ + "$target"/usr/man \ + "$target"/usr/share/info \ + "$target"/var/cache/man/* + +echo "Creating /usr/share/info/..." +mkdir -p "$target"/usr/share/info/ + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/db/db-to-fai b/db/db-to-fai deleted file mode 100755 index 3cbddb94f..000000000 --- a/db/db-to-fai +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# Filename: db-to-fai -# Purpose: convert output of grml-live's sqlite database for use within FAI -# Authors: grml-team (grml.org) -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -if [ -z "$2" ] ; then - echo "Usage: $0 /path/to/grml-live.db " - exit 1 -fi - -DB="$1" -BUILD_ID="$2" - -if ! [ -r "$DB" ] ; then - echo "Error: can not access database ${DB}.">&2 - bailout 1 -fi - -TMPFILE=$(mktemp) - -bailout() { - rm -f "$TMPFILE" - [ -n "$1" ] && exit "$1" || exit 0 -} - -# get information from db: -if ! echo "select package,version FROM packages, build WHERE build.id = $BUILD_ID AND packages.build = build.id and status = 'ii';" | sqlite3 $DB > $TMPFILE ; then - echo "Error retrieving values from database ${DB}." >&2 - bailout 1 -else - # make sure we god some matches: - if ! grep -q '^[a-zA-Z]*' "$TMPFILE" ; then - echo "No packages retrieved from build id $BUILD_ID - wrong id?" >&2 - bailout 1 - fi - - # write fai header and package information to stdout: - echo "# package list of build $BUILD_ID from database $DB:" - echo "PACKAGES install" - awk -F\| '{print $1"="$2}' "$TMPFILE" -fi - -# clean exit: -bailout - -## END OF FILE ################################################################# diff --git a/db/dpkg-to-db b/db/dpkg-to-db deleted file mode 100755 index e7c6820e5..000000000 --- a/db/dpkg-to-db +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/perl -w -# Filename: dpkg-to-db -# Purpose: add grml build information into a sqlite database -# Authors: grml-team (grml.org) -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ -# Requires the following Debian packages (handled via grml-live-db depends): -# libdbd-sqlite3-perl libdbi-perl libtimedate-perl perl-doc sqlite3 -################################################################################ - -use strict; - -use warnings; -use Getopt::Long; -use Pod::Usage; -use DBI; -use Date::Format; - - -my ($db, $logfile, $flavour, $help, $dpkgfile); -my $rc = GetOptions ( - 'database|db=s' => \$db, - 'dpkg|d=s' => \$dpkgfile, - 'logfile|l=s' => \$logfile, - 'flavour|f=s' => \$flavour, - 'help|h' => \$help, - ); - -pod2usage(1) if $help; - -pod2usage(-message => "$0: Need a sqlite database through --database ....\n") unless $db; -pod2usage(-message => "$0: Need a logfile to insert through --database ...\n") unless $logfile; -pod2usage(-message => "$0: Need the flavour information through --flavour ...\n") unless $flavour; -pod2usage(-message => "$0: Need the dpkg file through --dpkg ...\n") unless $dpkgfile; - -open (my $fh, '<', $logfile) or die "Could not open $logfile: $!"; -open (my $dpkg_handle, '<', $dpkgfile) or die "Could not open $dpkgfile: $!"; - -my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","") or die "Could not connect to database: " . $DBI::err; - -# We use foreign key - beware this needs sqlite > 3.6.19 -$dbh->do("PRAGMA foreign_keys = ON"); - -# read content of log file - please do not try this at home :) -my $log = do { local $/; <$fh> }; - -my $identifier = "$flavour-". time2str('%Y%m%d%H%M%S', time()); - -# Prepare tables if not yet present {{{ -my $create_table_build = $dbh->prepare(" -CREATE TABLE if not exists build ( id integer primary key autoincrement, -identifier varchar(30), -flavour varchar(30), -date varchar(30), -logfile blob); -") - or die "Could not create tables: " . $dbh->errstr."\n"; - -$create_table_build->execute() - or die "Can't execute SQL statement: " . $dbh->errstr."\n"; - -my $create_table_packages = $dbh->prepare(" -CREATE TABLE if not exists packages ( id integer primary key autoincrement, -package varchar(30), -status varchar(2), -version varchar(30), -build integer, -FOREIGN KEY(build) REFERENCES build(id)); -") - or die "Could not create tables: " . $dbh->errstr."\n"; - -$create_table_packages->execute() - or die "Can't execute SQL statement: " . $dbh->errstr."\n"; -# }}} - - -# Write information to database {{{ -my $sth = $dbh->prepare("INSERT into build ('identifier','flavour','date','logfile') VALUES (?,?,?,?)") - or die "Could not prepare db statement: " . $dbh->errstr; - -# Execute the query -$sth->execute($identifier, $flavour, time(), $log) - or die "Could not add build to db: " . $sth->errstr; - -$sth = $dbh->prepare("SELECT id from build where identifier = ?"); -$sth->execute($identifier) or die "Couldn't execute statement: " . $sth->errstr; -my $row = $sth->fetch; -my $id = $row->[0]; - -die "No id?" unless $id; - -$sth = $dbh->prepare("INSERT into packages (package, status, version, build) VALUES (?,?,?,?)") - or die "Could not prepare db statement: " . $dbh->errstr; - -while (my $line = <$dpkg_handle>) { - next unless $line =~ /^[a-z]{2} /; - # remove new lines - my ($status, $package, $version, $desc) = split (/\s+/, $line, 4); - $sth->execute($package, $status, $version, $id) - or die "Couldn't execute statement: " . $sth->errstr; - -} -# }}} - -print "recorded buildinformation with identifier $identifier as id $id\n"; - -# perldoc -F ./dpkg-to-db - -__END__ - -=head1 dpkg-to-db - -dpkg-to-db - add grml build information into a sqlite database - -=head1 SYNOPSIS - -dpkg-to-db - -=head1 OPTIONS - -=over 8 - -=item B<--help> - -Print a brief help message and exits. - -=item B<--database > - -Database file. - -=item B<--dpkg > - -`dpkg --list` output file of grml-live build. - -=item B<--logfile > - -Logfile which should be added. - -=item B<--flavour > - -Name of the grml-flavour the build is. - -=back - -=head1 DESCRIPTION - -B will read the given input file(s) and stores the -information to the specified database. - -=head1 USAGE EXAMPLES - -Please see B for further information. - -=cut diff --git a/debian/NEWS b/debian/NEWS index b8a6f78ce..655e54e5d 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,39 @@ +grml-live (0.51.0) unstable; urgency=low + + The location of the FAI configuration data has changed, and all users + who do not use the default configuration data must update their + configuration. + + In the Debian package, the configuration data files were previously + installed into /etc/grml/fai/config. To avoid continuous upgrading + headaches, these files are now installed into + /usr/share/grml-live/config + instead. + If you intend to modify them, it is strongly recommended to copy the + entire directory tree into a new place of your choice (suggestion: + /srv/grml-live-config) + and modify them there. + Alternatively you're encouraged to maintain your changes as a git + patch stack. + + GRML_FAI_CONFIG (equivalent to passing -D) now must point to the + "config" directory. For example, if you previously set + GRML_FAI_CONFIG=/path/to/your/config/fai, then you must now set + GRML_FAI_CONFIG=/path/to/your/config/fai/config. + + If you are running grml-live from a git checkout, GRML_FAI_CONFIG + needs to be set to GRML_FAI_CONFIG=$(pwd)/config. Previously, + this was GRML_FAI_CONFIG=$(pwd)/etc/grml/fai. + + fai.conf is no longer read. If your customized configuration + includes fai.conf, you should delete it. + + If you run into trouble, please reach out: + https://grml.org/contact/ + As always we are also open to providing commercial support. + + -- Chris Hofstaedtler Tue, 24 Dec 2024 13:48:20 +0100 + grml-live (0.17.0) unstable; urgency=low 1) The sources.list handling has been further improved and diff --git a/debian/changelog b/debian/changelog index 212ba9aa2..feaf2fe5f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,227 @@ +grml-live (0.51.0) grml-testing; urgency=medium + + Big update, moves /etc/grml/fai/config to /usr/share/grml-live/config. + Please read the NEWS file for additional info. + + * [f975ccf] 49-sshd: create dropin file instead of using sed + * [61be585] ttys: set WorkingDirectory to $HOME + * [b8af655] console-setup: create setupcon cache + * [e75a1f4] Switch from ftp.debian.org to deb.debian.org + * [20dbb1f] Drop sources.list for DEBIAN_ETCH + * [475cabc] Remove file-rc leftovers + * [52a7fa3] Remove workaround for modesetting on cirrusfb + * [8e46752] Drop workaround for bug in udev 168-1 + * [2d541ae] Remove vmwgfx enable_fbdev option + * [0cf42f9] Drop deprecation warning for GRML_LIVE_SOURCES + * [ba9342a] Remove support for ZERO_LOGFILE + * [703b53f] fai.conf: autogenerate, treat as internal detail + * [f1dc42a] Move /etc/grml/fai/config into /usr/share/grml-live/config + * [7d561ff] Remove unused/obsolete FAI settings + * [3a3a7f9] updatebase.GRMLBASE: remove ineffective udev workaround + * [fe1c640] SW: GRML_FULL: drop acpi-support + * [2e2f4af] generate-changes-list: sort debian package changes + * [3f9f887] build-driver: use dpkg.list from same flavor + * [c84d711] SW: reduce basefiles tarball to Priority: required + * [5673e58] SW: stop installing rsyslog + * [2997248] Stop installing memdisk + * [6c50960] GRMLBASE/15-initsetup: init journald catalog cache at build time + * [3edbed0] etc/fstab: drop examples handled by systemd + * [642340d] GRMLBASE/21-usersetup: remove grep of group file + * [3ed439e] grub: remove nonfunctional memtest86 bios-mode selection + * [0509080] grml-live: remove check for syslinux from before oldoldstable + * [ef74174] Workaround /sbin/init vanishing, Debian bug #1056151 + * [dc22f36] apt/preferences: move into /etc/apt/preferences.d + * [23db83a] Install zsh completion into /usr/share instead of /etc + + -- Chris Hofstaedtler Sat, 04 Jan 2025 00:34:32 +0100 + +grml-live (0.50.1) grml-testing; urgency=medium + + The "Adventgrenze for real" release + + [ Chris Hofstaedtler ] + * [8b84591] build-driver: move upload_daily into caller of build() + * [47f34ea] build-driver: handle sources before upload_daily + * [ec66ecb] build-driver: rename grml_logs to a per-job unique name + * [77a47ef] generate-changes-list: extract repo clone/update + * [670c1b1] generate-changes-list: import run_x helper + * [6f09c0f] generate-changes-list: collect involved people + * [79475a8] Reduce size of nonfree-licenses.txt by gzip-compressing it + * [b4978d3] build-driver: create compatibly layout in /latest/ + * [ea6e2a4] generate-changes-list: ignore GitHub as author + * [a0e5bbb] build-driver: update URL to latest release dpkg.list + * Software related changes: + - [1ece72b] drop cdebootstrap + + [ Michael Prokop ] + * [d6d3743] scripts/GRMLBASE/95-package-information: get non-free info + without aptitude + + -- Michael Prokop Thu, 19 Dec 2024 18:41:59 +0100 + +grml-live (0.50.0) unstable; urgency=medium + + The "Adventgrenze" release + + [ Chris Hofstaedtler ] + * [b27b742] netboot package: use ISO_NAME-netboot.tar as output name + (without .iso) + * [ca4f25a] grml-live: avoid double / in NETBOOT and REPORTS + * [3ea3fad] build-driver: remove unused get_grml_live function + * [30472fc] Do not add /dev to squashfs + * [5676f01] build-driver: copy sources.tar in release mode + * [b7d7f54] Rework wallpaper handling + * [d5a91e8] Update checked path for arch-specific boot addons + * [b1a8886] build-driver: delete grml_sources in results directory + * Software related changes: + - [22f12c8] Install openssh-client-ssh1 for DSA-keyed servers + - [4103307] install grml2usb on arm64, too + + [ Michael Prokop ] + * [8b0a6fa] Generate source package tarball when using SOURCES class + * [d77d042] Ensure files are copied with fcopy into chroot with expected + permissions + * [c950cbe] Remove deprecated + /etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot + * [83ec4f9] build-driver: ship ipxe + memtest86+; grml-live: fix + NO_ADDONS autodetection + * [fcfafac] Introduce architecture specific boot addon templates + * [c492657] Drop support for bsd4grml / NO_ADDONS_BSD4GRML + * [530ec9f] templates: drop deprecated boot addons from isolinux/grub + configs and grml-cheatcodes.txt + * [f81528f] templates/boot/grub/addons.cfg: drop duplicate Netboot.xyz + for non-efi + * [fdba3b2] Support UEFI 32bit boot on amd64 + * [ea0c92e] Fix logic around grml_sources handling no longer being bind- + mounted + + [ Darshaka Pathirana ] + * [de47ff8] GRUB theme: replace desktop-color with desktop-image + * [8becc73] Update Grml cheatcodes + clean up isolinux bootprompt + options + + -- Michael Prokop Thu, 19 Dec 2024 02:42:44 +0100 + +grml-live (0.49.3) unstable; urgency=medium + + [ Chris Hofstaedtler ] + * [205d589] grml-live: fix build only mode + * [c033554] build-driver: honor TMPDIR + * [d864226] grml-live: remove GRML_SMALL exclude of vmlinuz, initrd.img + * [7683e73] GHA: reindent + * [d5ad645] Run grml-live itself in GitHub test-build job + * [56b8b77] grml-live: strip xattrs in squashfs + * [9e3bd7a] GRMLBASE/45-grub-images: fix moddep.lst name in message + * [3c04ec5] GRMLBASE/15-initsetup: mask ldconfig.service + * [b04c36f] GHA: test build-only/release mode + * [f45341b] Initialize zsh caches so first startup on Live CD is faster + * [668880b] build-driver: fix SOURCES class gone missing + * Software related changes: + - [9e41bcd] GRML_FULL: stop precreating locales + + -- Michael Prokop Tue, 17 Dec 2024 08:57:35 +0100 + +grml-live (0.49.2) unstable; urgency=medium + + [ Michael Prokop ] + * [585437f] SW: replace dhcpcd with dhcpcd-base in DEBIAN_* + + [ Chris Hofstaedtler ] + * [63ec2cf] grml-live: update EFI image messages + * [d2927fb] grub: retitle grml boot menu entries + * [b0b979e] templates: replace GRUB boot theme + * [f97a1a2] grml-live: remove xorriso version check + * [3310807] grml-live: rewrite extend_string_end without expr + * [d8501fd] grml-live: remove dead extend_string_begin function + * [af9fb68] grml-live: write grmlmain.cfg in one go + * [8253e80] grml-live: stop manipulating CWD + * [fcbbf6a] grml-live: introduce hasclass helper function + * [a15735c] grml-live: always print requested configuration + * [d3540dd] GRUB templates: move non-addon entries out of addons.cfg + * [a2a16ec] grml-live: set NO_ADDONS=1 early if addons are absent + * [91425a3] grml-live: abort early if ARCH is unsupported + * [9e91be9] Drop support for syslinux from Debian wheezy + * [8d96a2e] Skip iso/pxe/syslinux on arm64 + * [9352fd6] GRMLBASE/94-update-smart-drivedb: drop + * [a2c1016] scripts: remove GRMLBASE/37-portmap + * [24961d1] scripts: remove workaround for 2009-era unfixed Debian bugs + * [4af3d12] scripts: remove iceweasel support + * [1a40680] scripts: assume timeout is always available + * [b373401] scripts: assume utmp,wtmp are on tmpfs /run + * [23ae643] build-driver: do not require cache_dir to exist already + * [8001621] build-driver: allow basefiles directory to already exist + * [352cbcb] build-driver: clarify an exception was caught + * [91e97af] build-driver: fix copying dpkg.list to cache dir + * [7a30c71] build-driver: clearly indicate success + * Software related changes: + * [73fb627] SW: GRML_FULL, GRML_SMALL: Stop installing reiserfsprogs + * [573d37d] SW: GRML_SMALL: apply same groups as in GRML_FULL + * [136531d] DEBIAN_TESTING: correct security.debian.org URL + * [97dfeff] SW: Install linux-sysctl-defaults on trixie and newer + * shellcheck QA improvements: + * [69b3638] GHA: setup shellcheck + * [a7fecfa] shellcheck: grml-live: fix quoting issues + * [a999792] shellcheck: annotate NOCOLORS usage + * [939a5f4] shellcheck: grml-live: concat $@ correctly + * [089cabd] shellcheck: grml-live: fix SC2166 + * [b484608] shellcheck: grml-live: ignore init-functions,lsb-functions sources + * [abd83c6] shellcheck: grml-live: do not trap SIGKILL + * [805dd42] grml-live: fix $? usage errors + * [581169c] grml-live: stop exporting SHORT_NAME + * [72f5e60] shellcheck: grml-live: fix SC2155 + * [ddc9552] shellcheck: grml-live: fix SC2162 + * [44112a5] shellcheck: grml-live: PIPESTATUS is an array + * [1eb3178] shellcheck: grml-live: ignore SC2164 in two places + * [6e77072] shellcheck: grml-live: use while/read instead of for find + * [583b3db] shellcheck: grml-live: fix one SC2010 case + * [4694d45] shellcheck: grml-live: ignore SC2010 in two cases + * [a8996f8] shellcheck: grml-live: fix SC2004 + * [59bfaee] shellcheck: grml-live: fix SC2018/SC2019 + * [5829fc8] shellcheck: grml-live: turn off two info messages + * [df3eedb] scripts: fix quoting issues found by shellcheck + * [9557a9d] remaster: fix quoting issues found by shellcheck + * [088dc5d] fai hooks: fix shellcheck issues + * [5eb2286] scripts: fix shellcheck issues + * [2ffb6cf] 45-grub-images: fix quoting + + -- Chris Hofstaedtler Sat, 07 Dec 2024 16:14:49 +0100 + +grml-live (0.49.1) unstable; urgency=medium + + [ Chris Hofstaedtler ] + * [8812d99] grml-live-remaster: always use xorriso + * [b8458a1] grml-live-remaster: drop support for ISOs < Dec 2018 + * [0736c3c] grml-live: drop support for mkisofs/genisoimage + * [36911b7] instsoft.GRMLBASE: fix error handler + * [971bd57] updatebase.GRMLBASE: allow all mounts to fail + * [7a56ca0] grml-live: use xorriso instead of mount -o loop in -e mode + * [2822a28] Import CI build drivers + * Software related changes: + - [fab9fdf] GRML_FULL: stop installing genisoimage + + -- Michael Prokop Sat, 23 Nov 2024 13:53:01 +0100 + +grml-live (0.49.0) unstable; urgency=medium + + [ Chris Hofstaedtler ] + * [e1acaf0] Remove grml-live-db and support for writing into it + * [4dcc9a0] CI: add job to build debian package + * [e25a5ee] debian: update Vcs-Git and Vcs-Browser + * [87524f9] SOURCES: move directory instead of bind-mounting it in + * [93399d3] get-sources: resolve source package names ourselves + * [5db208d] get-sources: run apt-get source parallelized + * [c1bc729] Add .github/FUNDING.yml + + [ Michael Prokop ] + * [009bb78] d/control: bump Standards-Version to 4.7.0 + * [374f949] debian: refresh lintian overrides + * [04be202] Secure Boot: update grub and shim binaries. Thanks to pasja + * [bca8c53] Ship debian/gbp.conf for gbp usage + * Software related changes: + - [7c890b4] add scdaemon to GRML_FULL + + -- Michael Prokop Fri, 22 Nov 2024 18:07:55 +0100 + grml-live (0.48.0) unstable; urgency=medium [ Michael Prokop ] diff --git a/debian/control b/debian/control index 6111e93fa..d30f3c518 100644 --- a/debian/control +++ b/debian/control @@ -8,9 +8,9 @@ Build-Depends-Indep: asciidoc, docbook-xsl, xsltproc, -Standards-Version: 4.6.2 +Standards-Version: 4.7.0 Homepage: https://grml.org/grml-live/ -Vcs-git: https://github.com/grml/grml-live.git +Vcs-Git: https://github.com/grml/grml-live.git Vcs-Browser: https://github.com/grml/grml-live Origin: Grml Bugs: mailto:bugs@grml.org @@ -23,23 +23,15 @@ Depends: debootstrap, dosfstools, fai-client (>= 3.4.0), - isolinux (>= 3:6.03+dfsg-5+deb8u1~), jo, moreutils, mtools, - pciutils, rsync, squashfs-tools (>= 1:4.2-0~bpo60), - syslinux | syslinux-efi, xorriso, ${misc:Depends}, Recommends: - grml-live-db, - grub-pc-bin, imagemagick, - ipxe, - memtest86+, - syslinux-utils, Suggests: fai-doc, grml-live-addons, @@ -47,20 +39,3 @@ Description: build system for creating a Grml (based) Linux live system This package provides the build system for creating a Debian / Grml based Linux live system (also known as live cd). It is based on the FAI (Fully Automatic Installation) framework. - -Package: grml-live-db -Architecture: all -Depends: - grml-live, - libdbd-sqlite3-perl, - libdbi-perl, - libtimedate-perl, - sqlite3, - ${misc:Depends}, -Recommends: - perl-doc, -Description: log package build information of grml-live to database - This package provides a database layer for storing build - information about grml-live builds in a sqlite3 database. - More details are available in the provided grml-live-db manpage - and /usr/share/doc/grml-live-db/grml-live-db.html diff --git a/debian/copyright b/debian/copyright index f47ca9f78..88ab873c0 100644 --- a/debian/copyright +++ b/debian/copyright @@ -7,7 +7,7 @@ Files: * Copyright: 2007-2023 Michael Prokop License: GPL-2+ -Files: fonts/graphicoreBitmapFont0-Light.otf +Files: templates/wallpaper/graphicoreBitmapFont0-Light.otf Copyright: 2010, Lasse Fister lasse@graphicore.de License: SIL diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 000000000..c30995ae1 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,8 @@ +[DEFAULT] +debian-tag = v%(version)s + +# Options only affecting "gbp dch" +[dch] +id-length = 7 +meta = True +multimaint-merge = True diff --git a/debian/grml-live-db.doc-base b/debian/grml-live-db.doc-base deleted file mode 100644 index 2eab61882..000000000 --- a/debian/grml-live-db.doc-base +++ /dev/null @@ -1,10 +0,0 @@ -Document: grml-live-db -Title: Documentation for the database wrapper of grml-live -Author: Michael Prokop -Abstract: grml-live-db provides a database layer for storing build - information about grml-live builds in a sqlite3 database. -Section: Debian - -Format: HTML -Index: /usr/share/doc/grml-live-db/grml-live-db.html -Files: /usr/share/doc/grml-live-db/grml-live-db.html diff --git a/debian/grml-live-db.docs b/debian/grml-live-db.docs deleted file mode 100644 index 1443038a8..000000000 --- a/debian/grml-live-db.docs +++ /dev/null @@ -1 +0,0 @@ -docs/grml-live-db.html diff --git a/debian/grml-live-db.install b/debian/grml-live-db.install deleted file mode 100644 index 7631f556e..000000000 --- a/debian/grml-live-db.install +++ /dev/null @@ -1,2 +0,0 @@ -db/db-to-fai usr/share/grml-live-db/scripts/ -db/dpkg-to-db usr/share/grml-live-db/scripts/ diff --git a/debian/grml-live-db.lintian-overrides b/debian/grml-live-db.lintian-overrides deleted file mode 100644 index 0c19f9e6a..000000000 --- a/debian/grml-live-db.lintian-overrides +++ /dev/null @@ -1,2 +0,0 @@ -grml-live-db: unknown-section grml -grml-live-db: bugs-field-does-not-refer-to-debian-infrastructure mailto:bugs@grml.org diff --git a/debian/grml-live-db.manpages b/debian/grml-live-db.manpages deleted file mode 100644 index 1be5958f4..000000000 --- a/debian/grml-live-db.manpages +++ /dev/null @@ -1 +0,0 @@ -docs/grml-live-db.8 diff --git a/debian/grml-live.install b/debian/grml-live.install index a9cfbac79..afd69548d 100644 --- a/debian/grml-live.install +++ b/debian/grml-live.install @@ -2,13 +2,15 @@ docs/grml-live-remaster.8 usr/share/man/man8/ docs/grml-live.8 usr/share/man/man8/ etc/grml etc examples usr/share/doc/grml-live/ -fonts usr/share/grml-live/ grml-live usr/sbin/ remaster/grml-live-remaster usr/sbin/ +config usr/share/grml-live/ scripts usr/share/grml-live/ templates/EFI usr/share/grml-live/templates/ templates/GRML usr/share/grml-live/templates/ templates/boot/grub usr/share/grml-live/templates/boot/ templates/boot/isolinux usr/share/grml-live/templates/boot/ templates/secureboot usr/share/grml-live/templates/ +templates/wallpaper usr/share/grml-live/templates/ templates/windows usr/share/grml-live/templates/ +usr/share/zsh/vendor-completions/_grml-live usr/share/zsh/vendor-completions/ diff --git a/debian/grml-live.lintian-overrides b/debian/grml-live.lintian-overrides index bfc60e028..c216e07c4 100644 --- a/debian/grml-live.lintian-overrides +++ b/debian/grml-live.lintian-overrides @@ -1,7 +1,7 @@ grml-live: bugs-field-does-not-refer-to-debian-infrastructure mailto:bugs@grml.org -grml-live: executable-not-elf-or-script usr/share/grml-live/templates/windows/autostart/autorun.inf -grml-live: privacy-breach-generic usr/share/grml-live/templates/GRML/index.html [] (http://grml.org/) +grml-live: executable-not-elf-or-script [usr/share/grml-live/templates/windows/autostart/autorun.inf] +grml-live: privacy-breach-generic [] (http://grml.org/) [usr/share/grml-live/templates/GRML/index.html] grml-live: unknown-section grml -grml-live: uses-dpkg-database-directly etc/grml/fai/config/hooks/instsoft.GRMLBASE -grml-live: uses-dpkg-database-directly etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot -grml-live: uses-dpkg-database-directly usr/sbin/grml-live +grml-live: uses-dpkg-database-directly [usr/share/grml-live/config/hooks/instsoft.GRMLBASE] +grml-live: uses-dpkg-database-directly [usr/share/grml-live/config/scripts/GRMLBASE/98-clean-chroot] +grml-live: uses-dpkg-database-directly [usr/sbin/grml-live] diff --git a/debian/grml-live.maintscript b/debian/grml-live.maintscript index 59e8b54fc..02cdb10e3 100644 --- a/debian/grml-live.maintscript +++ b/debian/grml-live.maintscript @@ -1,9 +1,140 @@ +rm_conffile /etc/grml/fai/config/class/GRMLBASE.var 0.51.0~ +rm_conffile /etc/grml/fai/config/debconf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/apt.conf.d/20pdiffs/GRMLBASE 0.51.0~ rm_conffile /etc/grml/fai/config/files/etc/apt/grml.key/GRMLBASE 0.32.3~ +rm_conffile /etc/grml/fai/config/files/etc/apt/preferences/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BOOKWORM 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_BULLSEYE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID 0.47.10~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TRIXIE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/grml-live.list/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/apt/trusted.gpg.d/grml-archive-keyring.gpg/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/cloud/cloud.cfg.d/42_grml.cfg/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/default/console-setup/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/firefox-esr/firefox-esr.js/GRML_FULL 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/fstab/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/hosts/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/init.d/bootlocal.first/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/init.d/bootlocal.last/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/init.d/bootlocal.middle/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/initramfs-tools/hooks/000-udev-shutup/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/initramfs-tools/modules/GRMLBASE 0.51.0~ rm_conffile /etc/grml/fai/config/files/etc/inittab/GRMLBASE 0.43.0~ rm_conffile /etc/grml/fai/config/files/etc/inittab/GRML_SMALL 0.43.0~ +rm_conffile /etc/grml/fai/config/files/etc/locale.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/locale.gen/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/locale.gen/GRML_FULL 0.49.3~ +rm_conffile /etc/grml/fai/config/files/etc/locale.gen/LOCALES 0.51.0~ rm_conffile /etc/grml/fai/config/files/etc/lsb-base-logging.sh/GRMLBASE 0.42.3~ +rm_conffile /etc/grml/fai/config/files/etc/modprobe.d/loop-part.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/modprobe.d/modesetting.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/modprobe.d/vmwgfx.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/modules/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/motd/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/network/interfaces/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/rsyslog.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/runlevel.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/sudoers/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/logind.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system-preset/10-grml.preset/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty1.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty10.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty11.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty12.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty2.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty3.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty4.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty5.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty6.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/getty@tty7.service.d/override.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/grml-boot.target/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/serial-getty@.service.d/override.conf/GRMLBASE 0.51.0~ rm_conffile /etc/grml/fai/config/files/etc/systemd/system/serial-getty@ttyS0.service.d/override.conf/GRMLBASE 0.33.2~ +rm_conffile /etc/grml/fai/config/files/etc/systemd/system/ssh.service/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/etc/tmpfiles.d/man-db.conf/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/usr/share/doc/grml-docs/startpage.html/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/files/usr/share/grml/desktop-bg.png/GRMLBASE 0.49.4~ +rm_conffile /etc/grml/fai/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/grml/squashfs-excludes 0.51.0~ +rm_conffile /etc/grml/fai/config/hooks/instsoft.GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/hooks/instsoft.ZFS 0.51.0~ +rm_conffile /etc/grml/fai/config/hooks/savelog.LAST.source 0.51.0~ +rm_conffile /etc/grml/fai/config/hooks/updatebase.GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/DEBIAN_BOOKWORM 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/DEBIAN_STABLE 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/DEBIAN_TESTING 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/DEBIAN_TRIXIE 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/DEBIAN_UNSTABLE 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/GRMLBASE 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/GRML_FULL 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/GRML_SMALL 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/IGNORE 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/LATEX 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/XORG 0.51.0~ +rm_conffile /etc/grml/fai/config/package_config/ZFS 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/01-packages 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/02-run 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/03-get-sources 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/05-hostname 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/15-initsetup 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/16-depmod 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/18-timesetup 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/20-sudo 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/21-usersetup 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/25-locales 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/26-console-setup 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/30-fstab 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/31-motd 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/32-xorg 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/34-hosts 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/35-network 0.51.0~ rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/36-cpufrequtils 0.33.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/37-portmap 0.49.2~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/38-udev 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/39-modprobe 0.51.0~ rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/40-deborphan 0.35.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/41-modules 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/42-branding 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/43-rsyslog 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/44-grub 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/45-grub-images 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/46-grml-version 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/47-update-wallpaper 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/49-sshd 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/50-lvm 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/51-cloud-init 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/52-mdadm 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/55-aoetools 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/80-initramfs 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/85-systemd 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam 0.51.0~ rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/93-update-usbids 0.45.0~ -rm_conffile /etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID 0.47.10~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/94-update-smart-drivedb 0.49.2~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/95-package-information 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRML_FULL/01-firefox 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot 0.49.4~ +rm_conffile /etc/grml/fai/config/scripts/LATEX/98-clean-chroot 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/RELEASE/98-clean-chroot 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/RELEASE/99-update-wallpaper 0.51.0~ +rm_conffile /etc/grml/fai/config/scripts/REMOVE_DOCS/98-clean-chroot 0.51.0~ +rm_conffile /etc/grml/fai/fai.conf 0.51.0~ +rm_conffile /etc/zsh/completion.d/_grml-live 0.51.0~ diff --git a/debian/rules b/debian/rules index ac278d382..bce486a44 100755 --- a/debian/rules +++ b/debian/rules @@ -21,11 +21,8 @@ override_dh_install: sed -i -e "s/GRML_LIVE_VERSION='\*\*\*UNRELEASED\*\*\*'/GRML_LIVE_VERSION='$(DEB_VERSION)'/" grml-live find . -name grml-live.8 dh_install - # zsh completion - dh_install etc/zsh/completion.d/_grml-live usr/share/zsh/vendor-completions override_dh_clean: - rm -f docs/grml-live-db.8 docs/grml-live-db.html docs/grml-live-db.xml rm -f docs/grml-live-remaster.8 docs/grml-live-remaster.html docs/grml-live-remaster.xml rm -f docs/grml-live.8 docs/grml-live.html docs/grml-live.xml rm -f docs/html-stamp docs/man-stamp @@ -34,4 +31,4 @@ override_dh_clean: override_dh_fixperms: dh_fixperms # make sure they are executable: - chmod 755 debian/grml-live/etc/grml/fai/config/hooks/* + chmod 755 debian/grml-live/usr/share/grml-live/config/hooks/* diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index 7ff4d528e..7a8c6b7e5 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -1,4 +1,4 @@ -grml-live source: source-contains-prebuilt-windows-binary templates/EFI/debian/BOOT/grubx64.efi.signed -grml-live source: source-contains-prebuilt-windows-binary templates/EFI/debian/BOOT/shimx64.efi.signed -grml-live source: source-contains-prebuilt-windows-binary templates/EFI/ubuntu/BOOT/grubx64.efi.signed -grml-live source: source-contains-prebuilt-windows-binary templates/EFI/ubuntu/BOOT/shimx64.efi.signed +grml-live source: source-contains-prebuilt-windows-binary [templates/EFI/debian/BOOT/grubx64.efi.signed] +grml-live source: source-contains-prebuilt-windows-binary [templates/EFI/debian/BOOT/shimx64.efi.signed] +grml-live source: source-contains-prebuilt-windows-binary [templates/EFI/ubuntu/BOOT/grubx64.efi.signed] +grml-live source: source-contains-prebuilt-windows-binary [templates/EFI/ubuntu/BOOT/shimx64.efi.signed] diff --git a/docs/Makefile b/docs/Makefile index 47f514ae1..42bd4bd2e 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -11,10 +11,9 @@ icons: cp /usr/share/asciidoc/icons/note.png images/icons/ cp /usr/share/asciidoc/icons/tip.png images/icons/ -html-stamp: grml-live.txt grml-live-remaster.txt grml-live-db.txt +html-stamp: grml-live.txt grml-live-remaster.txt asciidoc -b xhtml11 -a icons -a toc -a numbered grml-live.txt asciidoc -b xhtml11 -a icons grml-live-remaster.txt - asciidoc -b xhtml11 -a icons grml-live-db.txt touch html-stamp doc_man: man-stamp @@ -24,8 +23,6 @@ man-stamp: grml-live.txt grml-live-remaster.txt xsltproc --novalid /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-live.xml asciidoc -d manpage -b docbook grml-live-remaster.txt xsltproc --novalid /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-live-remaster.xml - asciidoc -d manpage -b docbook grml-live-db.txt - xsltproc --novalid /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-live-db.xml touch man-stamp doc_epub: epub-stamp @@ -52,5 +49,4 @@ clean: rm -rf images/icons rm -f grml-live-remaster.html grml-live-remaster.xml grml-live-remaster.8 rm -f grml-live.html grml-live.xml grml-live.8 grml-live.epub grml-live.pdf - rm -f grml-live-db.html grml-live-db.xml grml-live-db.8 rm -f html-stamp man-stamp epub-stamp pdf-stamp diff --git a/docs/grml-live-db.txt b/docs/grml-live-db.txt deleted file mode 100644 index 88c6bfca8..000000000 --- a/docs/grml-live-db.txt +++ /dev/null @@ -1,107 +0,0 @@ -grml-live-db(8) -=============== - -Name ----- -grml-live-db - log package build information of grml-live to database - -Synopsis --------- -dpkg-to-db [ options ] || db-to-fai /path/to/grml-live.db - -Introduction ------------- - -The grml-live-db Debian package provides a simple way to put build information -of grml-live into a database. By default you have to do nothing but install -grml-live-db and during each invocation of grml-live you'll get an additional -entry in the sqlite3 database /var/log/grml-live.db. If you want to customize -the database logging check out the following sections in this manpage. - -Provided scripts ----------------- - -/usr/share/grml-live-db/scripts/dpkg-to-db adds grml-live build information -(output of 'dpkg --list') and a logfile into a sqlite3 database. This script is -used by default if grml-live-db is installed (no configuration needed by -default). - -/usr/share/grml-live-db/scripts/db-to-fai converts output of grml-live's sqlite -database for use within FAI. This script is useful if you want to reproduce a -certain build with specific package versions. Please note that you need the -according Debian mirrors providing all the specific package versions of course. - -Options -------- - -dpkg-to-db supports the following options (and all except for --help -are mandatory!): - - --help - -Print help message and exit. - - --database - -Use specified database file. - - --dpkg - -Use specified dpkgfile as `dpkg --list` output file of grml-live build. - - --logfile - -Logfile thath should be added to the database entry. - - --flavour - -Name of the grml-live flavour that was being built. - -The db-to-fai script does not support any options but needs to be invoked with -path to the grml-live database and the build id. - -Configuration and using custom database wrapper scripts -------------------------------------------------------- - -The following configuration variables are available and can be adjusted: - - DPKG_DATABASE=/var/log/grml-live.db - -Path to the database file that should be used for storing the build information. -This database is used within dpkg-to-db by default. - - DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db - -The database wrapper script that's used for storing the build information. -If you do not want to log to the sqlite3 database but instead use your own -abstraction layer just point this variable to your favourite script. - - DPKG_DBOPTIONS="--database $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME --dpkg $DPKG_LIST" - -If the database script ($DPKG_DBSCRIPT) requires any command line options -specify it through this variable. - -Usage Examples --------------- - -How dpkg-to-db is being used inside grml-live: - - /usr/share/grml-live-db/scripts/dpkg-to-db --database /var/log/grml-live.db --logfile /var/log/grml-live.log --flavour $GRML_NAME --dpkg /var/log/fai/$HOSTNAME/last/dpkg.list - -Manually insert data to database: - - # /usr/share/grml-live-db/scripts/dpkg-to-db --database ./grml-live.db --logfile /tmp/logfile --flavour grml-full --dpkg ./dpkg.list - -Retrieve build information of a specific build for use within FAI: - - # /usr/share/grml-live-db/scripts/db-to-fai /var/log/grml-live.db 6 > /etc/grml/fai/config/package_config/REPRODUCE - -Describe schema of database: - - # echo '.schema' | sqlite3 /var/log/grml-live.db - -Database queries: - - # echo 'SELECT package,version,status,build.flavour,build.identifier FROM packages, build WHERE build.identifier = "grml-full-20091213012517" AND packages.build = build.id ; ' | sqlite3 /var/log/grml-live.db - - # echo 'SELECT package,version,status,build.flavour,build.identifier FROM packages, build WHERE build.id = 7 AND packages.build = build.id ; ' | sqlite3 /var/log/grml-live.db diff --git a/docs/grml-live.txt b/docs/grml-live.txt index 030bdab01..583b6e026 100644 --- a/docs/grml-live.txt +++ b/docs/grml-live.txt @@ -33,7 +33,7 @@ to include on your very own Linux Live-CD without having to deal with all the details of a build process. CAUTION: grml-live does **not** use /etc/fai for configuration but instead -provides and uses ${GRML_FAI_CONFIG} which is pointing to /etc/grml/fai by default +provides and uses ${GRML_FAI_CONFIG} which is /usr/share/grml-live/config by default (unless overridden using the ''-D'' option). This ensures that it does not clash with default FAI configuration and packages, so you can use grml-live and FAI completely independent at the same time! @@ -106,9 +106,9 @@ Please notice that all configuration files have to be adjusted during execution of grml-live, so please make sure you use /etc/grml/grml-live.conf as a base for your own configuration file (usually /etc/grml/grml-live.local). Please also notice that the configuration file specified via this option is **not** (yet) -supported inside the scripts/hooks/classes at ${GRML_FAI_CONFIG}/config. Instead use +supported inside the scripts/hooks/classes at ${GRML_FAI_CONFIG}. Instead use /etc/grml/grml-live.local for configuration stuff used inside -${GRML_FAI_CONFIG}/config. +${GRML_FAI_CONFIG}. -d **DATE**:: @@ -122,13 +122,13 @@ advance. Usage example: '-d 2009-10-30' -D **CONFIGURATION_DIRECTORY**:: -The specified directory is used as configuration directory for grml-live and its -FAI. By default /etc/grml/fai is used as default configuration directory. If -you want to have different configuration scripts, package definitions, etc. with -without messing with the global configuration under /etc/grml/fai provided by -grml-live this option provides you the option to use your own configuration -directory. This directory is what's being referred to as ${GRML_FAI_CONFIG} -throughout this documentation. +The specified directory is used as configuration directory for grml-live and FAI. +By default /usr/share/grml-live/config is used as default configuration directory. +If you want to have different configuration scripts, package definitions, etc. +without messing with the global configuration under /usr/share/grml-live/config +provided by grml-live this option provides you the option to use your own +configuration directory. +This directory is what's being referred to as ${GRML_FAI_CONFIG} throughout this documentation. -e **EXTRACT_ISO_NAME**:: @@ -204,7 +204,7 @@ Specify the Debian suite you want to use for your live-system. If unset defaults to "testing". Supported values are: stable, testing, unstable (or their corresponding release names like "bookworm"). Please be aware that recent Debian suites might require a recent base.tgz -(${GRML_FAI_CONFIG}/config/basefiles/$CLASSNAME.tar.gz) or a recent version of +(${GRML_FAI_CONFIG}/basefiles/$CLASSNAME.tar.gz) or a recent version of debootstrap. -t **TEMPLATE_DIRECTORY**:: @@ -301,11 +301,11 @@ grml-live, as well as the architecture dependent class which provides the kernel class (like GRML_SMALL or GRML_FULL). The following files and directories are relevant for class GRMLBASE by default: - ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/ - ${GRML_FAI_CONFIG}/config/debconf/GRMLBASE - ${GRML_FAI_CONFIG}/config/class/GRMLBASE.var - ${GRML_FAI_CONFIG}/config/hooks/instsoft.GRMLBASE - ${GRML_FAI_CONFIG}/config/package_config/GRMLBASE + ${GRML_FAI_CONFIG}/scripts/GRMLBASE/ + ${GRML_FAI_CONFIG}/debconf/GRMLBASE + ${GRML_FAI_CONFIG}/class/GRMLBASE.var + ${GRML_FAI_CONFIG}/hooks/instsoft.GRMLBASE + ${GRML_FAI_CONFIG}/package_config/GRMLBASE Take a look at the next section for information about the concept of those files/directories. @@ -326,8 +326,8 @@ Available classes ----------------- The package selection part of the classes can be found in -${GRML_FAI_CONFIG}/config/package_config whereas some further classes are defined for -example in ${GRML_FAI_CONFIG}/config/scripts/ so specific feature sets can be +${GRML_FAI_CONFIG}/package_config whereas some further classes are defined for +example in ${GRML_FAI_CONFIG}/scripts/ so specific feature sets can be selected. The following classes are predefined: * DEBORPHAN: get rid of "autoremove" and "removed-but-not-yet-purged" packages; @@ -393,12 +393,12 @@ Files Notice that grml-live ships FAI configuration files that do not use the same namespace as the FAI packages itself. This ensures that grml-live does not clash -with your usual FAI configuration, so instead of /etc/fai/fai.conf (package -fai-client) grml uses ${GRML_FAI_CONFIG}/fai.conf instead. For more details see -below. To get an idea how another configuration or example files could look like -check out /usr/share/doc/fai-doc/examples/simple/ (provided by Debian package -fai-doc). Furthermore /usr/share/doc/fai-doc/fai-guide.html/ch-config.html -provides documentation regarding configuration possibilities. +with your usual FAI configuration. +For more details see below. To get an idea how another configuration or example +files could look like check out /usr/share/doc/fai-doc/examples/simple/ +(provided by Debian package fai-doc). Furthermore +/usr/share/doc/fai-doc/fai-guide.html/ch-config.html provides documentation +regarding configuration possibilities. /usr/sbin/grml-live @@ -418,36 +418,27 @@ over the ones from /etc/grml/grml-live.conf. If you want to override settings from /etc/grml/grml-live.local as well you have to specify them on the grml-live commandline. - ${GRML_FAI_CONFIG}/fai.conf - -Main configuration file for FAI which specifies where all the configuration -files and scripts for FAI/grml-live can be found. By default the configuration -variables are FAI_CONFIG_SRC=file:///etc/grml/fai/config and -GRML_FAI_CONFIG=/etc/grml/fai/config - both pointing to a directory shipped by -grml-live out-of-the-box so you shouldn't have to configure anything in this -file. - - ${GRML_FAI_CONFIG}/config/ + ${GRML_FAI_CONFIG}/ The main directory for configuration of FAI/grml-live. More details below. - ${GRML_FAI_CONFIG}/config/class/ + ${GRML_FAI_CONFIG}/class/ This directory contains files which specify main configuration variables for the FAI classes. - ${GRML_FAI_CONFIG}/config/debconf/ + ${GRML_FAI_CONFIG}/debconf/ This directory provides the files for preseeding/configuration of debconf through files. - ${GRML_FAI_CONFIG}/config/hooks/ + ${GRML_FAI_CONFIG}/hooks/ This directory provides files for customising the build process through hooks. Hooks are user defined programs or scripts, which are called during the installation process. - ${GRML_FAI_CONFIG}/config/package_config/ + ${GRML_FAI_CONFIG}/package_config/ Directory with lists of software packages to be installed or removed. The different classes describe what should find its way to your ISO. When running @@ -459,7 +450,7 @@ adjust the package selection according to your needs. Please notice that the directory GRMLBASE contains a package list defining a minimum but still reasonable package configuration. - ${GRML_FAI_CONFIG}/config/scripts/ + ${GRML_FAI_CONFIG}/scripts/ Scripts for customising the ISO within the build process. @@ -546,25 +537,27 @@ Instructions apt-get -o Acquire::AllowInsecureRepositories=true update apt-get --allow-unauthenticated install grml-debian-keyring + cp -rv /usr/share/grml-live/config /srv # optionally(!) install basefile so we don't have to build basic - # chroot from scratch, grab from http://daily.grml.org/ - # mkdir -p /etc/grml/fai/config/basefiles/ - # mv I386.tar.gz /etc/grml/fai/config/basefiles/ - # mv AMD64.tar.gz /etc/grml/fai/config/basefiles/ - # mv ARM64.tar.gz /etc/grml/fai/config/basefiles/ + # chroot from scratch. best build them with mmdebstrap. + # mkdir -p /srv/config/basefiles/ + # mv I386.tar.gz /srv/config/basefiles/ + # mv AMD64.tar.gz /srv/config/basefiles/ + # mv ARM64.tar.gz /srv/config/basefiles/ # install relevant tools apt-get --no-install-recommends install grml-live # adjust grml-live configuration for our needs: cat > /etc/grml/grml-live.local << EOF + GRML_LIVE_CONFIG=/srv/config ## want a faster build process and don't need smaller ISOs? ## if so use zlib compression # SQUASHFS_OPTIONS="-comp gzip -b 256k" ## want to use a specific squashfs binary? # SQUASHFS_BINARY='/usr/bin/mksquashfs' ## install local files into the chroot - # CHROOT_INSTALL="/etc/grml/fai/chroot_install" + # CHROOT_INSTALL="/srv/config/chroot_install" ## adjust if necessary (defaults to ./grml/): ## OUTPUT="/srv/grml-live" FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian/" @@ -572,14 +565,6 @@ Instructions CLASSES="GRMLBASE,GRML_FULL,AMD64" EOF - # just optional(!) - upgrade FAI to latest available version: - cat >> /etc/apt/sources.list.d/fai.list << EOF - deb http://jenkins.grml.org/debian fai main - deb-src http://jenkins.grml.org/debian fai main - EOF - - # get gpg key of FAI repos and install current FAI version: - wget -O - http://jenkins.grml.org/debian/C525F56752D4A654.asc | sudo apt-key add - apt-get update apt-get install fai-client fai-server fai-doc @@ -594,11 +579,12 @@ and the ISO can be found inside /grml-live/grml-live/grml_isos/ then. What is $GRML_FAI_CONFIG? ~~~~~~~~~~~~~~~~~~~~~~~~~ -The variable '$GRML_FAI_CONFIG' is pointing to the directory /etc/grml/fai by -default. To provide you a maximum of flexibility you can set up your own -configuration directory (e.g. based on /etc/grml/fai) and use this directory -running grml-live with the '-D ' option. Now '$GRML_FAI_CONFIG' -points to the specified directory instead of using /etc/grml/fai and all the +The variable '$GRML_FAI_CONFIG' is pointing to the directory /usr/share/grml-live/config +by default. +To provide you a maximum of flexibility you can set up your own configuration directory +(e.g. based on /usr/share/grml-live/config) and use +this directory running grml-live with the '-D ' option. +Now '$GRML_FAI_CONFIG' points to the specified directory and all the configuration files, scripts and hooks will be taken from your '$GRML_FAI_CONFIG' directory. @@ -628,10 +614,13 @@ provides the files you would like to install. Note that the files are installed under '/' in the chroot - so you have to create the rootfs structure on your own. Usage example: + GRML_FAI_CONFIG=/srv/config + echo "GRML_FAI_CONFIG=$GRML_FAI_CONFIG" >> /etc/grml/grml-live.local echo "CHROOT_INSTALL=\$GRML_FAI_CONFIG/chroot_install" >> /etc/grml/grml-live.local - mkdir -p /etc/grml/fai/chroot_install/usr/src/ + mkdir -p $GRML_FAI_CONFIG/chroot_install/usr/src/ + cp -rv /usr/share/grml-live/config/* $GRML_FAI_CONFIG wget example.org/foo.tar.gz - mv foo.tar.gz /etc/grml/fai/chroot_install/usr/src/ + mv foo.tar.gz $GRML_FAI_CONFIG/chroot_install/usr/src/ grml-live ... [[local-debian-mirror]] @@ -639,7 +628,7 @@ Can I use my own (local) Debian mirror? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Yes. Set up an according sources.list configuration as class file in -${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/ and adjust the variable +${GRML_FAI_CONFIG}/files/etc/apt/sources.list.d/ and adjust the variable FAI_DEBOOTSTRAP (if not already using a base.tgz) inside /etc/grml/grml-live.conf[.local]. If you're setting up your own class file don't forget to include the class name in the class list (grml-live -c ...). @@ -657,7 +646,7 @@ How do I add additional Debian package(s) to my CD/ISO? Just create a new class (using the package_config directory): - # cat > /etc/grml/fai/config/package_config/MIKA << EOF + # cat > $GRML_FAI_CONFIG/package_config/MIKA << EOF PACKAGES install vim @@ -673,11 +662,17 @@ and specify it when invoking grml-live then: I fscked up my grml-live configuration. How do I reset it to the defaults? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Notice: this deletes all your grml-live configuration files. If that's really -what you are searching for just run: +If you make changes to the grml-live configuration files, it is recommended +you copy them to a new directory, set GRML_FAI_CONFIG and modify them there. + +If you modified them inside /usr/share/grml-live, you can just reinstall +grml-live: + + # apt remove grml-live + # apt install grml-live - rm -rf /etc/grml/fai /etc/grml/grml-live.conf - dpkg -i --force-confnew --force-confmiss /path/to/grml-live_..._all.deb +Note: modified files in /usr/share/grml-live will not survive upgrades of +grml-live. [[apt-cacher]] Set up apt-cacher-ng for use with grml-live @@ -690,7 +685,7 @@ FAI_DEBOOTSTRAP: [...] APT_PROXY="http://localhost:3142/" [...] - FAI_DEBOOTSTRAP="bookworm http://localhost:3142/ftp.debian.org/debian bookworm main contrib non-free" + FAI_DEBOOTSTRAP="bookworm http://localhost:3142/deb.debian.org/debian bookworm main contrib non-free" Make sure apt-cacher-ng is running ('/etc/init.d/apt-cacher-ng restart'). That's it. All downloaded files will be cached in /var/cache/apt-cacher-ng then. @@ -714,7 +709,7 @@ then invoke debootstrap using the '--arch i386' option. Disclaimer: building an AMD64 base.tgz won't work if you are using a 32bit kernel system of course. Also building an ARM64 base.tgz requires an arm64 system. -Finally place the generated tarball in /etc/grml/fai/config/basefiles/ (note +Finally place the generated tarball in $GRML_FAI_CONFIG/basefiles/ (note that it needs to be uppercase letters matching the class names, so: e.g. AMD64.tar.gz for amd64, I386.tar.gz for i386 or ARM64.tar.gz for arm64). @@ -722,7 +717,7 @@ Then executing grml-live should use this file as base system instead of executin debootstrap. Check out the output for something like: [...] - ftar: extracting //etc/grml/fai/config/basefiles///AMD64.tar.gz to /srv/grml64_testing/grml_chroot// + ftar: extracting //srv/config/basefiles///AMD64.tar.gz to /srv/grml64_testing/grml_chroot// [...] [[localrepos]] @@ -740,7 +735,7 @@ Serving via bind mount / MIRROR_DIRECTORY Make sure to create an according sources.list configuration file, e.g. using your own class name `CUSTOM`: - # cat > /etc/grml/fai/config/files/etc/apt/sources.list.d/local-packages.list/CUSTOM << EOF + # cat > $GRML_FAI_CONFIG/files/etc/apt/sources.list.d/local-packages.list/CUSTOM << EOF deb file:///home/foobar/local-packages ./ EOF @@ -762,7 +757,7 @@ Serving a repository via HTTP Make sure to create an according sources.list configuration file, e.g. using your own class name `CUSTOM`: - # cat > /etc/grml/fai/config/files/etc/apt/sources.list.d/local-packages.list/CUSTOM << EOF + # cat > $GRML_FAI_CONFIG/files/etc/apt/sources.list.d/local-packages.list/CUSTOM << EOF deb http://127.0.0.1:8000/ ./ EOF @@ -808,7 +803,7 @@ In case you want to run grml-live directly from the git repository checkout b) does not use the config files of an possibly installed `grml-live` package. Usage example: - # export GRML_FAI_CONFIG=$(pwd)/etc/grml/fai + # export GRML_FAI_CONFIG=$(pwd)/config # export SCRIPTS_DIRECTORY=$(pwd)/scripts # export TEMPLATE_DIRECTORY=$(pwd)/templates # ./grml-live -s sid -a amd64 -c GRMLBASE,GRML_FULL,AMD64 diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH deleted file mode 100644 index f9908e826..000000000 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH +++ /dev/null @@ -1,3 +0,0 @@ -# official debian repository: - deb http://ftp.debian.org/debian/ etch main contrib non-free - deb-src http://ftp.debian.org/debian/ etch main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING deleted file mode 100644 index 9b6ef428b..000000000 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING +++ /dev/null @@ -1,7 +0,0 @@ -# official debian repository: - deb http://ftp.debian.org/debian/ testing main contrib non-free-firmware non-free - deb-src http://ftp.debian.org/debian/ testing main contrib non-free-firmware non-free - -# security updates: - deb http://security.debian.org/ testing-security main contrib non-free-firmware non-free - deb-src http://security.debian.org/ testing-security main contrib non-free-firmware non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE deleted file mode 100644 index f280307b3..000000000 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_UNSTABLE +++ /dev/null @@ -1,3 +0,0 @@ -# official debian repository: - deb http://ftp.debian.org/debian/ unstable main contrib non-free-firmware non-free - deb-src http://ftp.debian.org/debian/ unstable main contrib non-free-firmware non-free diff --git a/etc/grml/fai/config/files/etc/init.d/bootlocal.first/GRMLBASE b/etc/grml/fai/config/files/etc/init.d/bootlocal.first/GRMLBASE deleted file mode 100755 index da45e0c78..000000000 --- a/etc/grml/fai/config/files/etc/init.d/bootlocal.first/GRMLBASE +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# This file is NOT upgraded during system upgrades. -# You can use it to customize the boot process. -# bootlocal.first is executed in runlevel 'S', at the very beginning. -################################################################################ - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/config/files/etc/init.d/bootlocal.last/GRMLBASE b/etc/grml/fai/config/files/etc/init.d/bootlocal.last/GRMLBASE deleted file mode 100755 index 3a62be755..000000000 --- a/etc/grml/fai/config/files/etc/init.d/bootlocal.last/GRMLBASE +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# This file is NOT upgraded during system upgrades. -# You can use it to customize the boot process. -# bootlocal.last is executed in runlevel '2', at the very end. -################################################################################ - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/config/files/etc/init.d/bootlocal.middle/GRMLBASE b/etc/grml/fai/config/files/etc/init.d/bootlocal.middle/GRMLBASE deleted file mode 100755 index b508cd78d..000000000 --- a/etc/grml/fai/config/files/etc/init.d/bootlocal.middle/GRMLBASE +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# This file is NOT upgraded during system upgrades. -# You can use it to customize the boot process. -# bootlocal.middle is executed in runlevel '2', right before grml-autoconfig. -################################################################################ - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/config/files/etc/initramfs-tools/hooks/000-udev-shutup/GRMLBASE b/etc/grml/fai/config/files/etc/initramfs-tools/hooks/000-udev-shutup/GRMLBASE deleted file mode 100755 index f1255112c..000000000 --- a/etc/grml/fai/config/files/etc/initramfs-tools/hooks/000-udev-shutup/GRMLBASE +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -# This file is installed by grml-live in 10-build-initramfs. -# It's purpose is to shut up so called "cosmetic warnings" -# introduced in udev 168-1. - -PREREQ="" -prereqs() -{ - echo "$PREREQ" -} -case $1 in -prereqs) - prereqs - exit 0 - ;; -esac - -# Restrict this to the known problematic version. -UDEV_VERSION=$(dpkg-query -W -f '${Version}' udev) -if [ "$UDEV_VERSION" != "168-1" ]; then - exit 0 -fi - -. /usr/share/initramfs-tools/hook-functions - -TMPFILE=$(mktemp) - -cat >$TMPFILE < -01 - S /etc/init.d/bootlocal.first -02 - S /etc/init.d/mountkernfs.sh -02 - S /etc/init.d/hostname.sh -04 - S /etc/init.d/grml-udev -05 - S /etc/init.d/mountdevsubfs.sh -18 - S /etc/init.d/ifupdown-clean -29 - 2 /etc/init.d/bootlocal.middle -29 - 2,3,4,5 /etc/init.d/dbus -29 - 2,3,4,5 /etc/init.d/avahi-daemon -30 - 2,3,4,5 /etc/init.d/grml-autoconfig -36 - S /etc/init.d/ifupdown -36 - S /etc/init.d/udev-mtab -38 - S /etc/init.d/resolvconf -40 - S /etc/init.d/networking -41 - S /etc/init.d/rpcbind -42 - S /etc/init.d/nfs-common -55 - S /etc/init.d/bootmisc.sh -90 - 0 /etc/init.d/halt -90 - 6 /etc/init.d/reboot -90 - S /etc/init.d/rmnologin -90 - 1 /etc/init.d/single -98 - 2 /etc/init.d/grml-home -99 - 2 /etc/init.d/grml-misc -99 - 2 /etc/init.d/bootlocal.last -# THE LAST LINE IS NEVER READ diff --git a/etc/grml/fai/config/files/etc/systemd/logind.conf/GRMLBASE b/etc/grml/fai/config/files/etc/systemd/logind.conf/GRMLBASE deleted file mode 100644 index 72ea52fae..000000000 --- a/etc/grml/fai/config/files/etc/systemd/logind.conf/GRMLBASE +++ /dev/null @@ -1,23 +0,0 @@ -# This file was deployed via grml-live. - -# See logind.conf(5) for details - -[Login] -NAutoVTs=12 -#ReserveVT=6 -#KillUserProcesses=no -#KillOnlyUsers= -#KillExcludeUsers=root -#InhibitDelayMaxSec=5 -#HandlePowerKey=poweroff -#HandleSuspendKey=suspend -#HandleHibernateKey=hibernate -HandleLidSwitch=ignore -#PowerKeyIgnoreInhibited=no -#SuspendKeyIgnoreInhibited=no -#HibernateKeyIgnoreInhibited=no -#LidSwitchIgnoreInhibited=yes -#IdleAction=ignore -#IdleActionSec=30min -#RuntimeDirectorySize=10% -#RemoveIPC=yes diff --git a/etc/grml/fai/config/files/etc/systemd/system/ssh.service/GRMLBASE b/etc/grml/fai/config/files/etc/systemd/system/ssh.service/GRMLBASE deleted file mode 100644 index 3a6729e03..000000000 --- a/etc/grml/fai/config/files/etc/systemd/system/ssh.service/GRMLBASE +++ /dev/null @@ -1,23 +0,0 @@ -# This file was deployed via grml-live. - -[Unit] -Description=OpenBSD Secure Shell server -After=network.target auditd.service -ConditionPathExists=!/etc/ssh/sshd_not_to_be_run - -[Service] -EnvironmentFile=-/etc/default/ssh -ExecStartPre=-/usr/bin/ssh-keygen -A -ExecStart=/usr/sbin/sshd -D $SSHD_OPTS -ExecReload=/usr/sbin/sshd -t -ExecReload=/bin/kill -HUP $MAINPID -KillMode=process -Restart=on-failure -RestartPreventExitStatus=255 -Type=notify -RuntimeDirectory=sshd -RuntimeDirectoryMode=0755 - -[Install] -WantedBy=multi-user.target -Alias=sshd.service diff --git a/etc/grml/fai/config/scripts/GRMLBASE/03-get-sources b/etc/grml/fai/config/scripts/GRMLBASE/03-get-sources deleted file mode 100755 index 5d59b070e..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/03-get-sources +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/03-get-sources -# Purpose: download sources of Debian packages -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -if ifclass SOURCES ; then - echo "Class SOURCES set, retrieving source packages." -else - echo "Class SOURCES not set, nothing to do." - exit 0 -fi - -set -u - -PACKAGE_LIST=$(mktemp) - -bailout() { - rm -f "${target}/grml-live/sources/errors.log" - rm -f "$PACKAGE_LIST" -} - -$ROOTCMD apt-get update - -$ROOTCMD dpkg-query -W -f='${Package}\n' > "${PACKAGE_LIST}" - -if ! [ -r "${PACKAGE_LIST}" ] ; then - echo "Can not read ${PACKAGE_LIST}, can not download source packages as requested." >&2 - bailout - exit 1 -else - mkdir -p "${target}"/grml-live/sources - - # needs to be done for each package to get: - # | Picking 'acpi-support' as source package instead of 'acpi-fakekey' - # instead of: - # | E: Unable to find a source package for acpi-fakekey - for package in $(grep -v '^#' ${PACKAGE_LIST}) ; do - cat << EOT | chroot "$target" /bin/bash -cd /grml-live/sources -apt-get --download-only source "$package" 2>>/grml-live/sources/errors.log -EOT - done - - if grep -q '^E:' "${target}/grml-live/sources/errors.log" ; then - echo "Errors noticed while retrieving sources:" >&2 - cat "${target}/grml-live/sources/errors.log" >&2 - bailout - exit 1 - elif grep -q '^W:' "${target}/grml-live/sources/errors.log" ; then - echo "Warnings noticed while retrieving sources (not failing the build though):" - cat "${target}/grml-live/sources/errors.log" - elif grep -q '.' "${target}/grml-live/sources/errors.log" ; then - echo "Unclassified problems noticed while retrieving sources:" >&2 - cat "${target}/grml-live/sources/errors.log" >&2 - bailout - exit 1 - fi - -fi - -bailout - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/37-portmap b/etc/grml/fai/config/scripts/GRMLBASE/37-portmap deleted file mode 100755 index d7a426c29..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/37-portmap +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/37-portmap -# Purpose: configure portmap of live-system -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -# Work around a bug in the portmap package, see -# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=317358 - -CONFFILE="$target/etc/default/portmap" - -# modify only if the file is present, nowadays we have rpcbind -if [ -r "$CONFFILE" ] ; then - # modify it iff we have portmap's default configuration - if grep -q '^OPTIONS="-i 127.0.0.1"' "$CONFFILE" ; then - # disable the "-i 127.0.0.1" configuration so it works e.g. with - # grml-terminalserver OOTB: - printf "Removing loopback-interface-only option (workaround #317358) in /etc/default/portmap: " - sed -i 's/^OPTIONS.*/# OPTIONS="-i 127.0.0.1"/' "$CONFFILE" && echo OK || echo ERROR - fi -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/39-modprobe b/etc/grml/fai/config/scripts/GRMLBASE/39-modprobe deleted file mode 100755 index 849809d15..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/39-modprobe +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/39-modprobe -# Purpose: adjust modprobe configuration -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -# Make sure all modprobe configuration files use .conf as filename suffix. -# See http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=module-init-tools;dist=unstable -# and http://blog.bofh.it/debian/id_236 -find $target/etc/modprobe.d -maxdepth 1 -type f ! -name \*\.conf -exec mv {} {}.conf \; - -# Install all present modprobe.d configuration files -fcopy -v -i -r /etc/modprobe.d - -if [ -f "${target}/lib/modprobe.d/50-nfs.conf" ] ; then # nfs-kernel-server >=1:2.6.2-1 - echo "Clearing /lib/modprobe.d/50-nfs.conf to avoid automatic kmod/busybox issues" - echo '# this file was generated by grml-live script GRMLBASE/39-modprobe' > "${target}/lib/modprobe.d/50-nfs.conf" -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/43-rsyslog b/etc/grml/fai/config/scripts/GRMLBASE/43-rsyslog deleted file mode 100755 index 9ee104396..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/43-rsyslog +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/43-rsyslog -# Purpose: install rsyslog.conf -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -fcopy -v /etc/rsyslog.conf - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/49-sshd b/etc/grml/fai/config/scripts/GRMLBASE/49-sshd deleted file mode 100755 index f2d40ed61..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/49-sshd +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/49-sshd -# Purpose: adjust sshd configuration file -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -if ! [ -r "${target}/etc/ssh/sshd_config" ] ; then - echo "File /etc/ssh/sshd_config doesn't exist, skipping execution of script." - exit 0 -fi - -# make sure root login works, it's set to "without-password" since openssh-server v1:6.6p1-1 -# and defaults to "prohibit-password" since openssh-server v1:7.1p1-1 -if grep -q '^PermitRootLogin ' "${target}/etc/ssh/sshd_config" ; then - # make sure we don't modify our own disabled snippet once again - if ! grep -q 'PermitRootLogin .*disabled via grml-live' "${target}/etc/ssh/sshd_config" ; then - sed -i "s/^\(PermitRootLogin .*\)/# \1 # disabled via grml-live\nPermitRootLogin yes/" "${target}/etc/ssh/sshd_config" - fi -else - echo "# Added via grml-live script:" >> "${target}/etc/ssh/sshd_config" - echo "PermitRootLogin yes" >> "${target}/etc/ssh/sshd_config" -fi - -# speedup if DNS is broken/unavailable -if grep -q '^UseDNS ' "${target}/etc/ssh/sshd_config" ; then - # make sure we don't modify our own disabled snippet once again - if ! grep -q 'UseDNS .*disabled via grml-live' "${target}/etc/ssh/sshd_config" ; then - sed -i "s/^\(UseDNS .*\)/# \1 # disabled via grml-live\nUseDNS no/" "${target}/etc/ssh/sshd_config" - fi -else - echo "# Added via grml-live script:" >> "${target}/etc/ssh/sshd_config" - echo "UseDNS no" >> "${target}/etc/ssh/sshd_config" -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/94-update-smart-drivedb b/etc/grml/fai/config/scripts/GRMLBASE/94-update-smart-drivedb deleted file mode 100755 index 1b98ef666..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/94-update-smart-drivedb +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/94-update-smart-drivedb -# Purpose: update pciids -# Authors: (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -if ifclass NO_ONLINE ; then - echo "Ignoring script 94-update-smart-drivedb as NO_ONLINE is set." - exit 0 -fi - -set -u -set -e - -[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT="" - -if ! [ -x ${target}/usr/sbin/update-smart-drivedb ] ; then - echo "NOTE: update-smart-drivedb not present (possibly smartmontools >=6.4+svn4214-1 present)" - exit 0 -fi - -echo "Updating smartmontool drivedb" -if [ -n "$TIMEOUT" ] ; then - if ! $ROOTCMD timeout $TIMEOUT update-smart-drivedb ; then - echo "Warning: failed to update smartmontool drivedb, ignoring failure" - fi -else - if ! $ROOTCMD update-smart-drivedb ; then - echo "Warning: failed to update smartmontool drivedb, ignoring failure" - fi -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/95-package-information b/etc/grml/fai/config/scripts/GRMLBASE/95-package-information deleted file mode 100755 index 05b9a330a..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/95-package-information +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/95-package-information -# Purpose: store package information of chroot system -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -if ! [ -w "$LOGDIR" ] ; then - echo "Error: can not write to ${LOGDIR}. Exiting.">&2 - exit 1 -else - # store package list for the build process logs as well: - COLUMNS=200 $ROOTCMD dpkg --list > "${LOGDIR}"/dpkg.list - COLUMNS=200 $ROOTCMD dpkg --get-selections > "${LOGDIR}"/dpkg.selections - # store list of packages sorted by size: - if [ -x $target/usr/bin/dpkg-query ] ; then - $ROOTCMD dpkg-query -W --showformat='${Package}\t${Installed-Size}\n' > \ - "${LOGDIR}"/packages.size - fi - # store a list of non-free packages and their licenses - if $ROOTCMD test -x /usr/bin/aptitude ; then - echo "The following packages from the Debian non-free section are included in this release" \ - > "${LOGDIR}"/nonfree-licenses.txt - echo >> "${LOGDIR}"/nonfree-licenses.txt - for pkg in `$ROOTCMD aptitude search '~i ~snon-free' -F '%p'` ; do - echo "Package: ${pkg}" >> "${LOGDIR}"/nonfree-licenses.txt - echo "========================================================================" \ - >> "${LOGDIR}"/nonfree-licenses.txt - if $ROOTCMD test -r "/usr/share/doc/${pkg}/copyright" ; then - $ROOTCMD cat "/usr/share/doc/${pkg}/copyright" >> "${LOGDIR}"/nonfree-licenses.txt - else - echo "${pkg} does not provide a copyright file" >> "${LOGDIR}"/nonfree-licenses.txt - fi - echo >> "${LOGDIR}"/nonfree-licenses.txt - done - fi -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs b/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs deleted file mode 100755 index 499971497..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/96-apt-listbugs -# Purpose: retrieve list of bugreports of installed packages inside chroot -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -if [ -r $target/etc/apt/apt.conf.d/10apt-listbugs ] ; then - if [ -x $target/usr/sbin/apt-listbugs ] ; then - sed -i 's#//DPkg::#DPkg::#' $target/etc/apt/apt.conf.d/10apt-listbugs - fi -fi - -set +u -if ifclass RELEASE ; then -set -u - if [ -x $target/usr/sbin/apt-listbugs -a -x $target/usr/bin/apt-show-source ] && \ - [ -x $target/etc/apt/grml/listbugs ] ; then - for severity in critical grave serious ; do - SEVERITY=$severity $ROOTCMD /etc/apt/grml/listbugs > \ - $LOGDIR/bugs.${severity} || true # make sure it does not fail - done - fi - -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges b/etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges deleted file mode 100755 index 02372dbd2..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/97-apt-listchanges -# Purpose: configure apt-listchanges -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e - -# Defaults: -#apt-listchanges apt-listchanges/confirm boolean false -#apt-listchanges apt-listchanges/email-address string root -#apt-listchanges apt-listchanges/which select news -#apt-listchanges apt-listchanges/frontend select pager -#apt-listchanges apt-listchanges/save-seen boolean true - -if [ -x $target/usr/bin/apt-listchanges ] ; then - echo 'apt-listchanges apt-listchanges/confirm boolean true' | $ROOTCMD debconf-set-selections - echo 'apt-listchanges apt-listchanges/which select both' | $ROOTCMD debconf-set-selections -fi - -if [ -r $target/etc/apt/listchanges.conf ] ; then - sed -i "s/^which=news/which=both/" $target/etc/apt/listchanges.conf - sed -i "s/^confirm=0/confirm=1/" $target/etc/apt/listchanges.conf -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot b/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot deleted file mode 100755 index 3b07e5edb..000000000 --- a/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot +++ /dev/null @@ -1,228 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/98-clean-chroot -# Purpose: clean up chroot system -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -set -u -set -e - -if ! ls $target/boot/config-* &>/dev/null ; then - echo "No kernel config files (/boot/config-*) found. No kernel-image package installed?" >&2 - exit 1 -fi - -echo "Creating ~/.zshrc" -touch $target/root/.zshrc - -$ROOTCMD rm -f /etc/apt/apt.conf.d/90grml-apt-proxy.conf - -if [ -x $target/usr/sbin/localepurge ] ; then - echo "Running localepurge" - $ROOTCMD localepurge -else - echo "Warning: localepurge not installed" -fi - -# revert dpkg-divert of hooks/instsoft.GRMLBASE, which is -# used to work around /etc/kernel/postinst.d/zz-update-grub failing -# inside openvz environment, see #597084 -if $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/update-grub' ; then - echo "Undoing dpkg-divert of update-grub executable" - $ROOTCMD rm -f /usr/sbin/update-grub - $ROOTCMD dpkg-divert --rename --remove /usr/sbin/update-grub -fi - -# revert dpkg-divert of hooks/instsoft.GRMLBASE, which is -# used to work around a grub-probe<->openvz bug -if $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/grub-probe' ; then - echo "Undoing dpkg-divert of grub-probe executable" - $ROOTCMD rm -f /usr/sbin/grub-probe - $ROOTCMD dpkg-divert --rename --remove /usr/sbin/grub-probe -fi - -# revert udev workaround of hooks/updatebase.GRMLBASE -if grep -q 'updatebase.GRMLBASE' ${target}/etc/udev/kernel-upgrade 2>/dev/null ; then - echo "Removing /etc/udev/kernel-upgrade created by updatebase.GRMLBASE" - $ROOTCMD rm -f /etc/udev/kernel-upgrade -fi - -echo "Cleaning apt places" -$ROOTCMD apt-get check 2>/dev/null -$ROOTCMD dpkg --clear-avail -$ROOTCMD apt-cache gencaches 2>/dev/null -$ROOTCMD apt-get clean - -rm -f $target/var/lib/dpkg/status-old $target/var/lib/dpkg/available-old - -if ! [ -x $target/usr/bin/grep-dctrl ] ; then - echo "Warning: grep-dctrl not installed" -else - echo "Cleaning up /var/lib/dpkg/status" - if $ROOTCMD grep-dctrl -v -F Status "purge ok not-installed" \ - /var/lib/dpkg/status > $target/var/lib/dpkg/status.new ; then - mv $target/var/lib/dpkg/status.new $target/var/lib/dpkg/status - chmod 644 $target/var/lib/dpkg/status - chown root:root $target/var/lib/dpkg/status - fi -fi - -echo "Removing host ssh-keys" -rm -f $target/etc/ssh/*key* - -echo "Removing dbus machine-id" -rm -f $target/var/lib/dbus/machine-id - -if [ -d $target/var/spool/squid/ ] ; then - echo "Cleaning /var/spool/squid/0*" - rm -rf $target/var/spool/squid/0* -fi - -echo "Cleaning and removing some misc files and directories" -find $target/etc -type f -name *.pre_fcopy -delete -find $target/etc -type l -name *.pre_fcopy -delete -rm -rf --one-file-system $target/etc/sysconfig/* \ - $target/etc/motd.dpkg-* $target/etc/auto.master.*dpkg* \ - $target/etc/samba/*.SID $target/etc/samba/*.tdb \ - $target/var/log/ksymoops/* \ - $target/var/state/* $target/var/log/nessus/* \ - $target/halt $target/reboot $target/ash.static \ - $target/etc/dhcpc/*.info $target/etc/dhcpc/resolv* \ - $target/etc/*passwd- $target/etc/*shadow- \ - $target/etc/*group- $target/var/spool/postfix/maildrop/* \ - $target/etc/*.old $target/etc/*.original \ - $target/etc/lvm/.cache $target/etc/lvm/cache/.cache \ - $target/etc/lvm/backup/* $target/tmp/* \ - $target/var/tmp/* $target/var/backups/* \ - $target/var/lib/mysql $target/var/log/lilo_log.* $target/core* \ - $target/etc/blkid.tab - -# remove only "temporary" or saved files in the given directories -nuke(){ - for i in $(find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.xz -o -name \*.0 2>/dev/null); do - rm -f --one-file-system "$i" - done -} - -# set all files in the given directories to a length of zero -zero(){ - for i in $(find "$@" -type f -size +0 -not -name \*.ini -not -path '*/fai/*' -not -name install_packages.list 2>/dev/null); do - :> "$i" - done -} - -echo "Removing possible leftovers from update-pciids runs" -rm -f "${target}"/wget-log* - -echo "Cleaning log and cache directories" -nuke ${target}/var/log ${target}/var/cache -zero ${target}/var/account/pacct \ - ${target}/var/cache/man \ - ${target}/var/lib/games \ - ${target}/var/lib/nfs \ - ${target}/var/lib/xkb \ - ${target}/var/local \ - ${target}/var/log \ - ${target}/var/mail/grml - -# on /run we don't have to create it -if [ -d ${target}/var/run ] ; then - echo "Recreate empty utmp and wtmp" - :>${target}/var/run/utmp - :>${target}/var/run/wtmp -fi - -if ! [ -x $target/usr/sbin/update-ca-certificates ] ; then - echo "Warning: update-ca-certificates not installed" -else - echo "Updating ca-certificates" - $ROOTCMD update-ca-certificates -fi - -# regenerate ls.so.cache -if ! [ -x $target/sbin/ldconfig ] ; then - echo "Warning: ldconfig not installed" -else - echo "Updating ld.so.cache" - $ROOTCMD ldconfig -fi - -if ! [ -x $target/usr/bin/update-menus ] ; then - echo "Warning: update-menus not installed" -else - echo "Updating windowmanager menus" - $ROOTCMD update-menus -v -fi - -if ! [ -x $target/usr/bin/mandb ] ; then - echo "Warning: mandb not installed" -else - echo "Updating mandb" - $ROOTCMD mandb -c - $ROOTCMD man doesnotexist >/dev/null 2>&1 || true -fi - -if ! [ -d $target/var/lib/clamav/ ] ; then - echo "Warning: clamav[-freshclam] not installed" -else - echo "Cleaning /var/lib/clamav/" - $ROOTCMD rm -rf /var/lib/clamav/clamav-* - - echo "Setting up daily.cvd and main.cvd symlinks" - if [ -f $target/var/lib/clamav/daily.cvd ] ; then - mkdir -p $target/usr/share/doc/clamav-freshclam/examples/ - ln -sf /var/lib/clamav/daily.cvd $target/usr/share/doc/clamav-freshclam/examples/ - ln -sf /var/lib/clamav/main.cvd $target/usr/share/doc/clamav-freshclam/examples/ - fi -fi - -if ! [ -r $target/etc/ld.so.nohwcap ] ; then - echo "Creating /etc/ld.so.nohwcap" - touch $target/etc/ld.so.nohwcap -fi - -if ! [ -d $target/etc/resolvconf ] ; then - echo "Warning: resolvconf not installed" -else - echo "Setting up resolvconf" - rm -f "${target}"/etc/resolvconf/resolv.conf.d/original - rm -f "${target}"/etc/resolv.conf - - # avoid "/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a - # symbolic link to /etc/resolvconf/run/resolv.conf" for resolvconf versions - # before 1.80 - RESOLVCONF_VERSION=$($ROOTCMD dpkg-query -W -f='${Version}\n' resolvconf || true) - echo "-> Identified resolvconf version '${RESOLVCONF_VERSION}'" - if dpkg --compare-versions "${RESOLVCONF_VERSION}" lt 1.80 ; then - echo "-> Installing resolvconf symlink for versions <1.80" - ln -s /etc/resolvconf/run/resolv.conf "${target}"/etc/resolv.conf - else - echo "-> Installing resolvconf symlink for versions >=1.80" - ln -s /run/resolvconf/resolv.conf "${target}"/etc/resolv.conf - fi - -fi - -# make sure we don't leak any mdadm configurations -# that are present on the build system to the live system -if [ -f "${target}/etc/mdadm/mdadm.conf" ] ; then - echo "Found /etc/mdadm/mdadm.conf, getting rid of any possible enabled ARRAY settings." - sed -i '/^ARRAY/d' "${target}/etc/mdadm/mdadm.conf" -fi - -if ! $ROOTCMD test -x /usr/bin/updatedb ; then - echo "Warning: updatedb not installed" -else - echo "Updating locate-database" - $ROOTCMD updatedb --prunepaths='/tmp /usr/tmp /var/tmp /grml /root /proc /sys' -fi - -if [ -r "${target}/etc/machine-id" ] ; then - echo "Removing /etc/machine-id generated by systemd" - rm -f "$target/etc/machine-id" -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot b/etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot deleted file mode 100755 index 6e197e6ff..000000000 --- a/etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRML_SMALL/98-clean-chroot -# Purpose: clean up Grml chroot on grml-small -# Authors: (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -set -e -set -u - -echo "Removing /usr/share/ssh/blacklist.*" -rm -f $target/usr/share/ssh/blacklist.DSA-1024 $target/usr/share/ssh/blacklist.RSA-2048 - -echo "Cleaning documentation directories" -if [ -d $target/usr/share/doc/grml-docs ] ; then - mv $target/usr/share/doc/grml-docs $target/tmp/ -fi - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/LATEX/98-clean-chroot b/etc/grml/fai/config/scripts/LATEX/98-clean-chroot deleted file mode 100755 index d407c9210..000000000 --- a/etc/grml/fai/config/scripts/LATEX/98-clean-chroot +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/LATEX/98-clean-chroot -# Purpose: remove some large LaTeX documentation directories -# Authors: (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -set -u -set -e - -rm -rf ${target}/usr/share/doc/texlive-latex-recommended/latex/ \ - ${target}/usr/share/doc/texlive-latex-base/latex/ \ - ${target}/usr/share/doc/texlive-base-bin/pdftex/thanh/ \ - ${target}/usr/share/doc/texlive-latex-base/latex/base/ \ - ${target}/usr/share/doc/texlive-latex-base/latex/hyperref/ \ - ${target}/usr/share/doc/texlive-latex-base/generic/babel/ \ - ${target}/usr/share/doc/texlive-latex-recommended/latex/koma-script/ \ - ${target}/usr/share/doc/texmf/pgf/pgfmanual.pdf.gz - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/RELEASE/98-clean-chroot b/etc/grml/fai/config/scripts/RELEASE/98-clean-chroot deleted file mode 100755 index 626267f1d..000000000 --- a/etc/grml/fai/config/scripts/RELEASE/98-clean-chroot +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/RELEASE/98-clean-chroot -# Purpose: clean up $HOMEs for release -# Authors: grml-team (grml.org), (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -set -u -set -e -. "$GRML_LIVE_CONFIG" - -echo "Removing /var/lib/apt/lists/*-stuff, dpkg-status-old and pkgcache.bin" -rm -f $target/var/lib/apt/lists/*Packages \ - $target/var/lib/apt/lists/*Release \ - $target/var/lib/apt/lists/*Sources \ - $target/var/lib/apt/lists/*Index* \ - $target/var/lib/apt/lists/*Translation* \ - $target/var/lib/apt/lists/*.gpg \ - $target/var/cache/apt-show-versions/* \ - $target/var/cache/debconf/*.dat-old \ - $target/var/cache/apt/*.bin - -echo "Removing /var/lib/aptitude/pkgstates.old" -rm -f "${target}/var/lib/aptitude/pkgstates.old" - -# Remove all FAI logs from chroot via grml-live later then -echo "Setting up /etc/grml_fai_release for grml-live" -touch $target/etc/grml_fai_release - -echo "Removing all files inside /root" -rm -rf $target/root -mkdir -m 0755 $target/root - -echo "Removing all files inside /home/${USERNAME}" -rm -rf "${target}/home/${USERNAME}" -mkdir -m 0755 "${target}/home/${USERNAME}" -$ROOTCMD chown "${USERNAME}:${USERNAME}" "/home/${USERNAME}" - -echo "Syncing /home/${USERNAME}/ with data from /etc/skel/:" -$ROOTCMD su -s /bin/sh "${USERNAME}" -c "rsync -Hav /etc/skel/ /home/${USERNAME}/" - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/REMOVE_DOCS/98-clean-chroot b/etc/grml/fai/config/scripts/REMOVE_DOCS/98-clean-chroot deleted file mode 100755 index 289bb13e1..000000000 --- a/etc/grml/fai/config/scripts/REMOVE_DOCS/98-clean-chroot +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/REMOVE_DOCS/98-clean-chroot -# Purpose: remove docs in Grml chroot -# Authors: (c) Michael Prokop -# License: This file is licensed under the GPL v2. -################################################################################ - -set -u -set -e - -echo "Cleaning documentation directories" -if [ -d $target/usr/share/doc/grml-docs ] ; then - mv $target/usr/share/doc/grml-docs $target/tmp/ -fi - -rm -rf $target/usr/share/doc -mkdir $target/usr/share/doc - -if [ -d $target/tmp/grml-docs ] ; then - mv $target/tmp/grml-docs $target/usr/share/doc/grml-docs -fi - -rm -rf $target/usr/share/gtk-doc/ \ - $target/usr/share/man/ \ - $target/usr/man \ - $target/usr/share/info \ - $target/var/cache/man/* - -echo "Creating /usr/share/info/..." -mkdir -p $target/usr/share/info/ - -## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/fai.conf b/etc/grml/fai/fai.conf deleted file mode 100644 index b5f47cf8a..000000000 --- a/etc/grml/fai/fai.conf +++ /dev/null @@ -1,39 +0,0 @@ -# fai.conf -- configuration for FAI (Fully Automatic Installation) - -# Access to Debian mirror via NFS mounted directory -# If FAI_DEBMIRROR is defined, install clients mount it to $MNTPOINT -#FAI_DEBMIRROR=yournfs debianmirror:/path/to/debianmirror - -# LOGUSER: an account on the install server which saves all log-files -# and which can change the kernel that is booted via network. -# Configure .rhosts for this account and PAM, so that root can log in -# from all install clients without password. This account should have -# write permissions for /srv/tftp/fai. For example, you can use write -# permissions for the group linuxadm. chgrp linuxadm /srv/tftp/fai;chmod -# g+w /srv/tftp/fai. If the variable is undefined, this feature is disabled. -# Define it, to enable it, eg. LOGUSER=fai -LOGUSER= - -# set protocol type for saving logs. Values: ssh, rsh, ftp -FAI_LOGPROTO=ssh - -# how to access the fai config space -# supported URL-types: nfs, file, cvs, cvs+ssh, svn+file, svn+http,... -# NOTE: grml-live set's the values according to command line options, -# please adjust here only if you know what you're doing -#FAI_CONFIG_SRC=nfs://yourservername$FAI_CONFIGDIR -#FAI_CONFIG_SRC=file:///etc/grml/fai/config -#FAI_CONFIGDIR=/etc/grml/fai - -# the following variables are read only for most users - -# mount point where the mirror will be mounted -MNTPOINT=/media/mirror - -# the local configuration directory on the install client -#FAI=/var/lib/fai/config -#FAI=/etc/grml/fai/config - -# errors greater STOP_ON_ERROR will cause fai to stop the installation -# default: 700 -#STOP_ON_ERROR=300 diff --git a/etc/grml/grml-live.conf b/etc/grml/grml-live.conf index ec92d46bb..748d867df 100644 --- a/etc/grml/grml-live.conf +++ b/etc/grml/grml-live.conf @@ -28,19 +28,8 @@ # Do you want to preserve the logfile from being cleaned after each execution # of grml-live? By default the logfile is cleaned so the log doesn't fill up. -# If you want to store your logs permanently it's recommended to use grml-live-db. # PRESERVE_LOGFILE='1' -# If package grml-live-db is installed the package selection and grml-live.log -# are being logged to a sqlite database.Defaults to /var/log/grml-live.db -# DPKG_DATABASE=/var/log/grml-live.db - -# Use your own database wrapper script for grml-live-db: -# DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db - -# Use your own database script cmdline options for grml-live-db: -# DPKG_DBOPTIONS="-d $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME < $DPKG_LIST" - # Do you want to zero / clean up / remove the previous logfiles of FAI # before executing grml-live? Otherwise keep all the logfiles inside # /var/log/fai/$HOSTNAME/... @@ -66,13 +55,13 @@ # Which Debian suite and which mirror do you want to use for debootstrapping? # Usage: " " -# FAI_DEBOOTSTRAP="bookworm http://ftp.debian.org/debian" +# FAI_DEBOOTSTRAP="bookworm http://deb.debian.org/debian" # Do you want to use a local mirror (like NFS)? # If so specify the directory where debian/ is available: # MIRROR_DIRECTORY="/media/mirror" # ... and then set up an according class file in -# ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/ +# ${GRML_FAI_CONFIG}/files/etc/apt/sources.list.d/ # containing something like: # deb file:///media/mirror/debian sid main contrib non-free-firmware non-free @@ -93,7 +82,7 @@ # USERNAME=grml # Directory of configuration files for grml-live's FAI: -# GRML_FAI_CONFIG=/etc/grml/fai +# GRML_FAI_CONFIG=/usr/share/grml-live/config # Do you want to put any local files into the chroot? # If so then point CHROOT_INSTALL to a directory providing the files. @@ -140,9 +129,6 @@ # Do you want to skip adding /boot/addons/ (from the template directory)? # NO_ADDONS='1' -# Do you want to skip adding /boot/addons/bsd4grml/ (from the template directory)? -# NO_ADDONS_BSD4GRML='1' - # By default the ISO is created for hybrid boot, so you can either # boot the CD using normal el torito mode or copy it to USB device # *without* having to run grml2usb (like: 'dd if=grml.iso of=/dev/sdX') @@ -172,7 +158,7 @@ # exclude files from compressed squashfs file using the # the mksquashfs option -ef: -# SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes" +# SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/grml/squashfs-excludes" # Do you want to exit grml-live if some packages were requested for installation # on fresh installs but are missing on the generated ISO finally? diff --git a/grml-live b/grml-live index a00ba7b1b..03763cd6b 100755 --- a/grml-live +++ b/grml-live @@ -28,9 +28,8 @@ fi GRML_LIVE_VERSION='***UNRELEASED***' # global variables -PN="$(basename $0)" -CMDLINE="$0 $@" -ADDONS_LIST_FILE='/boot/isolinux/addons_list.cfg' +PN=$(basename "$0") +CMDLINE="$0 $*" # }}} # usage information {{{ @@ -48,7 +47,7 @@ Usage: $PN [options, see as follows] -c classes to be used for building the ISO via FAI -C configuration file for grml-live -d use specified date instead of build time as date of release - -D use specified configuration directory instead of /etc/grml/fai + -D use specified configuration directory instead of /usr/share/grml-live/config -e extract ISO and squashfs contents from iso_name -F force execution without prompting -g set the grml flavour name @@ -90,7 +89,7 @@ Please send your bug reports and feedback to the grml-team: http://grml.org/bugs # make sure it's possible to get usage information without being # root or actually executing the script -if [ "$1" = '-h' -o "$1" = '--help' ] ; then +if [ "$1" = '-h' ] || [ "$1" = '--help' ] ; then usage exit 0 fi @@ -128,14 +127,19 @@ BOOTSTRAP_ONLY='' HOSTNAME='' USERNAME='' CONFIGDUMP='' +FAI_CONF_DIR='' +FAI_PROGRAM='fai' # don't use colors/escape sequences if [ -r /lib/lsb/init-functions ] ; then + # shellcheck source=/dev/null . /lib/lsb/init-functions + # shellcheck disable=SC2034 ! log_use_fancy_output && NOCOLORS=true fi if [ -r /etc/grml/lsb-functions ] ; then + # shellcheck source=/dev/null . /etc/grml/lsb-functions else einfo() { echo " [*] $*" ;} @@ -152,7 +156,8 @@ if ! [ -r "$LIVE_CONF" ] ; then ewarn "Configuration file $LIVE_CONF can not be read, ignoring" else einfo "Sourcing configuration file $LIVE_CONF" - . $LIVE_CONF + # shellcheck source=/dev/null + . "$LIVE_CONF" eend $? fi # }}} @@ -160,13 +165,13 @@ fi # umount all directories {{{ umount_all() { # make sure we don't leave any mounts - FAI doesn't remove them always - umount $CHROOT_OUTPUT/proc/sys/fs/binfmt_misc 2>/dev/null || /bin/true - umount $CHROOT_OUTPUT/proc 2>/dev/null || /bin/true - umount $CHROOT_OUTPUT/run/udev 2>/dev/null || /bin/true - umount $CHROOT_OUTPUT/run 2>/dev/null || /bin/true - umount $CHROOT_OUTPUT/sys 2>/dev/null || /bin/true - umount $CHROOT_OUTPUT/dev/pts 2>/dev/null || /bin/true - umount $CHROOT_OUTPUT/dev 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/proc/sys/fs/binfmt_misc" 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/proc" 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/run/udev" 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/run " 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/sys " 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/dev/pts" 2>/dev/null || /bin/true + umount "$CHROOT_OUTPUT/dev" 2>/dev/null || /bin/true if [ -n "$EXTRACT_ISO_NAME" ] ; then umount "$EXTRACT_ISO_NAME" 2>/dev/null || /bin/true @@ -174,10 +179,9 @@ umount_all() { # certain FAI versions sadly leave a ramdisk behind, so better safe than sorry if [ -x /usr/lib/fai/mkramdisk ] ; then - /usr/lib/fai/mkramdisk -u "$(readlink -f ${CHROOT_OUTPUT}/var/lib/dpkg)" >/dev/null 2>&1 || /bin/true + /usr/lib/fai/mkramdisk -u "$(readlink -f "${CHROOT_OUTPUT}"/var/lib/dpkg)" >/dev/null 2>&1 || /bin/true fi - umount "${CHROOT_OUTPUT}/grml-live/sources/" 2>/dev/null || /bin/true [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" } # }}} @@ -189,8 +193,8 @@ store_logfiles() { cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/ rm -rf "$CHROOT_OUTPUT"/var/log/fai - # store copy of autogenerated configuration file - cp ${GRML_FAI_CONFIG}/nfsroot.conf "$LOG_OUTPUT"/fai/ + # store copy of autogenerated configuration files + cp "${FAI_CONF_DIR}"/* "$LOG_OUTPUT"/fai/ # copy fai package list cp "$CHROOT_OUTPUT"/var/log/install_packages.list "$LOG_OUTPUT"/fai/ @@ -205,6 +209,7 @@ bailout() { rm -f /var/run/fai/fai_softupdate_is_running \ /var/run/fai/FAI_INSTALLATION_IN_PROGRESS [ -n "$CONFIGDUMP" ] && rm -f "$CONFIGDUMP" + [ -n "$FAI_CONF_DIR" ] && rm -rf "$FAI_CONF_DIR" [ -n "$SQUASHFS_STDERR" ] && rm -rf "$SQUASHFS_STDERR" umount_all [ -n "$1" ] && EXIT="$1" || EXIT="1" @@ -212,29 +217,26 @@ bailout() { if [ -n "$CLEAN_ARTIFACTS" ]; then log "Cleaning up" einfo "Cleaning up" - [ -n "${BUILD_OUTPUT}" -a -d "${BUILD_OUTPUT}" ] && rm -r "${BUILD_OUTPUT}" - [ -n "${CHROOT_OUTPUT}" -a -d "${CHROOT_OUTPUT}" ] && rm -r "${CHROOT_OUTPUT}" + [ -n "${BUILD_OUTPUT}" ] && [ -d "${BUILD_OUTPUT}" ] && rm -r "${BUILD_OUTPUT}" + [ -n "${CHROOT_OUTPUT}" ] && [ -d "${CHROOT_OUTPUT}" ] && rm -r "${CHROOT_OUTPUT}" eend 0 fi - # get rid of automatically generated conffiles - rm -f ${GRML_FAI_CONFIG}/nfsroot.conf - if [ -n "$CHOWN_USER" ]; then log "Setting ownership" einfo "Setting ownership" - [ -n "${OUTPUT}" -a -d "${OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${OUTPUT}" - [ -n "${BUILD_OUTPUT}" -a -d "${BUILD_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${BUILD_OUTPUT}" - [ -n "${CHROOT_OUTPUT}" -a -d "${CHROOT_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${CHROOT_OUTPUT}" - [ -n "${ISO_OUTPUT}" -a -d "${ISO_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${ISO_OUTPUT}" - [ -n "${LOG_OUTPUT}" -a -d "${LOG_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${LOG_OUTPUT}" - [ -n "${NETBOOT}" -a -d "${NETBOOT}" ] && chown -R "${CHOWN_USER}:" "${NETBOOT}" + [ -n "${OUTPUT}" ] && [ -d "${OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${OUTPUT}" + [ -n "${BUILD_OUTPUT}" ] && [ -d "${BUILD_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${BUILD_OUTPUT}" + [ -n "${CHROOT_OUTPUT}" ] && [ -d "${CHROOT_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${CHROOT_OUTPUT}" + [ -n "${ISO_OUTPUT}" ] && [ -d "${ISO_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${ISO_OUTPUT}" + [ -n "${LOG_OUTPUT}" ] && [ -d "${LOG_OUTPUT}" ] && chown -R "${CHOWN_USER}:" "${LOG_OUTPUT}" + [ -n "${NETBOOT}" ] && [ -d "${NETBOOT}" ] && chown -R "${CHOWN_USER}:" "${NETBOOT}" eend 0 fi log "------------------------------------------------------------------------------" exit "$EXIT" } -trap bailout 1 2 3 3 6 9 14 15 +trap bailout 1 2 3 3 6 14 15 trap umount_all EXIT # }}} @@ -242,7 +244,7 @@ trap umount_all EXIT # log output: # usage: log "string to log" -log() { [ -n "$LOGFILE" ] && echo "$*" >> $LOGFILE ; } +log() { [ -n "$LOGFILE" ] && echo "$*" >> "$LOGFILE" ; } # cut string at character number int = $1 # usage: cut_string 5 "1234567890" will output "12345" @@ -251,80 +253,50 @@ cut_string() { echo "$2" | head -c "$1"; echo -ne "\n" } -# prepend int = $1 spaces before string = $2 -# usage: extend_string_begin 5 "123" will output " 123" -extend_string_begin() { - [ -n "$2" ] || return 1 - local COUNT="$(echo $2 | wc -c)" - local FILL="$(expr $COUNT - $1)" - while [ "$FILL" -gt 1 ] ; do - echo -n " " - local FILL=$(expr $FILL - 1) - done - while [ "$FILL" -lt 1 ] ; do - echo -n " " - local FILL=$(expr $FILL + 1) - done - echo "$2" | head -c "$1"; echo -ne "\n" -} - # append int = $1 spaces to string = $2 -# usage: extend_string_begin 5 "123" will output "123 " +# usage: extend_string_end 5 "123" will output "123 " extend_string_end() { [ -n "$2" ] || return 1 - echo -n "$2" | head -c "$1" - local COUNT="$(echo $2 | wc -c)" - local FILL="$(expr $COUNT - $1)" - while [ "$FILL" -gt 1 ] ; do - echo -n " " - local FILL=$(expr $FILL - 1) - done - while [ "$FILL" -lt 1 ] ; do - echo -n " " - local FILL=$(expr $FILL + 1) + local text + text=$(echo -n "$2" | head -c "$1") + while [ "$1" -gt "${#text}" ] ; do + text="${text} " done - echo -ne "\n" + echo -n "${text}" } -# Copy addonfile $1 from either -# * the chroot (via $2, the system path), -# * or from TEMPLATE_DIRECTORY/compat (if exists), -# * or from the host system (again, using $2), -# or warn about the missing file. -# -# This is because: -# * We assume that the chroot always has a "good" version of -# the file. Also it makes sources handling easier. -# * On unstable, we recommend the Debian packages containing -# these files. The user can override them by putting his -# "better" version into the chroot. -# * With older releases the Debian packages are probably -# not available, so we look in TEMPLATE_DIRECTORY/compat, -# where a (custom) package might install current file versions. -copy_addon_file() { - DEST="${BUILD_OUTPUT}/boot/$3" - if [ ! -d "${DEST}/" ]; then - mkdir -p "${DEST}" - fi - if [ -e "$CHROOT_OUTPUT/$2/$1" ]; then - log "Copying $1 from chroot" - cp "$CHROOT_OUTPUT/$2/$1" "${DEST}/" - return $? - fi - if [ -e "${TEMPLATE_DIRECTORY}/compat/$3/$1" ]; then - log "Copying $1 from ${TEMPLATE_DIRECTORY}/compat" - cp "${TEMPLATE_DIRECTORY}/compat/$3/$1" "${DEST}/" - return $? - fi - if [ -e "$2/$1" ]; then - log "Copying $1 from system" - cp "$2/$1" "${DEST}/" - return $? - fi +# Returns success if a given fai class was requested. +# This is not called `ifclass`, as fai's ifclass supports a broader syntax. +hasclass() { + local expected_class="$1" + case $CLASSES in *,${expected_class},*) return 0 ;; esac + case $CLASSES in *,${expected_class}) return 0 ;; esac + case $CLASSES in ${expected_class},*) return 0 ;; esac + return 1 +} - msg="Missing addon file: \"$1\"" - ewarn "$msg" ; eend 1 - log "copy_addon_file: $msg" +# Usage: +# copy_file_logged /destination/filename /tree /src1 /src2 ... +# This copies one of the given files /src1 *or* /src2 or ..., which +# should exist inside /tree. The first matching file will be copied +# and be named /destination/filename. +# If none of the source files are found, 1 will be returned. Callers +# may opt into checking that. +copy_file_logged() { + local dest="$1" + shift + local source_root="$1" + shift + local source + + for source in "$@" ; do + if [ -r "${source_root}${source}" ] ; then + log "Installing ${source} as ${dest}" + cp "${source_root}${source}" "${dest}" + return 0 + fi + done + log "Not installing ${dest}, no source files found" return 1 } @@ -384,17 +356,17 @@ while getopts "a:C:c:d:D:e:g:i:I:o:r:s:S:t:U:v:w:AbBFhnNqQuVz" opt; do b) BUILD_ONLY=1 ;; B) BUILD_DIRTY=1 ;; c) CLASSES="$OPTARG" ;; - C) LOCAL_CONFIG="$(readlink -f $OPTARG)" ;; + C) LOCAL_CONFIG="$(readlink -f "$OPTARG")" ;; d) DATE="$OPTARG" ;; - D) GRML_FAI_CONFIG="$(readlink -f $OPTARG)" ;; - e) EXTRACT_ISO_NAME="$(readlink -f $OPTARG)" ;; + D) GRML_FAI_CONFIG="$(readlink -f "$OPTARG")" ;; + e) EXTRACT_ISO_NAME="$(readlink -f "$OPTARG")" ;; g) GRML_NAME="$OPTARG" ;; h) usage ; bailout 0 ;; i) ISO_NAME="$OPTARG" ;; I) CHROOT_INSTALL="$OPTARG" ;; n) SKIP_MKISOFS=1 ;; N) BOOTSTRAP_ONLY=1; SKIP_MKISOFS=1; SKIP_MKSQUASHFS=1 ;; - o) OUTPUT="$(readlink -f $OPTARG)" ;; + o) OUTPUT="$(readlink -f "$OPTARG")" ;; q) SKIP_MKSQUASHFS=1 ;; Q) SKIP_NETBOOT=1 ;; r) RELEASENAME="$OPTARG" ;; @@ -411,7 +383,7 @@ while getopts "a:C:c:d:D:e:g:i:I:o:r:s:S:t:U:v:w:AbBFhnNqQuVz" opt; do ?) echo "invalid option -$OPTARG" >&2; usage; bailout 1 ;; esac done -shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter +shift $((OPTIND - 1)) # set ARGV to the first not parsed commandline parameter if [ -n "$1" ] ; then echo "Error: unknown argument '$1' in options. Exiting to avoid possible data loss." >&2 @@ -427,7 +399,8 @@ if [ -z "$LOCAL_CONFIG" ]; then fi if [ -n "$LOCAL_CONFIG" ]; then if [ -r "$LOCAL_CONFIG" ]; then - . $LOCAL_CONFIG + # shellcheck source=/dev/null + . "$LOCAL_CONFIG" else eerror "Could not read specified local configuration file \"$LOCAL_CONFIG\"." bailout 1 @@ -436,30 +409,24 @@ if [ -n "$LOCAL_CONFIG" ]; then else LOCAL_CONFIG='' fi - -if [ -n "${GRML_LIVE_SOURCES:-}" ] ; then - eerror "Config variable \$GRML_LIVE_SOURCES is set. This variable has been deprecated." - ewarn "Please set up \${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/* instead." - bailout 1 -fi # }}} # assume sane defaults (if not set already) {{{ [ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)" -[ -n "$CLASSES" ] || CLASSES="GRMLBASE,GRML_FULL,$(echo ${ARCH} | tr 'a-z' 'A-Z')" +[ -n "$CLASSES" ] || CLASSES="GRMLBASE,GRML_FULL,$(echo "${ARCH}" | tr '[:lower:]' '[:upper:]')" [ -n "$DATE" ] || DATE="$(date +%Y-%m-%d)" [ -n "$DISTRI_INFO" ] || DISTRI_INFO='Grml - Live Linux for system administrators' [ -n "$DISTRI_NAME" ] || DISTRI_NAME="grml" [ -n "$DISTRI_SPLASH" ] || DISTRI_SPLASH='grml.png' [ -n "$FORCE_ISO_REBUILD" ] || FORCE_ISO_REBUILD="false" -[ -n "$GRML_FAI_CONFIG" ] || GRML_FAI_CONFIG='/etc/grml/fai' +[ -n "$GRML_FAI_CONFIG" ] || GRML_FAI_CONFIG='/usr/share/grml-live/config' [ -n "$GRML_NAME" ] || GRML_NAME='grml' [ -n "$HOSTNAME" ] || HOSTNAME='grml' [ -n "$HYBRID_METHOD" ] || HYBRID_METHOD='isohybrid' [ -n "$RELEASENAME" ] || RELEASENAME='grml-live rocks' [ -n "$SECURE_BOOT" ] || SECURE_BOOT='disable' [ -n "$SQUASHFS_BINARY" ] || SQUASHFS_BINARY='mksquashfs' -[ -n "$SQUASHFS_EXCLUDES_FILE" ] || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes" +[ -n "$SQUASHFS_EXCLUDES_FILE" ] || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/grml/squashfs-excludes" [ -n "$SUITE" ] || SUITE='testing' [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates' [ -n "$SCRIPTS_DIRECTORY" ] || SCRIPTS_DIRECTORY='/usr/share/grml-live/scripts' @@ -472,8 +439,8 @@ fi [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot" [ -n "$ISO_OUTPUT" ] || ISO_OUTPUT="$OUTPUT/grml_isos" [ -n "$LOG_OUTPUT" ] || LOG_OUTPUT="$OUTPUT/grml_logs" -[ -n "$REPORTS" ] || REPORTS="${LOG_OUTPUT}/reports/" -[ -n "$NETBOOT" ] || NETBOOT="${OUTPUT}/netboot/" +[ -n "$REPORTS" ] || REPORTS="${LOG_OUTPUT}/reports" +[ -n "$NETBOOT" ] || NETBOOT="${OUTPUT}/netboot" # }}} # some misc checks before executing FAI {{{ @@ -482,79 +449,100 @@ specify it on the command line using the -c option." [ -n "$OUTPUT" ] || bailout 1 "Error: \$OUTPUT unset, please set it in $LIVE_CONF or specify it on the command line using the -o option." +if [ "$ARCH" != "i386" ] && [ "$ARCH" != "amd64" ] && [ "$ARCH" != "arm64" ] ; then + eerror 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' + eend 1 + bailout +fi + if [[ "$(dpkg --print-architecture)" != "arm64" ]] && [[ "$ARCH" == "arm64" ]] ; then eerror "Failure: trying to build for arm64, but not running on arm64." eend 1 bailout fi +if [ -e "$GRML_FAI_CONFIG"/fai.conf ] ; then + ewarn "The file ${GRML_FAI_CONFIG}/fai.conf exists but will be ignored." + eend 1 +fi + +if [ -e /etc/grml/fai/config ] && [ -z "$GRML_FAI_CONFIG" ] ; then + eerror "Found old configuration files in /etc/grml/fai/config (while \$GRML_FAI_CONFIG was empty)." ; eend 1 + eerror "You should check your configuration and move these files into a new path, and set \$GRML_FAI_CONFIG." ; eend 1 + bailout +fi + +if [ -e "$GRML_FAI_CONFIG"/config ] ; then + eerror "The path ${GRML_FAI_CONFIG}/config exists, very likely your \$GRML_FAI_CONFIG is invalid." ; eend 1 + eerror "Either set \$GRML_FAI_CONFIG=${GRML_FAI_CONFIG}/config or delete ${GRML_FAI_CONFIG}/config." ; eend 1 + bailout +fi + # trim characters that are known to cause problems inside $GRML_NAME; # for example isolinux does not like '-' inside the directory name -[ -n "$GRML_NAME" ] && export SHORT_NAME="$(echo $GRML_NAME | tr -d ',./;\- ')" +[ -n "$GRML_NAME" ] && SHORT_NAME="$(echo "$GRML_NAME" | tr -d ',./;\- ')" # export variables to have them available in fai scripts: [ -n "$GRML_NAME" ] && export GRML_NAME="$GRML_NAME" [ -n "$RELEASENAME" ] && export RELEASENAME="$RELEASENAME" # }}} - -# ZERO_LOGFILE - check for backwards compatibility reasons {{{ -# this was default behaviour until grml-live 0.9.34: -if [ -n "$ZERO_LOGFILE" ] ; then - PRESERVE_LOGFILE='' # make sure it's cleaned then - ewarn "Please consider disabling the \$ZERO_LOGFILE option as grml-live clears..." - ewarn "... the logfile $LOGFILE by default (unless \$PRESERVE_LOGFILE is set) nowadays." - eend 0 +# Warn user if addons from grml-live-addons are absent {{{ +if [ -z "${NO_ADDONS:-}" ] && [ ! -r "$TEMPLATE_DIRECTORY"/arch ] ; then + ewarn "Boot addons not found (Consider installing package grml-live-addons)" ; eend 0 fi # }}} -# ask user whether the setup is ok {{{ +# Show configuration and ask user whether to continue {{{ +echo +echo "${PN} [${GRML_LIVE_VERSION}] Build Configuration:" +echo +echo " FAI classes: $CLASSES" +[ -n "$LOCAL_CONFIG" ] && echo " Configuration: $LOCAL_CONFIG" +[ -n "$GRML_FAI_CONFIG" ] && echo " Config directory: $GRML_FAI_CONFIG" +echo " main directory: $OUTPUT" +[ -n "$EXTRACT_ISO_NAME" ] && echo " Extract ISO: $EXTRACT_ISO_NAME" +[ -n "$CHROOT_OUTPUT" ] && echo " Chroot target: $CHROOT_OUTPUT" +[ -n "$BUILD_OUTPUT" ] && echo " Build target: $BUILD_OUTPUT" +[ -n "$ISO_OUTPUT" ] && echo " ISO target: $ISO_OUTPUT" +[ -n "$GRML_NAME" ] && echo " Grml name: $GRML_NAME" +[ -n "$RELEASENAME" ] && echo " Release name: $RELEASENAME" +[ -n "$DATE" ] && echo " Build date: $DATE" +[ -n "$VERSION" ] && echo " Grml version: $VERSION" +[ -n "$SUITE" ] && echo " Debian suite: $SUITE" +[ -n "$ARCH" ] && echo " Architecture: $ARCH" +[ -n "$HYBRID_METHOD" ] && echo " Hybrid method: $HYBRID_METHOD" +[ -n "$SECURE_BOOT" ] && echo " Secure Boot: $SECURE_BOOT" +[ -n "$TEMPLATE_DIRECTORY" ] && echo " Template files: $TEMPLATE_DIRECTORY" +[ -n "$CHROOT_INSTALL" ] && echo " Install files from directory to chroot: $CHROOT_INSTALL" +[ -n "$BOOTID" ] && echo " Boot identifier: $BOOTID" +[ -n "$NO_BOOTID" ] && echo " Skipping bootid feature." +[ -n "$CHOWN_USER" ] && echo " Output owner: $CHOWN_USER" +[ -n "$DEFAULT_BOOTOPTIONS" ] && echo " Adding default bootoptions: \"$DEFAULT_BOOTOPTIONS\"" +[ -n "$FAI_ARGS" ] && echo " Additional arguments for FAI: $FAI_ARGS" +[ -n "$LOGFILE" ] && echo " Logging to file: $LOGFILE" +[ -n "$SQUASHFS_ZLIB" ] && echo " Using ZLIB (instead of LZMA/XZ) compression." +[ -n "$SQUASHFS_OPTIONS" ] && echo " Using SQUASHFS_OPTIONS ${SQUASHFS_OPTIONS}" +[ -n "$VERBOSE" ] && echo " Using VERBOSE mode." +[ -n "$CLEAN_ARTIFACTS" ] && echo " Will clean output before and after running." +[ -n "$UPDATE" ] && echo " Executing UPDATE instead of fresh installation." +if [ -n "$BOOTSTRAP_ONLY" ] ; then + echo " Bootstrapping only and not building (files for) ISO." +else + [ -n "$SKIP_MKSQUASHFS" ] && echo " Skipping creation of SQUASHFS file." + [ -n "$SKIP_NETBOOT" ] && echo " Skipping creation of NETBOOT package." + [ -n "$SKIP_MKISOFS" ] && echo " Skipping creation of ISO file." + [ -n "$NO_ADDONS" ] && echo " Skipping boot addons." + [ -n "$BUILD_ONLY" ] && echo " Executing BUILD_ONLY instead of fresh installation or UPDATE." + [ -n "$BUILD_DIRTY" ] && echo " Executing BUILD_DIRTY to leave chroot untouched." +fi +echo if [ -z "$FORCE" ] ; then + echo "Check the configuration above, or use -F to force execution." echo - echo "${PN} [${GRML_LIVE_VERSION}]: check your configuration (or use -F to force execution):" - echo - echo " FAI classes: $CLASSES" - [ -n "$LOCAL_CONFIG" ] && echo " Configuration: $LOCAL_CONFIG" - [ -n "$GRML_FAI_CONFIG" ] && echo " Config directory: $GRML_FAI_CONFIG" - echo " main directory: $OUTPUT" - [ -n "$EXTRACT_ISO_NAME" ] && echo " Extract ISO: $EXTRACT_ISO_NAME" - [ -n "$CHROOT_OUTPUT" ] && echo " Chroot target: $CHROOT_OUTPUT" - [ -n "$BUILD_OUTPUT" ] && echo " Build target: $BUILD_OUTPUT" - [ -n "$ISO_OUTPUT" ] && echo " ISO target: $ISO_OUTPUT" - [ -n "$GRML_NAME" ] && echo " Grml name: $GRML_NAME" - [ -n "$RELEASENAME" ] && echo " Release name: $RELEASENAME" - [ -n "$DATE" ] && echo " Build date: $DATE" - [ -n "$VERSION" ] && echo " Grml version: $VERSION" - [ -n "$SUITE" ] && echo " Debian suite: $SUITE" - [ -n "$ARCH" ] && echo " Architecture: $ARCH" - [ -n "$HYBRID_METHOD" ] && echo " Hybrid method: $HYBRID_METHOD" - [ -n "$SECURE_BOOT" ] && echo " Secure Boot: $SECURE_BOOT" - [ -n "$TEMPLATE_DIRECTORY" ] && echo " Template files: $TEMPLATE_DIRECTORY" - [ -n "$CHROOT_INSTALL" ] && echo " Install files from directory to chroot: $CHROOT_INSTALL" - [ -n "$BOOTID" ] && echo " Boot identifier: $BOOTID" - [ -n "$NO_BOOTID" ] && echo " Skipping bootid feature." - [ -n "$CHOWN_USER" ] && echo " Output owner: $CHOWN_USER" - [ -n "$DEFAULT_BOOTOPTIONS" ] && echo " Adding default bootoptions: \"$DEFAULT_BOOTOPTIONS\"" - [ -n "$FAI_ARGS" ] && echo " Additional arguments for FAI: $FAI_ARGS" - [ -n "$LOGFILE" ] && echo " Logging to file: $LOGFILE" - [ -n "$SQUASHFS_ZLIB" ] && echo " Using ZLIB (instead of LZMA/XZ) compression." - [ -n "$SQUASHFS_OPTIONS" ] && echo " Using SQUASHFS_OPTIONS ${SQUASHFS_OPTIONS}" - [ -n "$VERBOSE" ] && echo " Using VERBOSE mode." - [ -n "$CLEAN_ARTIFACTS" ] && echo " Will clean output before and after running." - [ -n "$UPDATE" ] && echo " Executing UPDATE instead of fresh installation." - if [ -n "$BOOTSTRAP_ONLY" ] ; then - echo " Bootstrapping only and not building (files for) ISO." - else - [ -n "$SKIP_MKSQUASHFS" ] && echo " Skipping creation of SQUASHFS file." - [ -n "$SKIP_NETBOOT" ] && echo " Skipping creation of NETBOOT package." - [ -n "$SKIP_MKISOFS" ] && echo " Skipping creation of ISO file." - [ -n "$BUILD_ONLY" ] && echo " Executing BUILD_ONLY instead of fresh installation or UPDATE." - [ -n "$BUILD_DIRTY" ] && echo " Executing BUILD_DIRTY to leave chroot untouched." - fi - echo - echo -n "Is this ok for you? [y/N] " - read a - if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then + echo -n "Continue? [y/N] " + read -r a + if ! [ "$a" = 'y' ] || [ "$a" = 'Y' ] ; then CLEAN_ARTIFACTS=0 echo "Exiting as requested." exit 0 @@ -566,29 +554,28 @@ fi # clean up before start {{{ if [ -n "${CLEAN_ARTIFACTS}" ]; then echo "Wiping old artifacts" - [ -n "${CHROOT_OUTPUT}" -a -d "${CHROOT_OUTPUT}" ] && rm -r "${CHROOT_OUTPUT}" - [ -n "${BUILD_OUTPUT}" -a -d "${BUILD_OUTPUT}" ] && rm -r "${BUILD_OUTPUT}" - [ -n "${ISO_OUTPUT}" -a -d "${ISO_OUTPUT}" ] && rm -r "${ISO_OUTPUT}" - [ -n "${LOG_OUTPUT}" -a -d "${LOG_OUTPUT}" ] && rm -r "${LOG_OUTPUT}" - [ -n "${NETBOOT}" -a -d "${NETBOOT}" ] && rm -r "${NETBOOT}" + [ -n "${CHROOT_OUTPUT}" ] && [ -d "${CHROOT_OUTPUT}" ] && rm -r "${CHROOT_OUTPUT}" + [ -n "${BUILD_OUTPUT}" ] && [ -d "${BUILD_OUTPUT}" ] && rm -r "${BUILD_OUTPUT}" + [ -n "${ISO_OUTPUT}" ] && [ -d "${ISO_OUTPUT}" ] && rm -r "${ISO_OUTPUT}" + [ -n "${LOG_OUTPUT}" ] && [ -d "${LOG_OUTPUT}" ] && rm -r "${LOG_OUTPUT}" + [ -n "${NETBOOT}" ] && [ -d "${NETBOOT}" ] && rm -r "${NETBOOT}" fi # }}} # create log file {{{ [ -n "$LOGFILE" ] || LOGFILE=${LOG_OUTPUT}/grml-live.log -mkdir -p $(dirname "${LOGFILE}") -touch $LOGFILE -chown root:adm $LOGFILE -chmod 664 $LOGFILE +mkdir -p "$(dirname "${LOGFILE}")" +touch "$LOGFILE" +chown root:adm "$LOGFILE" +chmod 664 "$LOGFILE" # }}} # clean/zero/remove logfiles {{{ - if [ -n "$PRESERVE_LOGFILE" ] ; then echo "Preserving logfile $LOGFILE as requested via \$PRESERVE_LOGFILE" else - # make sure it is empty (as it is e.g. appended to grml-live-db) - echo -n > $LOGFILE + # make sure it is empty + echo -n > "$LOGFILE" fi if [ -n "$ZERO_FAI_LOGFILE" ] ; then @@ -611,7 +598,8 @@ if [ -n "$CONFIG" ] ; then bailout 1 else log "Sourcing $CONFIG" - . $CONFIG + # shellcheck source=/dev/null + . "$CONFIG" fi fi @@ -626,11 +614,11 @@ log "$CMDLINE" einfo "Logging actions to logfile $LOGFILE" # }}} -# dump config variables into file, for script access {{{ +# dump config variables into file, for hooks/scripts access {{{ CONFIGDUMP=$(mktemp) set | grep -E \ - '^(GRML_NAME|RELEASENAME|DATE|VERSION|SUITE|ARCH|DISTRI_NAME|USERNAME|HOSTNAME|APT_PROXY)=' \ - > ${CONFIGDUMP} + '^(GRML_NAME|RELEASENAME|DATE|VERSION|SUITE|ARCH|DISTRI_NAME|TEMPLATE_DIRECTORY|USERNAME|HOSTNAME|APT_PROXY|BUILD_ONLY|BOOTSTRAP_ONLY|WAYBACK_DATE)=' \ + > "${CONFIGDUMP}" # }}} # unpack iso/squashfs {{{ @@ -638,23 +626,24 @@ extract_iso() { if [ -n "$EXTRACT_ISO_NAME" ]; then log "Unpacking ISO from ${EXTRACT_ISO_NAME}" einfo "Unpacking ISO from ${EXTRACT_ISO_NAME}" - local mountpoint=$(mktemp -d) local rc=0 - mount -o loop "${EXTRACT_ISO_NAME}" "$mountpoint" ; rc=$? + local tempdir + tempdir=$(mktemp -d) + mkdir -p "${tempdir}/live/" + osirrox -indev "${EXTRACT_ISO_NAME}" -extract live "${tempdir}/live/" ; rc=$? if [ "$rc" != 0 ]; then - rmdir "$mountpoint" - log "mount failed" - eerror "mount failed" + rm -rf "$tempdir" + log "osirrox failed" + eerror "osirrox failed" eend 1 bailout 1 fi - if ls "${mountpoint}"/live/*/*.squashfs 2>/dev/null | grep -q . ; then # ISOs >=2011.12 - log "Using ${mountpoint}/live/*/*.squashfs for unsquashfs" - unsquashfs -d "${CHROOT_OUTPUT}" "${mountpoint}"/live/*/*.squashfs ; rc=$? - elif ls "${mountpoint}"/live/*.squashfs 2>/dev/null | grep -q . ; then # ISOs before 2011.12 - log "Using ${mountpoint}/live/*.squashfs for unsquashfs" - unsquashfs -d "${CHROOT_OUTPUT}" "${mountpoint}"/live/*.squashfs ; rc=$? + local squashfs + squashfs=( "${tempdir}"/live/*/*.squashfs ) + if (( ${#squashfs[@]} != 0 )) && [ -r "${squashfs[0]}" ]; then + log "Will unsquashfs ${squashfs[0]}" + unsquashfs -d "${CHROOT_OUTPUT}" "${squashfs[0]}" ; rc=$? else log "Error: Could not find any *.squashfs files on the ISO" eerror "Error: Could not find any *.squashfs files on the ISO" @@ -662,8 +651,7 @@ if [ -n "$EXTRACT_ISO_NAME" ]; then bailout 1 fi - umount "$mountpoint" - rmdir "$mountpoint" + rm -rf "$tempdir" if [ "$rc" != 0 ]; then log "unsquashfs failed" eerror "unsquashfs failed" @@ -684,13 +672,13 @@ case "${SUITE}" in # avoid having to maintain DEBIAN_UNSTABLE *and* DEBIAN_SID class files: sid) CLASSES="DEBIAN_UNSTABLE,$CLASSES" ;; # otherwise map e.g. bookworm to DEBIAN_BOOKWORM: - *) CLASSES="DEBIAN_$(echo $SUITE | tr 'a-z' 'A-Z'),$CLASSES";; + *) CLASSES="DEBIAN_$(echo "$SUITE" | tr '[:lower:]' '[:upper:]'),$CLASSES";; esac export SUITE # make sure it's available in FAI scripts # validate whether the specified architecture class matches the # architecture (option), otherwise installation of kernel will fail -if echo $CLASSES | grep -qw I386 ; then +if hasclass I386 ; then if ! [[ "$ARCH" == "i386" ]] ; then log "Error: You specified the I386 class but are trying to build something else (AMD64/ARM64?)." eerror "Error: You specified the I386 class but are trying to build something else (AMD64/ARM64?)." @@ -698,7 +686,7 @@ if echo $CLASSES | grep -qw I386 ; then eend 1 bailout fi -elif echo $CLASSES | grep -qi amd64 ; then +elif hasclass AMD64 ; then if ! [[ "$ARCH" == "amd64" ]] ; then log "Error: You specified the AMD64 class but are trying to build something else (I386/ARM64?)." eerror "Error: You specified the AMD64 class but are trying to build something else (I386/ARM64?)." @@ -706,7 +694,7 @@ elif echo $CLASSES | grep -qi amd64 ; then eend 1 bailout fi -elif echo $CLASSES | grep -qi arm64 ; then +elif hasclass ARM64 ; then if ! [[ "$ARCH" == "arm64" ]] ; then log "Error: You specified the ARM64 class but are trying to build something else (I386/AMD64?)." eerror "Error: You specified the ARM64 class but are trying to build something else (I386/AMD64?)." @@ -724,12 +712,19 @@ if [[ -n "${BOOT_METHOD:-}" ]] && [[ "${BOOT_METHOD}" != "isolinux" ]] ; then bailout fi -# generate nfsroot configuration for FAI on the fly +# generate FAI configuration on the fly +FAI_CONF_DIR=$(mktemp -d) + +echo "# This is an automatically generated file by grml-live. +# Do NOT edit this file, your changes will be lost. +LOGUSER= +# EOF " > "${FAI_CONF_DIR}/fai.conf" + if [ -z "$FAI_DEBOOTSTRAP" ] ; then if [ -n "$WAYBACK_DATE" ] ; then FAI_DEBOOTSTRAP="$SUITE http://snapshot.debian.org/archive/debian/$WAYBACK_DATE/" else - FAI_DEBOOTSTRAP="$SUITE http://ftp.debian.org/debian" + FAI_DEBOOTSTRAP="$SUITE http://deb.debian.org/debian" fi fi @@ -741,7 +736,7 @@ echo "# This is an automatically generated file by grml-live. # Do NOT edit this file, your changes will be lost. FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\" FAI_DEBOOTSTRAP_OPTS=\"$FAI_DEBOOTSTRAP_OPTS\" -# EOF " > "${GRML_FAI_CONFIG}/nfsroot.conf" +# EOF " > "${FAI_CONF_DIR}/nfsroot.conf" # }}} # CHROOT_OUTPUT - execute FAI {{{ @@ -751,13 +746,13 @@ if [ -n "$BUILD_DIRTY" ]; then else [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot" - if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then + if [ -n "$UPDATE" ] || [ -n "$BUILD_ONLY" ] ; then FAI_ACTION=softupdate else FAI_ACTION=dirinstall fi - if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then + if [ -n "$UPDATE" ] || [ -n "$BUILD_ONLY" ] ; then if ! [ -r "$CHROOT_OUTPUT/etc/debian_version" ] ; then log "Error: does not look like you have a working chroot. Updating/building not possible." eerror "Error: does not look like you have a working chroot. Updating/building not possible. (Drop -u/-b option?)" @@ -766,7 +761,7 @@ else fi fi - if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then + if [ -d "$CHROOT_OUTPUT/bin" ] && [ -z "$UPDATE" ] && [ -z "$BUILD_ONLY" ] ; then log "Skipping stage 'fai dirinstall' as $CHROOT_OUTPUT exists already." ewarn "Skipping stage 'fai dirinstall' as $CHROOT_OUTPUT exists already." ; eend 0 else @@ -777,15 +772,16 @@ else mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" fi - mkdir -p "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/" - mount --bind "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/" + mkdir -p "${OUTPUT}"/grml_sources "${CHROOT_OUTPUT}"/grml-live/ + mv "${OUTPUT}"/grml_sources "${CHROOT_OUTPUT}"/grml-live/ log "Executed FAI command line:" - log "BUILD_ONLY=$BUILD_ONLY BOOTSTRAP_ONLY=$BOOTSTRAP_ONLY GRML_LIVE_CONFIG=$CONFIGDUMP WAYBACK_DATE=$WAYBACK_DATE fai $VERBOSE -C $GRML_FAI_CONFIG -s file:///$GRML_FAI_CONFIG/config -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS" - BUILD_ONLY="$BUILD_ONLY" BOOTSTRAP_ONLY="$BOOTSTRAP_ONLY" GRML_LIVE_CONFIG="$CONFIGDUMP" fai $VERBOSE \ - -C "$GRML_FAI_CONFIG" -s "file:///$GRML_FAI_CONFIG/config" -c"$CLASSES" \ - -u "$HOSTNAME" "$FAI_ACTION" "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE - RC="$PIPESTATUS" # notice: bash-only + log "GRML_LIVE_CONFIG=$CONFIGDUMP $FAI_PROGRAM $VERBOSE -C $FAI_CONF_DIR -s file:///$GRML_FAI_CONFIG -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS" + # shellcheck disable=SC2086 # $FAI_ARGS needs splitting + GRML_LIVE_CONFIG="$CONFIGDUMP" "$FAI_PROGRAM" $VERBOSE \ + -C "$FAI_CONF_DIR" -s "file:///$GRML_FAI_CONFIG" -c"$CLASSES" \ + -u "$HOSTNAME" "$FAI_ACTION" "$CHROOT_OUTPUT" $FAI_ARGS 2>&1 | tee -a "$LOGFILE" + RC="${PIPESTATUS[0]}" # notice: bash-only if [ "$RC" != 0 ] ; then store_logfiles # ensure to have logfiles available even if building failed @@ -794,6 +790,9 @@ else bailout 1 fi + mv "${CHROOT_OUTPUT}"/grml-live/grml_sources/ "${OUTPUT}" + rmdir "${CHROOT_OUTPUT}"/grml-live + # provide inform fai about the ISO we build, needs to be provided # *after* FAI stage, otherwise FAI skips the debootstrap stage if # there is not BASEFILE (as it checks for presence of /etc) :( @@ -812,21 +811,21 @@ else CHECKLOG="$LOG_OUTPUT"/fai/ if [ -r "$CHECKLOG/software.log" ] ; then # 1 errors during executing of commands - grep 'dpkg: error processing' $CHECKLOG/software.log >> $LOGFILE && ERROR=1 - grep 'E: Method http has died unexpectedly!' $CHECKLOG/software.log >> $LOGFILE && ERROR=2 - grep 'ERROR: chroot' $CHECKLOG/software.log >> $LOGFILE && ERROR=3 - grep 'E: Failed to fetch' $CHECKLOG/software.log >> $LOGFILE && ERROR=4 - grep 'Unable to write mmap - msync (28 No space left on device)' $CHECKLOG/software.log >> $LOGFILE && ERROR=5 + grep 'dpkg: error processing' "$CHECKLOG/software.log" >> "$LOGFILE" && ERROR=1 + grep 'E: Method http has died unexpectedly!' "$CHECKLOG/software.log" >> "$LOGFILE" && ERROR=2 + grep 'ERROR: chroot' "$CHECKLOG/software.log" >> "$LOGFILE" && ERROR=3 + grep 'E: Failed to fetch' "$CHECKLOG/software.log" >> "$LOGFILE" && ERROR=4 + grep 'Unable to write mmap - msync (28 No space left on device)' "$CHECKLOG/software.log" >> "$LOGFILE" && ERROR=5 fi # FAI versions <6.0 used to write to shell.log if [ -r "$CHECKLOG/shell.log" ] ; then - grep 'FAILED with exit code' $CHECKLOG/shell.log >> $LOGFILE && ERROR=6 + grep 'FAILED with exit code' "$CHECKLOG/shell.log" >> "$LOGFILE" && ERROR=6 fi # FAI versions >=6.0 always writes to scripts.log if [ -r "$CHECKLOG/scripts.log" ] ; then - grep 'FAILED with exit code' $CHECKLOG/scripts.log >> $LOGFILE && ERROR=6 + grep 'FAILED with exit code' "$CHECKLOG/scripts.log" >> "$LOGFILE" && ERROR=6 fi if [ -r "$CHECKLOG/fai.log" ] ; then @@ -892,6 +891,7 @@ else EOF + # shellcheck disable=SC2013 # We expect each line to be a single word. for package in $(awk '{print $1}' "${CHECKLOG}/package_errors.log" | sed 's;/;\\/;') ; do failure_reason="$(awk "/$package/ {print \$2}" "${CHECKLOG}/package_errors.log")" cat >> "${REPORT_MISSING_PACKAGES}" << EOF @@ -912,7 +912,7 @@ EOF EOF eend 0 - if [ -n "$EXIT_ON_MISSING_PACKAGES" -a -z "$BUILD_DIRTY" ] ; then + if [ -n "$EXIT_ON_MISSING_PACKAGES" ] && [ -z "$BUILD_DIRTY" ] ; then eerror "The following packages were requested for installation but could not be processed:" cat "$CHECKLOG/package_errors.log" eerror "... exiting as requested via \$EXIT_ON_MISSING_PACKAGES." @@ -945,18 +945,28 @@ grub_setup() { ;; amd64) BOOTX64="/boot/bootx64.efi" + BOOTX32="/boot/bootia32.efi" ;; esac - # important: this depends on execution of ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images + # important: this depends on execution of ${GRML_FAI_CONFIG}/scripts/GRMLBASE/45-grub-images if ! [ -r "${CHROOT_OUTPUT}/${BOOTX64}" ] ; then - log "Can not access GRUB efi image ${CHROOT_OUTPUT}/${BOOTX64}, required for Secure Boot support" - eerror "Can not access GRUB efi image ${CHROOT_OUTPUT}/${BOOTX64}, required for Secure Boot support" ; eend 1 - log "Possible reason is failure to run ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images" - ewarn "Possible reason is failure to run ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images" + log "Cannot access GRUB UEFI image ${CHROOT_OUTPUT}/${BOOTX64}, required for Secure Boot support" + eerror "Cannot access GRUB UEFI image ${CHROOT_OUTPUT}/${BOOTX64}, required for Secure Boot support" ; eend 1 + log "Possible reason is failure to run ${GRML_FAI_CONFIG}/scripts/GRMLBASE/45-grub-images" + ewarn "Possible reason is failure to run ${GRML_FAI_CONFIG}/scripts/GRMLBASE/45-grub-images" bailout 50 fi + # UEFI 32bit boot support, only supported with Debian trixie and newer, + # so make it optional and don't fail hard + if [[ "$ARCH" == "amd64" ]] && ! [ -r "${CHROOT_OUTPUT}/${BOOTX32}" ] ; then + local uefi_32bit_support + uefi_32bit_support=0 + log "Cannot access GRUB 32-bit PC EFI image ${CHROOT_OUTPUT}/${BOOTX32}, disabling UEFI 32bit boot support." + ewarn "Cannot access GRUB 32-bit PC EFI image ${CHROOT_OUTPUT}/${BOOTX32}, disabling UEFI 32bit boot support" ; eend 0 + fi + dd if=/dev/zero of="${CHROOT_OUTPUT}/${EFI_IMG}" bs="${efi_size}" count=1 2>/dev/null || bailout 50 mkfs.vfat -n GRML "${CHROOT_OUTPUT}/${EFI_IMG}" >/dev/null || bailout 51 mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI || bailout 52 @@ -966,18 +976,23 @@ grub_setup() { log "Secure Boot is disabled." einfo "Secure Boot is disabled." ; eend 0 - # install "$BOOTX64" as ::EFI/BOOT/{bootx64.efi|bootaa64.efi} inside image file "$EFI_IMG": + # install "$BOOTX64" as ::EFI/BOOT/{bootx64.efi|bootaa64.efi} inside image file "$EFI_IMG", + # and if present also "$BOOTX32" as ::EFI/BOOT/bootia32.efi on amd64 for UEFI 32bit boot support: case "$ARCH" in arm64) mcopy -i "${CHROOT_OUTPUT}/${EFI_IMG}" "${CHROOT_OUTPUT}/${BOOTX64}" ::EFI/BOOT/bootaa64.efi >/dev/null || bailout 53 ;; amd64) mcopy -i "${CHROOT_OUTPUT}/${EFI_IMG}" "${CHROOT_OUTPUT}/${BOOTX64}" ::EFI/BOOT/bootx64.efi >/dev/null || bailout 53 + # UEFI 32bit boot + if [ "${uefi_32bit_support:-}" != "0" ] ; then + mcopy -i "${CHROOT_OUTPUT}/${EFI_IMG}" "${CHROOT_OUTPUT}/${BOOTX32}" ::EFI/BOOT/bootia32.efi >/dev/null || bailout 53 + fi ;; esac - log "Generated 64-bit EFI image $BOOTX64" - einfo "Generated 64-bit EFI image $BOOTX64" ; eend 0 + log "Created UEFI image $EFI_IMG from $BOOTX64 ${BOOTX32:-}" + einfo "Created UEFI image $EFI_IMG from $BOOTX64 ${BOOTX32:-}" ; eend 0 else case "${SECURE_BOOT}" in disable*) @@ -989,7 +1004,8 @@ grub_setup() { einfo "Secure Boot is enabled [mode: ${SECURE_BOOT}]" ; eend 0 local GRUBCFG_TEMPLATE="${TEMPLATE_DIRECTORY}/secureboot/grub.cfg" - local GRUBCFG_TMP=$(mktemp) + local GRUBCFG_TMP + GRUBCFG_TMP=$(mktemp) if ! [ -r "${GRUBCFG_TEMPLATE}" ] ; then log "Secure Boot template for GRUB [${GRUBCFG_TEMPLATE}] not found." @@ -1022,8 +1038,8 @@ grub_setup() { bailout 57 fi - log "Generated 64-bit Secure Boot (${SECURE_BOOT}) EFI image ${CHROOT_OUTPUT}/${EFI_IMG}" - einfo "Generated 64-bit Secure Boot (${SECURE_BOOT}) EFI image ${CHROOT_OUTPUT}/${EFI_IMG}" ; eend 0 + log "Created Secure Boot (${SECURE_BOOT}) UEFI image ${CHROOT_OUTPUT}/${EFI_IMG}" + einfo "Created Secure Boot (${SECURE_BOOT}) UEFI image ${CHROOT_OUTPUT}/${EFI_IMG}" ; eend 0 ;; *) log "Secure Boot method '${SECURE_BOOT}' is unsupported." @@ -1037,10 +1053,10 @@ grub_setup() { if [[ "$ARCH" == "i386" ]] ; then BOOTX32="/boot/bootia32.efi" if ! [ -r "${CHROOT_OUTPUT}/${BOOTX32}" ] ; then - log "Can not access GRUB efi image ${CHROOT_OUTPUT}/${BOOTX32}." - eerror "Can not access GRUB efi image ${CHROOT_OUTPUT}/${BOOTX32}." ; eend 1 - log "Possible reason is failure to run ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images" - ewarn "Possible reason is failure to run ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images" + log "Cannot access GRUB 32-bit PC EFI image ${CHROOT_OUTPUT}/${BOOTX32}." + eerror "Cannot access GRUB 32-bit PC EFI image ${CHROOT_OUTPUT}/${BOOTX32}." ; eend 1 + log "Possible reason is failure to run ${GRML_FAI_CONFIG}/scripts/GRMLBASE/45-grub-images" + ewarn "Possible reason is failure to run ${GRML_FAI_CONFIG}/scripts/GRMLBASE/45-grub-images" bailout 50 fi @@ -1049,8 +1065,8 @@ grub_setup() { mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI || bailout 52 mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI/BOOT || bailout 52 mcopy -i "${CHROOT_OUTPUT}/${EFI_IMG}" "${CHROOT_OUTPUT}/${BOOTX32}" ::EFI/BOOT/bootia32.efi >/dev/null || bailout 53 - log "Generated 32-bit EFI image $BOOTX32" - einfo "Generated 32-bit EFI image $BOOTX32" ; eend 0 + log "Created 32-bit PC EFI image $EFI_IMG from $BOOTX32" + einfo "Created 32-bit PC EFI image $EFI_IMG from $BOOTX32" ; eend 0 fi } # }}} @@ -1060,297 +1076,279 @@ grub_setup() { mkdir -p "$BUILD_OUTPUT" || bailout 6 "Problem with creating $BUILD_OUTPUT for stage ARCH" # prepare ISO -if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] || [ "$ARCH" = arm64 ] ; then - if [ -n "$BOOTSTRAP_ONLY" ] ; then - log "Skipping stage 'boot' as building with bootstrap only." - ewarn "Skipping stage 'boot' as building with bootstrap only." ; eend 0 +if [ -n "$BOOTSTRAP_ONLY" ] ; then + log "Skipping stage 'boot' as building with bootstrap only." + ewarn "Skipping stage 'boot' as building with bootstrap only." ; eend 0 +else + # Install boot code + mkdir -p "$BUILD_OUTPUT"/boot/"${SHORT_NAME}" + + # this is a variable we're using for adjusting boot templates, not only in + # adjust_boot_files though, so set here + RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME" + + # if we don't have an initrd we a) can't boot and b) there was an error + # during build, so check for the file: + # shellcheck disable=SC2010 disable=SC2012 # We do not expect fancy characters here. + INITRD=$(ls "$CHROOT_OUTPUT"/boot/initrd* 2>/dev/null| grep -v '.bak$' | sort -r | head -1) + if [ -n "$INITRD" ] ; then + cp "$INITRD" "$BUILD_OUTPUT"/boot/"${SHORT_NAME}"/initrd.img + find "$CHROOT_OUTPUT"/boot/ -name initrd\*.bak -exec rm {} \; else - # booting stuff: - mkdir -p "$BUILD_OUTPUT"/boot/isolinux - mkdir -p "$BUILD_OUTPUT"/boot/"${SHORT_NAME}" - - # this is a variable we're using for adjusting boot templates, not only in - # adjust_boot_files though, so set here - RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME" - - # if we don't have an initrd we a) can't boot and b) there was an error - # during build, so check for the file: - INITRD="$(ls $CHROOT_OUTPUT/boot/initrd* 2>/dev/null| grep -v '.bak$' | sort -r | head -1)" - if [ -n "$INITRD" ] ; then - cp $INITRD "$BUILD_OUTPUT"/boot/"${SHORT_NAME}"/initrd.img - find $CHROOT_OUTPUT/boot/ -name initrd\*.bak -exec rm {} \; - else - log "Error: No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" - eerror "Error: No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 - bailout 10 - fi + log "Error: No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" + eerror "Error: No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 + bailout 10 + fi - KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* 2>/dev/null | sort -r | head -1)" - if [ -n "$KERNEL_IMAGE" ] ; then - cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/"${SHORT_NAME}"/vmlinuz - else - log "Error: No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" - eerror "Error: No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 - bailout 11 - fi + # shellcheck disable=SC2010 disable=SC2012 # We do not expect fancy characters here. + KERNEL_IMAGE=$(ls "$CHROOT_OUTPUT"/boot/vmlinuz* 2>/dev/null | sort -r | head -1) + if [ -n "$KERNEL_IMAGE" ] ; then + cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/"${SHORT_NAME}"/vmlinuz + else + log "Error: No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" + eerror "Error: No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 + bailout 11 + fi - # we need to set "$BOOTID" before we invoke adjust_boot_files for the - # first time, being inside grub_setup below - if [ -n "$NO_BOOTID" ] ; then - log 'Skipping bootid feature as requested via $NO_BOOTID.' - einfo 'Skipping bootid feature as requested via $NO_BOOTID.' - else - [ -n "$BOOTID" ] || BOOTID="$(echo ${GRML_NAME}${VERSION} | tr -d ',./;\- ')" - mkdir -p "$BUILD_OUTPUT"/conf - einfo "Generating /conf/bootid.txt with entry ${BOOTID}." - log "Generating /conf/bootid.txt with entry ${BOOTID}." - echo "$BOOTID" > "$BUILD_OUTPUT"/conf/bootid.txt - eend $? - fi + # we need to set "$BOOTID" before we invoke adjust_boot_files for the + # first time, being inside grub_setup below + if [ -n "$NO_BOOTID" ] ; then + log "Skipping bootid feature as requested via \$NO_BOOTID." + einfo "Skipping bootid feature as requested via \$NO_BOOTID." + else + [ -n "$BOOTID" ] || BOOTID=$(echo "${GRML_NAME}${VERSION}" | tr -d ',./;\- ') + mkdir -p "$BUILD_OUTPUT"/conf + einfo "Generating /conf/bootid.txt with entry ${BOOTID}." + log "Generating /conf/bootid.txt with entry ${BOOTID}." + echo "$BOOTID" > "$BUILD_OUTPUT"/conf/bootid.txt + eend 0 + fi - # every recent Grml ISO ships a /conf/bootid.txt, though GRUB might find - # the /conf/bootid.txt of a different (Grml) ISO than the one that's - # supposed to be running, so within scripts/GRMLBASE/45-grub-images - # we generate a random filename, stored inside /boot/grub/bootfile.txt, - # which we place on the resulting ISO here - if [ -r "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt ] ; then - mkdir -p "${BUILD_OUTPUT}"/conf - rm -f "${BUILD_OUTPUT}"/conf/bootfile* # ensure we don't leave any old(er) files behind - - einfo "Generating "${BUILD_OUTPUT}"/conf/bootfile* files" - log "Generating "${BUILD_OUTPUT}"/conf/bootfile* files" - - BOOT_FILE="/conf/bootfile_$(cat "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt)" - echo "# This file is relevant for GRUB boot with the Grml ISO." > "${BUILD_OUTPUT}/${BOOT_FILE}" - # save information about the random filename inside /conf/bootfile.txt - echo "${BOOT_FILE}" > "${BUILD_OUTPUT}"/conf/bootfile.txt - eend $? - fi + # every recent Grml ISO ships a /conf/bootid.txt, though GRUB might find + # the /conf/bootid.txt of a different (Grml) ISO than the one that's + # supposed to be running, so within scripts/GRMLBASE/45-grub-images + # we generate a random filename, stored inside /boot/grub/bootfile.txt, + # which we place on the resulting ISO here + if [ -r "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt ] ; then + mkdir -p "${BUILD_OUTPUT}"/conf + rm -f "${BUILD_OUTPUT}"/conf/bootfile* # ensure we don't leave any old(er) files behind + + einfo "Generating ${BUILD_OUTPUT}/conf/bootfile* files" + log "Generating ${BUILD_OUTPUT}/conf/bootfile* files" + + BOOT_FILE="/conf/bootfile_$(cat "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt)" + echo "# This file is relevant for GRUB boot with the Grml ISO." > "${BUILD_OUTPUT}/${BOOT_FILE}" + # save information about the random filename inside /conf/bootfile.txt + echo "${BOOT_FILE}" > "${BUILD_OUTPUT}"/conf/bootfile.txt + eend 0 + fi - grub_setup - - # EFI boot files - if [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootaa64.efi" ] ; then - einfo "Copying 64-bit EFI boot files (arm64) into ISO path." - log "Copying 64-bit EFI boot files (arm64) into ISO path." - RC=$0 - cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/" || RC=$? - mkdir -p "${BUILD_OUTPUT}/EFI/BOOT/" || RC=$? - cp "${CHROOT_OUTPUT}/boot/bootaa64.efi" "${BUILD_OUTPUT}/EFI/BOOT/bootaa64.efi" || RC=$? - eend $? - elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootx64.efi" ] ; then - einfo "Copying 64-bit EFI boot files (amd64) into ISO path." - log "Copying 64-bit EFI boot files (amd64) into ISO path." - RC=$0 - cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/" || RC=$? - mkdir -p "${BUILD_OUTPUT}/EFI/BOOT/" || RC=$? - cp "${CHROOT_OUTPUT}/boot/bootx64.efi" "${BUILD_OUTPUT}/EFI/BOOT/bootx64.efi" || RC=$? - eend $? - elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootia32.efi" ] ; then - einfo "Copying 32-bit EFI boot files into ISO path." - log "Copying 32-bit EFI boot files into ISO path." - RC=$0 - cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/" || RC=$? - mkdir -p "${BUILD_OUTPUT}/EFI/BOOT/" || RC=$? - cp "${CHROOT_OUTPUT}/boot/bootia32.efi" "${BUILD_OUTPUT}/EFI/BOOT/bootia32.efi" || RC=$? - eend $? - else - ewarn "No EFI boot files found, skipping." ; eend 0 - fi + grub_setup + + # EFI boot files + if [ -r "${CHROOT_OUTPUT}/boot/efi.img" ] && [ -r "${CHROOT_OUTPUT}/boot/bootaa64.efi" ] ; then + einfo "Copying 64-bit EFI boot files (arm64) into ISO path." + log "Copying 64-bit EFI boot files (arm64) into ISO path." + RC=0 + cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/" || RC=$? + mkdir -p "${BUILD_OUTPUT}/EFI/BOOT/" || RC=$? + cp "${CHROOT_OUTPUT}/boot/bootaa64.efi" "${BUILD_OUTPUT}/EFI/BOOT/bootaa64.efi" || RC=$? + eend "$RC" + elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" ] && [ -r "${CHROOT_OUTPUT}/boot/bootx64.efi" ] ; then + einfo "Copying 64-bit EFI boot files (amd64) into ISO path." + log "Copying 64-bit EFI boot files (amd64) into ISO path." + RC=0 + cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/" || RC=$? + mkdir -p "${BUILD_OUTPUT}/EFI/BOOT/" || RC=$? + cp "${CHROOT_OUTPUT}/boot/bootx64.efi" "${BUILD_OUTPUT}/EFI/BOOT/bootx64.efi" || RC=$? + eend "$RC" + elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" ] && [ -r "${CHROOT_OUTPUT}/boot/bootia32.efi" ] ; then + einfo "Copying 32-bit EFI boot files into ISO path." + log "Copying 32-bit EFI boot files into ISO path." + RC=0 + cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/" || RC=$? + mkdir -p "${BUILD_OUTPUT}/EFI/BOOT/" || RC=$? + cp "${CHROOT_OUTPUT}/boot/bootia32.efi" "${BUILD_OUTPUT}/EFI/BOOT/bootia32.efi" || RC=$? + eend "$RC" + else + ewarn "No EFI boot files found, skipping." ; eend 0 + fi - [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates' - if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then - log "Error: ${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." - eerror "Error: ${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1 - bailout 8 - fi + if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then + log "Error: ${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." + eerror "Error: ${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1 + bailout 8 + fi + + mkdir -p "${BUILD_OUTPUT}"/boot/addons + if [ "$ARCH" != "arm64" ] ; then # copy _required_ isolinux files - if [ -d "${CHROOT_OUTPUT}/usr/lib/ISOLINUX" ] ; then - copy_addon_file isolinux.bin /usr/lib/ISOLINUX isolinux - for file in ${CHROOT_OUTPUT}/usr/lib/syslinux/modules/bios/*.c32 ; do - copy_addon_file "$(basename "$file")" /usr/lib/syslinux/modules/bios/ isolinux - done - else # syslinux versions <= 3:4.05+dfsg-6+deb8u1 - copy_addon_file isolinux.bin /usr/lib/syslinux isolinux - copy_addon_file ifcpu64.c32 /usr/lib/syslinux isolinux - copy_addon_file vesamenu.c32 /usr/lib/syslinux isolinux - fi + mkdir -p "${BUILD_OUTPUT}"/boot/isolinux + copy_file_logged "${BUILD_OUTPUT}"/boot/isolinux/isolinux.bin "${CHROOT_OUTPUT}" /usr/lib/ISOLINUX/isolinux.bin + for file in "${CHROOT_OUTPUT}"/usr/lib/syslinux/modules/bios/*.c32 ; do + file_basename=$(basename "$file") + # Skip "big" files we do not use. + if [ "$file_basename" != "zzjson.c32" ] && \ + [ "$file_basename" != "lua.c32" ] && \ + [ "$file_basename" != "liblua.c32" ] && \ + [[ "$file_basename" != *test.c32 ]] ; then + copy_file_logged "${BUILD_OUTPUT}"/boot/isolinux/"$file_basename" "${CHROOT_OUTPUT}" /usr/lib/syslinux/modules/bios/"$file_basename" + fi + done # *always* copy files to output directory so the variables # get adjusted according to the build. - cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/ - - mkdir -p "${BUILD_OUTPUT}/boot/grub" - cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/ - - if [ -n "$NO_ADDONS" ] ; then - rm -f "$BUILD_OUTPUT"/boot/grub/addons.cfg - log "Skipping installation of boot addons as requested via \$NO_ADDONS." - einfo "Skipping installation of boot addons as requested via \$NO_ADDONS."; eend 0 - else - if ! [ -r "$TEMPLATE_DIRECTORY"/boot/addons ] ; then - log "Boot addons not found, skipping therefore. (Consider installing package grml-live-addons)" - ewarn "Boot addons not found, skipping therefore. (Consider installing package grml-live-addons)" ; eend 0 - else - log "Installing boot addons." - einfo "Installing boot addons." - - # copy addons from system packages or grml-live-addons - copy_addon_file ipxe.lkrn /usr/lib/ipxe addons - copy_addon_file ipxe.efi /usr/lib/ipxe addons - copy_addon_file pci.ids /usr/share/misc addons - - # memtest86+ >=6.00-1 - if [[ "$ARCH" == "amd64" ]] ; then - copy_addon_file memtest86+x64.efi /boot addons - elif [[ "$ARCH" == "i386" ]] ; then - copy_addon_file memtest86+ia32.efi /boot addons - fi - - # provide memtest86+ >=6.00-1 files as "memtest" file - # for BIOS boot in isolinux/syslinux - if ! [ -r "${BUILD_OUTPUT}/boot/addons/memtest" ] ; then - if [[ "$ARCH" == "amd64" ]] ; then - copy_addon_file memtest86+x64.bin /boot addons && - # make memtest filename FAT16/8.3 compatible - mv "${BUILD_OUTPUT}/boot/addons/memtest86+x64.bin" \ - "${BUILD_OUTPUT}/boot/addons/memtest" - elif [[ "$ARCH" == "i386" ]] ; then - copy_addon_file memtest86+ia32.bin /boot addons && - # make memtest filename FAT16/8.3 compatible - mv "${BUILD_OUTPUT}/boot/addons/memtest86+ia32.bin" \ - "${BUILD_OUTPUT}/boot/addons/memtest" - fi - fi + cp "${TEMPLATE_DIRECTORY}"/boot/isolinux/* "${BUILD_OUTPUT}"/boot/isolinux/ - # fallback: if we still don't have /boot/addons/memtest available, we - # might have an older memtest86+ version (<=5.01-3.1) which ships - # file "memtest86+.bin" instead - if ! [ -r "${BUILD_OUTPUT}/boot/addons/memtest" ] ; then - copy_addon_file memtest86+.bin /boot addons && - # make memtest filename FAT16/8.3 compatible - mv "${BUILD_OUTPUT}/boot/addons/memtest86+.bin" \ - "${BUILD_OUTPUT}/boot/addons/memtest" - fi + # only for syslinux hdt. + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/pci.ids "${CHROOT_OUTPUT}" /usr/share/misc/pci.ids + fi - # since syslinux(-common) v3:6.03~pre1+dfsg-4 the files are in a - # different directory :( - if [ -d "${CHROOT_OUTPUT}/usr/lib/syslinux/modules/bios/" ] ; then - syslinux_modules_dir=/usr/lib/syslinux/modules/bios/ - else - syslinux_modules_dir=/usr/lib/syslinux - fi - for file in chain.c32 hdt.c32 mboot.c32 menu.c32; do - copy_addon_file "${file}" "${syslinux_modules_dir}" addons - done + mkdir -p "${BUILD_OUTPUT}/boot/grub" + cp -a "${TEMPLATE_DIRECTORY}"/boot/grub/* "$BUILD_OUTPUT"/boot/grub/ - copy_addon_file memdisk /usr/lib/syslinux addons + if [ -n "$NO_ADDONS" ] ; then + rm -f "$BUILD_OUTPUT"/boot/grub/addons.cfg + log "Skipping installation of boot addons as \$NO_ADDONS=${NO_ADDONS}." + einfo "Skipping installation of boot addons as \$NO_ADDONS=${NO_ADDONS}."; eend 0 + else + log "Installing boot addons." + einfo "Installing boot addons." + + # copy from chroot-installed packages + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/ipxe.lkrn "${CHROOT_OUTPUT}" /usr/lib/ipxe/ipxe.lkrn + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/ipxe.efi "${CHROOT_OUTPUT}" /usr/lib/ipxe/ipxe.efi + + # memtest86+ >=6.00-1 + if [[ "$ARCH" == "amd64" ]] ; then + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/memtest86+x64.efi "${CHROOT_OUTPUT}" /boot/memtest86+x64.efi + elif [[ "$ARCH" == "i386" ]] ; then + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/memtest86+ia32.efi "${CHROOT_OUTPUT}" /boot/memtest86+ia32.efi + fi - # copy only files so we can handle bsd4grml on its own - for file in ${TEMPLATE_DIRECTORY}/boot/addons/* ; do - test -f $file && cp $file "$BUILD_OUTPUT"/boot/addons/ - done + # provide memtest86+ >=6.00-1 files as "memtest" file + # for BIOS boot in isolinux/syslinux + if ! [ -r "${BUILD_OUTPUT}/boot/addons/memtest" ] ; then + if [[ "$ARCH" == "amd64" ]] ; then + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/memtest "${CHROOT_OUTPUT}" /boot/memtest86+x64.bin + elif [[ "$ARCH" == "i386" ]] ; then + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/memtest "${CHROOT_OUTPUT}" /boot/memtest86+ia32.bin + fi + fi - eend 0 + # fallback: if we still don't have /boot/addons/memtest available, we + # might have an older memtest86+ version (<=5.01-3.1) which ships + # file "memtest86+.bin" instead + if ! [ -r "${BUILD_OUTPUT}/boot/addons/memtest" ] ; then + copy_file_logged "${BUILD_OUTPUT}"/boot/addons/memtest "${CHROOT_OUTPUT}" /boot/memtest86+.bin + fi - if [ -n "$NO_ADDONS_BSD4GRML" ] ; then - log "Skipping installation of bsd4grml as requested via \$NO_ADDONS_BSD4GRML." - einfo "Skipping installation of bsd4grml as requested via \$NO_ADDONS_BSD4GRML."; eend 0 - else - if [ -d "$TEMPLATE_DIRECTORY"/boot/addons/bsd4grml ] ; then - cp -a ${TEMPLATE_DIRECTORY}/boot/addons/bsd4grml "$BUILD_OUTPUT"/boot/addons/ - else - log "Missing addon file: bsd4grml" - ewarn "Missing addon file: bsd4grml" ; eend 0 - fi + # copy only files and report which ones are installed + if [ -d "${TEMPLATE_DIRECTORY}/arch/${ARCH}/boot/addons" ] ; then + for file in "${TEMPLATE_DIRECTORY}/arch/${ARCH}/boot/addons/"* ; do + if [ -f "$file" ] ; then + log "Installing $file in /boot/addons." + einfo "Installing $file in /boot/addons."; eend 0 + cp "$file" "$BUILD_OUTPUT"/boot/addons/ fi - - fi # no "$TEMPLATE_DIRECTORY"/boot/addons - fi # NO_ADDONS - - # generate loopback.cfg config file without depending on grub's regexp module - # which isn't available in Debian/squeeze - echo "## grub2 loopback configuration" > "${BUILD_OUTPUT}"/boot/grub/loopback.cfg - echo "source /boot/grub/header.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg - for config in "${BUILD_OUTPUT}"/boot/grub/*_default.cfg "${BUILD_OUTPUT}"/boot/grub/*_options.cfg ; do - [ -r "$config" ] || continue - echo "source ${config##$BUILD_OUTPUT}" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg - done - if [ -z "$NO_ADDONS" ] ; then - echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg - fi - echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg - - # copy modules for GRUB - if [ "${ARCH}" = "arm64" ] ; then - mkdir -p "${BUILD_OUTPUT}"/boot/grub/arm64-efi/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/arm64-efi/*.mod "${BUILD_OUTPUT}"/boot/grub/arm64-efi/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/arm64-efi/*.lst "${BUILD_OUTPUT}"/boot/grub/arm64-efi/ - # NOTE: usage of /boot/grub/core.img + /boot/grub/grub.img unclear yet - elif [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "i386" ] ; then - # grub-pc-bin - mkdir -p "${BUILD_OUTPUT}"/boot/grub/i386-pc/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.mod "${BUILD_OUTPUT}"/boot/grub/i386-pc/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.o "${BUILD_OUTPUT}"/boot/grub/i386-pc/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.lst "${BUILD_OUTPUT}"/boot/grub/i386-pc/ - - # grub-efi-amd64-bin - mkdir -p "${BUILD_OUTPUT}"/boot/grub/x86_64-efi/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi/*.{mod,lst} "${BUILD_OUTPUT}"/boot/grub/x86_64-efi/ - - # grub-efi-ia32-bin - mkdir -p "${BUILD_OUTPUT}"/boot/grub/i386-efi/ - cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/i386-efi/*.{mod,lst} "${BUILD_OUTPUT}"/boot/grub/i386-efi/ - - cp -a "${CHROOT_OUTPUT}"/boot/grub/core.img "${BUILD_OUTPUT}"/boot/grub/ - cp -a "${CHROOT_OUTPUT}"/boot/grub/grub.img "${BUILD_OUTPUT}"/boot/grub/ + done + else # legacy path (before https://github.com/grml/grml-live-grml/pull/11): + for file in "${TEMPLATE_DIRECTORY}"/boot/addons/* ; do + if [ -f "$file" ] ; then + log "Installing $file in /boot/addons. (Legacy support)" + einfo "Installing $file in /boot/addons. (Legacy support)"; eend 0 + cp "$file" "$BUILD_OUTPUT"/boot/addons/ + fi + done fi + eend 0 - # arch independent files - cp -a "${CHROOT_OUTPUT}"/usr/share/grub/ascii.pf2 "${BUILD_OUTPUT}"/boot/grub/ - cp -a "${CHROOT_OUTPUT}"/usr/share/grub/unicode.pf2 "${BUILD_OUTPUT}"/boot/grub/ # clarify + fi # NO_ADDONS - if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then - log "Error: ${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." - eerror "Error: ${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1 - bailout 9 - fi + # generate loopback.cfg config file without depending on grub's regexp module + # which isn't available in Debian/squeeze + echo "## grub2 loopback configuration" > "${BUILD_OUTPUT}"/boot/grub/loopback.cfg + echo "source /boot/grub/header.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg + for config in "${BUILD_OUTPUT}"/boot/grub/*_default.cfg "${BUILD_OUTPUT}"/boot/grub/*_options.cfg ; do + [ -r "$config" ] || continue + echo "source ${config##"$BUILD_OUTPUT"}" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg + done + if [ -z "$NO_ADDONS" ] ; then + echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg + fi + echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg + + # copy modules for GRUB + if [ "${ARCH}" = "arm64" ] ; then + mkdir -p "${BUILD_OUTPUT}"/boot/grub/arm64-efi/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/arm64-efi/*.mod "${BUILD_OUTPUT}"/boot/grub/arm64-efi/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/arm64-efi/*.lst "${BUILD_OUTPUT}"/boot/grub/arm64-efi/ + # NOTE: usage of /boot/grub/core.img + /boot/grub/grub.img unclear yet + elif [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "i386" ] ; then + # grub-pc-bin + mkdir -p "${BUILD_OUTPUT}"/boot/grub/i386-pc/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.mod "${BUILD_OUTPUT}"/boot/grub/i386-pc/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.o "${BUILD_OUTPUT}"/boot/grub/i386-pc/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.lst "${BUILD_OUTPUT}"/boot/grub/i386-pc/ + + # grub-efi-amd64-bin + mkdir -p "${BUILD_OUTPUT}"/boot/grub/x86_64-efi/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi/*.{mod,lst} "${BUILD_OUTPUT}"/boot/grub/x86_64-efi/ + + # grub-efi-ia32-bin + mkdir -p "${BUILD_OUTPUT}"/boot/grub/i386-efi/ + cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/i386-efi/*.{mod,lst} "${BUILD_OUTPUT}"/boot/grub/i386-efi/ + + cp -a "${CHROOT_OUTPUT}"/boot/grub/core.img "${BUILD_OUTPUT}"/boot/grub/ + cp -a "${CHROOT_OUTPUT}"/boot/grub/grub.img "${BUILD_OUTPUT}"/boot/grub/ + fi - mkdir -p "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/ - cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/ + # arch independent files + cp -a "${CHROOT_OUTPUT}"/usr/share/grub/unicode.pf2 "${BUILD_OUTPUT}"/boot/grub/ - if [ -r "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version ] ; then - sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version - sed -i "s/%DATE%/$DATE/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version - fi + if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then + log "Error: ${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." + eerror "Error: ${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1 + bailout 9 + fi - # make sure the squashfs filename is set accordingly: - SQUASHFS_NAME="$GRML_NAME.squashfs" - # adjust bootsplash accordingly but make sure the string has the according length - fixed_squashfs_name="$(cut_string 20 "$SQUASHFS_NAME")" - fixed_squashfs_name="$(extend_string_end 20 "$fixed_squashfs_name")" - for file in f4 f5 ; do - if [ -r "${BUILD_OUTPUT}/boot/isolinux/${file}" ] ; then - sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" - sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" - fi - done + mkdir -p "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/ + cp -a "${TEMPLATE_DIRECTORY}"/GRML/* "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/ - # adjust all variables in the templates with the according distribution information - adjust_boot_files "${BUILD_OUTPUT}"/boot/isolinux/*.cfg \ - "${BUILD_OUTPUT}"/boot/isolinux/*.msg \ - "${BUILD_OUTPUT}"/boot/grub/* + if [ -r "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version ] ; then + sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version + sed -i "s/%DATE%/$DATE/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version + fi - for param in ARCH DATE DISTRI_INFO DISTRI_NAME DISTRI_SPLASH GRML_NAME SQUASHFS_NAME \ - RELEASE_INFO SHORT_NAME VERSION ; do - for file in $(find "${BUILD_OUTPUT}" -name "*%$param%*") ; do - value="$(eval echo '$'"$param")" - mv ${file} ${file/\%${param}\%/$value} - done - done + # make sure the squashfs filename is set accordingly: + SQUASHFS_NAME="$GRML_NAME.squashfs" + # adjust bootsplash accordingly but make sure the string has the according length + fixed_squashfs_name="$(cut_string 20 "$SQUASHFS_NAME")" + fixed_squashfs_name="$(extend_string_end 20 "$fixed_squashfs_name")" + for file in f4 f5 ; do + if [ -r "${BUILD_OUTPUT}/boot/isolinux/${file}" ] ; then + sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" + sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" + fi + done - # generate addon list + # adjust all variables in the templates with the according distribution information + adjust_boot_files "${BUILD_OUTPUT}"/boot/isolinux/*.cfg \ + "${BUILD_OUTPUT}"/boot/isolinux/*.msg \ + "${BUILD_OUTPUT}"/boot/grub/* + + for param in ARCH DATE DISTRI_INFO DISTRI_NAME DISTRI_SPLASH GRML_NAME SQUASHFS_NAME \ + RELEASE_INFO SHORT_NAME VERSION ; do + while IFS= read -r -d '' file ; do + value=$(eval echo '$'"$param") + mv "${file}" "${file/\%${param}\%/$value}" + done < <(find "${BUILD_OUTPUT}" -name "*%$param%*" -print0) + done + + if [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "i386" ] ; then + # generate isolinux addon list + ADDONS_LIST_FILE='/boot/isolinux/addons_list.cfg' rm -f "${BUILD_OUTPUT}/${ADDONS_LIST_FILE}" for name in "${BUILD_OUTPUT}"/boot/isolinux/addon_*.cfg ; do include_name=$(basename "$name") @@ -1360,21 +1358,23 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] || [ "$ARCH" = arm64 ] ; then if ! [ -r "${BUILD_OUTPUT}/boot/isolinux/${DISTRI_NAME}.cfg" ] || [ "$DISTRI_NAME" = "grml" ] ; then log "including grmlmain.cfg in ${BUILD_OUTPUT}/boot/isolinux/distri.cfg" echo "include grmlmain.cfg" > "${BUILD_OUTPUT}/boot/isolinux/distri.cfg" - echo "include default.cfg" > "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - echo "include menuoptions.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - echo "include grml.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - - for f in "${BUILD_OUTPUT}"/boot/isolinux/submenu*.cfg ; do - echo "include $(basename $f)" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - done - echo "include options.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - if [ -z "$NO_ADDONS" ] ; then - echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - fi - echo "include isoprompt.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - echo "include hd.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" - echo "include hidden.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" + # Generate grmlmain.cfg + { + echo "include default.cfg" + echo "include menuoptions.cfg" + echo "include grml.cfg" + for f in "${BUILD_OUTPUT}"/boot/isolinux/submenu*.cfg ; do + echo "include $(basename "$f")" + done + echo "include options.cfg" + if [ -z "$NO_ADDONS" ] ; then + echo "include addons.cfg" + fi + echo "include isoprompt.cfg" + echo "include hd.cfg" + echo "include hidden.cfg" + } > "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg" else # assume we are building a custom distribution: log "File ${BUILD_OUTPUT}/boot/isolinux/${DISTRI_NAME}.cfg found, using it." einfo "File ${BUILD_OUTPUT}/boot/isolinux/${DISTRI_NAME}.cfg found, using it." @@ -1395,8 +1395,8 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] || [ "$ARCH" = arm64 ] ; then # use old style console based isolinux method only if requested: if [[ "${ISOLINUX_METHOD}" == "console" ]] ; then - log 'Using console based isolinux method as requested via $ISOLINUX_METHOD.' - einfo 'Using console based isolinux method as requested via $ISOLINUX_METHOD.' + log "Using console based isolinux method as requested via \$ISOLINUX_METHOD." + einfo "Using console based isolinux method as requested via \$ISOLINUX_METHOD." if grep -q '^include console.cfg' "${BUILD_OUTPUT}/boot/isolinux/distri.cfg" ; then einfo "include for console.cfg already found, nothing to do." eend 0 @@ -1404,7 +1404,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] || [ "$ARCH" = arm64 ] ; then log "including console.cfg in ${BUILD_OUTPUT}/boot/isolinux/isolinux.cfg" einfo "including console.cfg in ${BUILD_OUTPUT}/boot/isolinux/isolinux.cfg" echo "include console.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/isolinux.cfg" - eend $? + eend 0 fi else log 'Using graphical boot menu.' @@ -1415,33 +1415,25 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] || [ "$ARCH" = arm64 ] ; then echo "include vesamenu.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/isolinux.cfg" fi fi + fi # amd64 or i386 - if [ -e "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 ]; then - sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 - fi - - DPKG_LIST="/var/log/fai/$HOSTNAME/last/dpkg.list" # the dpkg --list output of the chroot - if ! [ -r "$DPKG_LIST" ] ; then - ewarn "$DPKG_LIST could not be read, ignoring to store package information on ISO therefore." - else - einfo "Storing package list information as /GRML/${GRML_NAME}/packages.txt on ISO." - cp "$DPKG_LIST" "${BUILD_OUTPUT}"/GRML/"${GRML_NAME}"/packages.txt - eend $? - fi + DPKG_LIST="/var/log/fai/$HOSTNAME/last/dpkg.list" # the dpkg --list output of the chroot + if ! [ -r "$DPKG_LIST" ] ; then + ewarn "$DPKG_LIST could not be read, ignoring to store package information on ISO therefore." + else + einfo "Storing package list information as /GRML/${GRML_NAME}/packages.txt on ISO." + cp "$DPKG_LIST" "${BUILD_OUTPUT}"/GRML/"${GRML_NAME}"/packages.txt + eend $? + fi - # autostart for Windows: - if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then - cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/ - fi + # autostart for Windows: + if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then + cp "${TEMPLATE_DIRECTORY}"/windows/autostart/* "$BUILD_OUTPUT"/ + fi - FORCE_ISO_REBUILD=true - einfo "Finished execution of stage 'boot'" ; eend 0 - fi # BOOTSTRAP_ONLY -else - log 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' - eerror 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' ; eend 1 - bailout -fi + FORCE_ISO_REBUILD=true + einfo "Finished execution of stage 'boot'" ; eend 0 +fi # BOOTSTRAP_ONLY # support installation of local files into the chroot/ISO if [ -n "$CHROOT_INSTALL" ] ; then @@ -1458,7 +1450,7 @@ if [ -n "$CHROOT_INSTALL" ] ; then fi fi -if [ -f "$BUILD_OUTPUT"/live/${GRML_NAME}.squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then +if [ -f "$BUILD_OUTPUT"/live/"${GRML_NAME}".squashfs ] && [ -z "$UPDATE" ] && [ -z "$BUILD_ONLY" ] && [ -z "$BUILD_DIRTY" ] ; then log "Skipping stage 'squashfs' as $BUILD_OUTPUT/live exists already." ewarn "Skipping stage 'squashfs' as $BUILD_OUTPUT/live exists already." ; eend 0 elif [ -n "$SKIP_MKSQUASHFS" ] ; then @@ -1491,16 +1483,16 @@ else fi fi + # Ignore all extended attributes. This avoids: + # 1) leaking containerization supplied selinux attributes into the squashfs, + # 2) prevents unpacking errors in a later build-only step in containers not supporting xattrs. + SQUASHFS_OPTIONS="$SQUASHFS_OPTIONS -no-xattrs" + # support exclusion of files via exclude-file: - if [ -n "$SQUASHFS_EXCLUDES_FILE" -a "$SQUASHFS_EXCLUDES_FILE" ] ; then + if [ -n "$SQUASHFS_EXCLUDES_FILE" ] && [ "$SQUASHFS_EXCLUDES_FILE" ] ; then SQUASHFS_OPTIONS="$SQUASHFS_OPTIONS -ef $SQUASHFS_EXCLUDES_FILE -wildcards" fi - # get rid of unnecessary files when building grml-small for final release: - if echo "$CLASSES" | grep -q GRML_SMALL ; then - SQUASHFS_OPTIONS="$SQUASHFS_OPTIONS -e initrd.img* vmlinuz*" - fi - # log stuff SQUASHFS_STDERR="$(mktemp -t grml-live.XXXXXX)" @@ -1510,15 +1502,15 @@ else einfo "Squashfs build information: running binary $SQUASHFS_BINARY $SQUASHFS_INFO_MSG" log "$SQUASHFS_BINARY $CHROOT_OUTPUT/ $BUILD_OUTPUT/live/${GRML_NAME}/${GRML_NAME}.squashfs -noappend $SQUASHFS_OPTIONS" - - if $SQUASHFS_BINARY $CHROOT_OUTPUT/ $BUILD_OUTPUT/live/"${GRML_NAME}"/"${GRML_NAME}".squashfs \ + # shellcheck disable=SC2086 # $SQUASHFS_OPTIONS needs splitting + if "$SQUASHFS_BINARY" "$CHROOT_OUTPUT/" "$BUILD_OUTPUT"/live/"${GRML_NAME}"/"${GRML_NAME}".squashfs \ -noappend $SQUASHFS_OPTIONS 2>"${SQUASHFS_STDERR}" ; then - echo "${GRML_NAME}.squashfs" > $BUILD_OUTPUT/live/"${GRML_NAME}"/filesystem.module + echo "${GRML_NAME}.squashfs" > "$BUILD_OUTPUT"/live/"${GRML_NAME}"/filesystem.module log "Finished execution of stage 'squashfs' [$(date)]" einfo "Finished execution of stage 'squashfs'" ; eend 0 else log "Error: there was a critical error executing stage 'squashfs' [$(date)]:" - log "$(cat $SQUASHFS_STDERR)" + log "$(cat "$SQUASHFS_STDERR")" eerror "Error: there was a critical error executing stage 'squashfs':" cat "${SQUASHFS_STDERR}" eend 1 @@ -1530,7 +1522,8 @@ fi # create md5sum file: if [ -z "$BOOTSTRAP_ONLY" ] ; then - ( cd $BUILD_OUTPUT/GRML/"${GRML_NAME}" && + # shellcheck disable=SC2094 # find execution ignores written file + ( cd "$BUILD_OUTPUT"/GRML/"${GRML_NAME}" && find ../.. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums ) fi # }}} @@ -1550,7 +1543,7 @@ generate_build_info() { distri_info="${DISTRI_INFO}" \ distri_name="${DISTRI_NAME}" \ extract_iso_name="${EXTRACT_ISO_NAME}" \ - fai_cmdline="BUILD_ONLY=${BUILD_ONLY} BOOTSTRAP_ONLY=${BOOTSTRAP_ONLY} GRML_LIVE_CONFIG=${CONFIGDUMP} WAYBACK_DATE=${WAYBACK_DATE} fai ${VERBOSE} -C ${GRML_FAI_CONFIG} -s file:///${GRML_FAI_CONFIG}/config -c${CLASSES} -u ${HOSTNAME} ${FAI_ACTION} ${CHROOT_OUTPUT} ${FAI_ARGS}" \ + fai_cmdline="BUILD_ONLY=${BUILD_ONLY} BOOTSTRAP_ONLY=${BOOTSTRAP_ONLY} GRML_LIVE_CONFIG=${CONFIGDUMP} WAYBACK_DATE=${WAYBACK_DATE} fai ${VERBOSE} -C ${FAI_CONF_DIR} -s file:///${GRML_FAI_CONFIG} -c${CLASSES} -u ${HOSTNAME} ${FAI_ACTION} ${CHROOT_OUTPUT} ${FAI_ARGS}" \ fai_version="$(fai --help 2>/dev/null | head -1 | awk '{print $2}' | sed 's/\.$//' || true)" \ grml_architecture="${ARCH}" \ grml_bootid="${BOOTID}" \ @@ -1599,10 +1592,15 @@ generate_build_info() { BOOT_ARGS="-no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat" if [ "$HYBRID_METHOD" = "isohybrid" ] ; then - EFI_ARGS="-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -eltorito-alt-boot -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat" + EFI_ARGS="-isohybrid-mbr ${CHROOT_OUTPUT}/usr/lib/ISOLINUX/isohdpfx.bin -eltorito-alt-boot -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat" +fi +if [ "$ARCH" = "arm64" ]; then + # No isolinux on arm64. + BOOT_ARGS="" + EFI_ARGS="-eltorito-alt-boot -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat" fi -if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then +if [ -f "${ISO_OUTPUT}/${ISO_NAME}" ] && [ -z "$UPDATE" ] && [ -z "$BUILD_ONLY" ] && [ -z "$BUILD_DIRTY" ] && [ "$FORCE_ISO_REBUILD" = "false" ] ; then log "Skipping stage 'iso build' as $ISO_OUTPUT/${ISO_NAME} exists already." ewarn "Skipping stage 'iso build' as $ISO_OUTPUT/${ISO_NAME} exists already." ; eend 0 elif [ -n "$SKIP_MKISOFS" ] ; then @@ -1611,91 +1609,75 @@ elif [ -n "$SKIP_MKISOFS" ] ; then else mkdir -p "$ISO_OUTPUT" || bailout 6 "Problem with creating $ISO_OUTPUT for stage 'iso build'" - if $FORCE_ISO_REBUILD && ! [ -f "${ISO_OUTPUT}/${ISO_NAME}" ] ; then + if "$FORCE_ISO_REBUILD" && ! [ -f "${ISO_OUTPUT}/${ISO_NAME}" ] ; then log "Forcing rebuild of ISO because files on ISO have been modified." einfo "Forcing rebuild of ISO because files on ISO have been modified." fi - # support xorriso as well mkisofs and genisoimage if which xorriso >/dev/null 2>&1 ; then MKISOFS='xorriso -as mkisofs' - elif which mkisofs >/dev/null 2>&1; then - MKISOFS='mkisofs' - elif which genisoimage >/dev/null 2>&1; then - MKISOFS='genisoimage' else - log "Error: neither xorriso nor mkisofs nor genisoimage available - can not create ISO." - eerror "Error: neither xorriso nor mkisofs nor genisoimage available - can not create ISO." ; eend 1 + log "Error: xorriso not available - can not create ISO." + eerror "Error: xorriso not available - can not create ISO." ; eend 1 bailout fi einfo "Using ${MKISOFS} to build ISO." ; eend 0 - case "${ARCH}-${MKISOFS}" in + case "${ARCH}" in # using -eltorito-alt-boot is limited to xorriso for now - amd64-xorriso*) + amd64) eindent - if ! dpkg --compare-versions $(dpkg-query -W -f='${Version}\n' xorriso 2>/dev/null) gt-nl 1.1.6-1 ; then - log "Disabling (U)EFI boot support because xorriso version is too old." - ewarn "Disabling (U)EFI boot support because xorriso version is too old." ; eend 0 + if [ -r "${BUILD_OUTPUT}"/boot/efi.img ] ; then + einfo "Enabling (U)EFI boot." + log "Enabling (U)EFI boot." + BOOT_ARGS="$BOOT_ARGS -boot-info-table -eltorito-alt-boot -e boot/efi.img -no-emul-boot" + eend $? else - if [ -r "${BUILD_OUTPUT}"/boot/efi.img ] ; then - einfo "Enabling (U)EFI boot." - log "Enabling (U)EFI boot." - BOOT_ARGS="$BOOT_ARGS -boot-info-table -eltorito-alt-boot -e boot/efi.img -no-emul-boot" - eend $? - else - log "Disabling (U)EFI boot support because /boot/efi.img is missing." - ewarn "Disabling (U)EFI boot support because /boot/efi.img is missing." ; eend 0 - fi + log "Disabling (U)EFI boot support because /boot/efi.img is missing." + ewarn "Disabling (U)EFI boot support because /boot/efi.img is missing." ; eend 0 fi eoutdent ;; esac - CURRENT_DIR=$(pwd) - if cd "$BUILD_OUTPUT" ; then - log "Generating build information in conf/buildinfo.json" - einfo "Generating build information in conf/buildinfo.json" - mkdir -p conf/ - generate_build_info > conf/buildinfo.json - eend $? - - log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad -o ${ISO_OUTPUT}/${ISO_NAME} ." - einfo "Generating ISO file..." - $MKISOFS -V "${GRML_NAME} ${VERSION}" -publisher 'grml-live | grml.org' \ - -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad \ - -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$? - eend $RC - - # do not continue on errors, otherwise we might generate/overwrite the ISO with dd if=... stuff - if [ "$RC" != 0 ] ; then - log "Error: critical error while generating ISO [exit code ${RC}]. Exiting." - eerror "Error: critical error while generating ISO [exit code ${RC}]. Exiting." ; eend 1 - bailout $RC - fi - - # pad the output ISO to multiples of 256 KiB for partition table support - siz=$($getfilesize "${ISO_OUTPUT}/${ISO_NAME}") - cyls=$((siz / 512 / 32 / 16 + 1)) # C=$cyls H=16 S=32 - siz=$((cyls * 16 * 32 * 512)) # size after padding - dd if=/dev/zero bs=1 count=1 seek=$((siz - 1)) \ - of="${ISO_OUTPUT}/${ISO_NAME}" 2>/dev/null - - # generate ISO checksums if we are using class 'RELEASE': - case $CLASSES in *RELEASE*) - [ "$RC" = 0 ] && \ - ( - if cd $ISO_OUTPUT ; then - sha256sum ${ISO_NAME} > ${ISO_NAME}.sha256 && \ - touch -r ${ISO_NAME} ${ISO_NAME}.sha256 - fi - ) - ;; - esac + log "Generating build information in conf/buildinfo.json" + einfo "Generating build information in conf/buildinfo.json" + mkdir -p "$BUILD_OUTPUT"/conf/ + generate_build_info > "$BUILD_OUTPUT"/conf/buildinfo.json + eend $? + + log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad -o ${ISO_OUTPUT}/${ISO_NAME} ." + einfo "Generating ISO file..." + # shellcheck disable=SC2086 # BOOT_ARGS and EFI_ARGS need splitting + $MKISOFS -V "${GRML_NAME} ${VERSION}" -publisher 'grml-live | grml.org' \ + -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad \ + -o "${ISO_OUTPUT}/${ISO_NAME}" "$BUILD_OUTPUT"/ ; RC=$? + eend $RC + + # do not continue on errors, otherwise we might generate/overwrite the ISO with dd if=... stuff + if [ "$RC" != 0 ] ; then + log "Error: critical error while generating ISO [exit code ${RC}]. Exiting." + eerror "Error: critical error while generating ISO [exit code ${RC}]. Exiting." ; eend 1 + bailout "$RC" + fi - cd "$CURRENT_DIR" + # pad the output ISO to multiples of 256 KiB for partition table support + siz=$($getfilesize "${ISO_OUTPUT}/${ISO_NAME}") + cyls=$((siz / 512 / 32 / 16 + 1)) # C=$cyls H=16 S=32 + siz=$((cyls * 16 * 32 * 512)) # size after padding + dd if=/dev/zero bs=1 count=1 seek=$((siz - 1)) \ + of="${ISO_OUTPUT}/${ISO_NAME}" 2>/dev/null + + # generate ISO checksums if we are using class 'RELEASE': + if hasclass RELEASE && [ "$RC" = 0 ] ; then + ( + if cd "$ISO_OUTPUT" ; then + sha256sum "${ISO_NAME}" > "${ISO_NAME}.sha256" && \ + touch -r "${ISO_NAME}" "${ISO_NAME}.sha256" + fi + ) fi if [ "$RC" = 0 ] ; then @@ -1704,16 +1686,19 @@ else else log "Error: there was a critical error ($RC) executing stage 'iso build' [$(date)]" eerror "Error: there was a critical error executing stage 'iso build'" ; eend 1 - bailout $RC + bailout "$RC" fi fi # }}} # netboot package {{{ create_netbootpackage() { - local OUTPUT_FILE="${NETBOOT}/grml_netboot_package_${GRML_NAME}_${VERSION}.tar" + local OUTPUT_NAME + local OUTPUT_FILE + OUTPUT_NAME=$(basename "${ISO_NAME}" .iso)-netboot + OUTPUT_FILE="${NETBOOT}/${OUTPUT_NAME}.tar" - if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then + if [ -f "${OUTPUT_FILE}" ] && [ -z "$UPDATE" ] && [ -z "$BUILD_ONLY" ] && [ -z "$BUILD_DIRTY" ] ; then log "Skipping stage 'netboot' as $OUTPUT_FILE exists already." ewarn "Skipping stage 'netboot' as $OUTPUT_FILE exists already." ; eend 0 return 0 @@ -1725,81 +1710,99 @@ create_netbootpackage() { mkdir -p "$NETBOOT" - # since syslinux v3:6.03~pre1+dfsg-4 the pxelinux.0 has been split into a - # separate pxelinux package - if [ -d "${CHROOT_OUTPUT}/usr/lib/PXELINUX/" ] ; then - local pxelinux_dir=/usr/lib/PXELINUX - else - local pxelinux_dir=/usr/lib/syslinux - fi - - if ! [ -r "${CHROOT_OUTPUT}/${pxelinux_dir}/pxelinux.0" ] ; then - ewarn "File ${pxelinux_dir}/pxelinux.0 not found in build chroot." ; eend 0 - eindent - einfo "Install syslinux[-common]/pxelinux package in chroot to get a netboot package." - eoutdent - return 0 - fi - local OUTPUTDIR="${NETBOOT}/build_tmp" - local WORKING_DIR="${OUTPUTDIR}/grml_netboot_package_${GRML_NAME}_${VERSION}/tftpboot/" + local WORKING_DIR="${OUTPUTDIR}/${OUTPUT_NAME}/tftpboot/" mkdir -p "$WORKING_DIR" cp "${CHROOT_OUTPUT}"/boot/vmlinuz-* "$WORKING_DIR"/vmlinuz cp "${CHROOT_OUTPUT}"/boot/initrd.img-* "$WORKING_DIR"/initrd.img - cp "${CHROOT_OUTPUT}/${pxelinux_dir}/pxelinux.0" "${WORKING_DIR}/pxelinux.0" - if [ -r "${CHROOT_OUTPUT}"/usr/lib/syslinux/modules/bios/ldlinux.c32 ] ; then - cp "${CHROOT_OUTPUT}"/usr/lib/syslinux/modules/bios/ldlinux.c32 "${WORKING_DIR}"/ - fi + if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ] ; then + if ! [ -r "${CHROOT_OUTPUT}/usr/lib/PXELINUX/pxelinux.0" ] ; then + ewarn "File /usr/lib/PXELINUX/pxelinux.0 not found in build chroot." ; eend 0 + eindent + einfo "Install syslinux[-common]/pxelinux package in chroot to get a netboot package." + eoutdent + return 0 + fi - mkdir -p "${WORKING_DIR}/pxelinux.cfg" - if [ -r "${BUILD_OUTPUT}/boot/isolinux/netboot.cfg" ] ; then - cp "${BUILD_OUTPUT}/boot/isolinux/netboot.cfg" "${WORKING_DIR}/pxelinux.cfg/default" - else - log "File ${BUILD_OUTPUT}/boot/isolinux/netboot.cfg not found." - ewarn "File ${BUILD_OUTPUT}/boot/isolinux/netboot.cfg not found." - eindent - log "Hint: Are you using custom templates which do not provide netboot.cfg?" - ewarn "Hint: Are you using custom templates which do not provide netboot.cfg?" ; eend 0 - eoutdent - fi + cp "${CHROOT_OUTPUT}/usr/lib/PXELINUX/pxelinux.0" "${WORKING_DIR}/pxelinux.0" + + if [ -r "${CHROOT_OUTPUT}"/usr/lib/syslinux/modules/bios/ldlinux.c32 ] ; then + cp "${CHROOT_OUTPUT}"/usr/lib/syslinux/modules/bios/ldlinux.c32 "${WORKING_DIR}"/ + fi + + mkdir -p "${WORKING_DIR}/pxelinux.cfg" + if [ -r "${BUILD_OUTPUT}/boot/isolinux/netboot.cfg" ] ; then + cp "${BUILD_OUTPUT}/boot/isolinux/netboot.cfg" "${WORKING_DIR}/pxelinux.cfg/default" + else + log "File ${BUILD_OUTPUT}/boot/isolinux/netboot.cfg not found." + ewarn "File ${BUILD_OUTPUT}/boot/isolinux/netboot.cfg not found." + eindent + log "Hint: Are you using custom templates which do not provide netboot.cfg?" + ewarn "Hint: Are you using custom templates which do not provide netboot.cfg?" ; eend 0 + eoutdent + fi + fi # amd64 or i386 # don't include shim + grubnetx64 + grub files in i386 netboot packages, # as those don't make much sense there - if [ "$ARCH" = amd64 ] ; then + if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ] ; then if ! [ -r "${BUILD_OUTPUT}/boot/grub/netboot.cfg" ] ; then log "File ${BUILD_OUTPUT}/boot/grub/netboot.cfg not found." ewarn "File ${BUILD_OUTPUT}/boot/grub/netboot.cfg not found." eindent - log "Hint: Are you using custom templates which do not provide grub.cfg?" - ewarn "Hint: Are you using custom templates which do not provide grub.cfg?" ; eend 0 + log "Hint: Are you using custom templates which do not provide netboot.cfg?" + ewarn "Hint: Are you using custom templates which do not provide netboot.cfg?" ; eend 0 eoutdent else cp "${BUILD_OUTPUT}/boot/grub/netboot.cfg" "${WORKING_DIR}/grub.cfg" adjust_boot_files "${WORKING_DIR}/grub.cfg" - if [ -r "${CHROOT_OUTPUT}"/usr/lib/shim/shimx64.efi.signed ] ; then - log "Installing ${CHROOT_OUTPUT}/usr/lib/shim/shimx64.efi.signed as shim.efi in netboot package" - cp "${CHROOT_OUTPUT}"/usr/lib/shim/shimx64.efi.signed "${WORKING_DIR}"/shim.efi - elif [ -r "${CHROOT_OUTPUT}"/usr/lib/shim/shimx64.efi ] ; then - log "Installing ${CHROOT_OUTPUT}/usr/lib/shim/shimx64.efi as shim.efi in netboot package" - cp "${CHROOT_OUTPUT}"/usr/lib/shim/shimx64.efi "${WORKING_DIR}"/shim.efi - else - log "No shimx64.efi for usage with PXE boot found (shim-signed not present?)" - ewarn "No shimx64.efi for usage with PXE boot found (shim-signed not present?)" ; eend 0 + if [ "$ARCH" = "amd64" ] ; then + if ! copy_file_logged "${WORKING_DIR}"/shim.efi "${CHROOT_OUTPUT}" \ + /usr/lib/shim/shimx64.efi.signed \ + /usr/lib/shim/shimx64.efi + then + log "No shimx64.efi for usage with PXE boot found (shim-signed not present?)" + ewarn "No shimx64.efi for usage with PXE boot found (shim-signed not present?)" ; eend 0 + fi + + if ! copy_file_logged "${WORKING_DIR}"/grubx64.efi "${CHROOT_OUTPUT}" \ + /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed \ + /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi + then + log "No grubnetx64.efi for usage with PXE boot found (grub-efi-amd64-signed not present?)" + ewarn "No grubnetx64.efi for usage with PXE boot found (grub-efi-amd64-signed not present?)." ; eend 0 + fi + + # UEFI 32bit boot + if ! copy_file_logged "${WORKING_DIR}"/grubia32.efi "${CHROOT_OUTPUT}" \ + /usr/lib/grub/i386-efi-signed/grubnetia32.efi.signed \ + /usr/lib/grub/i386-efi/monolithic/grubnetia32.efi + then + log "No grubnetia32.efi for usage with PXE boot found (grub-efi-ia32-unsigned present?)" + ewarn "No grubnetia32.efi for usage with PXE boot found (grub-efi-ia32-unsigned present?)." ; eend 0 + fi fi - if [ -r "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ] ; then - log "Installing /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed as grubx64.efi in netboot package" - cp "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed "${WORKING_DIR}"/grubx64.efi - elif [ -r "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi ] ; then - log "Installing /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi as grubx64.efi in netboot package" - cp "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi "${WORKING_DIR}"/grubx64.efi - else - log "No grubnetx64.efi for usage with PXE boot found (grub-efi-amd64-signed not present?)" - ewarn "No grubnetx64.efi for usage with PXE boot found (grub-efi-amd64-signed not present?)." ; eend 0 + if [ "$ARCH" = "arm64" ] ; then + if ! copy_file_logged "${WORKING_DIR}"/shim.efi "${CHROOT_OUTPUT}" \ + /usr/lib/shim/shimaa64.efi.signed \ + /usr/lib/shim/shimaa64.efi + then + log "No shimaa64.efi for usage with PXE boot found (shim-signed not present?)" + ewarn "No shimaa64.efi for usage with PXE boot found (shim-signed not present?)" ; eend 0 + fi + + if ! copy_file_logged "${WORKING_DIR}"/grubaa64.efi "${CHROOT_OUTPUT}" \ + /usr/lib/grub/arm64-efi-signed/grubnetaa64.efi.signed \ + /usr/lib/grub/arm64-efi/monolithic/grubnetaa64.efi + then + log "No grubnetaa64.efi for usage with PXE boot found (grub-efi-arm64-signed not present?)" + ewarn "No grubnetaa64.efi for usage with PXE boot found (grub-efi-arm64-signed not present?)." ; eend 0 + fi fi if [ -r "${CHROOT_OUTPUT}"/usr/share/grub/unicode.pf2 ] ; then @@ -1811,12 +1814,13 @@ create_netbootpackage() { ewarn "No unicode.pf2 for usage with PXE boot found (grub-common not present?)" ; eend 0 fi fi - fi + fi # amd64 or arm64 - if tar -C "$OUTPUTDIR" -cf "${OUTPUT_FILE}" "grml_netboot_package_${GRML_NAME}_${VERSION}" ; then + if tar -C "$OUTPUTDIR" -cf "${OUTPUT_FILE}" "${OUTPUT_NAME}" ; then ( - cd $(dirname "${OUTPUT_FILE}") - sha256sum $(basename "${OUTPUT_FILE}") > "${OUTPUT_FILE}.sha256" + # shellcheck disable=SC2164 # We just wrote there. If it disappeared, too bad. + cd "$(dirname "${OUTPUT_FILE}")" + sha256sum "$(basename "${OUTPUT_FILE}")" > "${OUTPUT_FILE}.sha256" ) einfo "Generated netboot package ${OUTPUT_FILE}" ; eend 0 rm -rf "${OUTPUTDIR}" @@ -1830,50 +1834,36 @@ create_netbootpackage() { create_netbootpackage # }}} -# log build information to database if grml-live-db is installed and enabled {{{ -dpkg_to_db() { -if [ -d /usr/share/grml-live-db ] ; then - - # safe defaults - DPKG_LIST="/var/log/fai/$HOSTNAME/last/dpkg.list" # the dpkg --list output of the chroot: - [ -n "$DPKG_DATABASE" ] || DPKG_DATABASE=/var/log/grml-live.db - [ -n "$DPKG_DBSCRIPT" ] || DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db - [ -n "$DPKG_DBOPTIONS" ] || DPKG_DBOPTIONS="--database $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME --dpkg $DPKG_LIST" - - if ! [ -x "$DPKG_DBSCRIPT" ] ; then - log "Error: $DPKG_DBSCRIPT is not executable, can not log dpkg information." - eerror "Error: $DPKG_DBSCRIPT is not executable, can not log dpkg information." ; eend 1 - bailout 14 +# {{{ +create_sourcespackages() { + if ! hasclass SOURCES ; then + log "Skipping source package generation, only enabled with class SOURCES" + return 0 fi - # disable by default for now, not sure whether really everyone is using a local db file - #if ! touch "$DPKG_DATABASE" ; then - # eerror "Error: can not write to ${DPKG_DATABASE}, can not log dpkg information." ; eend 1 - # bailout 14 - #fi + local OUTPUT_FILE SOURCES_DIR + OUTPUT_FILE="${OUTPUT}/$(basename "${ISO_NAME}" .iso)-sources.tar" + SOURCES_DIR="${OUTPUT}/grml_sources/" - if ! [ -r "$DPKG_LIST" ] ; then - log "Warning: can not read $DPKG_LIST - can not provide information to $DPKG_DBSCRIPT (dirty build?)" - ewarn "Warning: can not read $DPKG_LIST - can not provide information to $DPKG_DBSCRIPT (dirty build?)" ; eend 0 - else - einfo "Logging $DPKG_LIST to database $DPKG_DATABASE" - log "Logging $DPKG_LIST to database $DPKG_DATABASE" - log "Executing $DPKG_DBSCRIPT $DPKG_DBOPTIONS" - eindent - - if DB_INFO=$("$DPKG_DBSCRIPT" $DPKG_DBOPTIONS 2>&1) ; then - einfo "$DB_INFO" - eend 0 - else - eerror "$DB_INFO" - eend 1 - fi - - eoutdent + if ! [ -d "${SOURCES_DIR}" ] ; then + eerror "Base directory ${SOURCES_DIR} not present, can not generate source package" ; eend 1 + bailout 22 fi -fi + if tar -C "${OUTPUT}" -cf "${OUTPUT_FILE}" "$(basename "${SOURCES_DIR}")" ; then + ( + # shellcheck disable=SC2164 # We just wrote there. If it disappeared, too bad. + cd "$(dirname "${OUTPUT_FILE}")" + sha256sum "$(basename "${OUTPUT_FILE}")" > "${OUTPUT_FILE}.sha256" + ) + einfo "Generated source package ${OUTPUT_FILE}" ; eend 0 + else + eerror "Could not generate source package ${OUTPUT_FILE}" ; eend 1 + bailout 22 + fi } + +create_sourcespackages # }}} # finalize {{{ @@ -1883,8 +1873,6 @@ if [ -n "${start_seconds}" ] ; then fi log "Successfully finished execution of $PN [$(date) - running ${SECONDS} seconds]" -dpkg_to_db # make sure we catch the last log line as well, therefore execute between log + einfo - einfo "Successfully finished execution of $PN [$(date) - running ${SECONDS} seconds]" ; eend 0 bailout 0 # }}} diff --git a/remaster/grml-live-remaster b/remaster/grml-live-remaster index ecfc67785..ee49d0d4f 100755 --- a/remaster/grml-live-remaster +++ b/remaster/grml-live-remaster @@ -21,15 +21,10 @@ fi set -e # exit on any error -if [ -d /run/live/medium/ ] ; then # since Dec 2018 - LIVE_PATH_MAIN='/run/live/medium/' - LIVE_PATH_BOOT='/run/live/medium/boot/' -else # until Dec 2018 - LIVE_PATH_MAIN='/lib/live/mount/medium/' - LIVE_PATH_BOOT='/lib/live/mount/medium/boot/' -fi +LIVE_PATH_MAIN='/run/live/medium/' +LIVE_PATH_BOOT='/run/live/medium/boot/' -VERSION='0.0.4' +VERSION='0.0.5' GRML_LIVE_EDITOR=${VISUAL:-${EDITOR:-vi}} # source core functions {{{ @@ -39,7 +34,9 @@ if ! [ -r /etc/grml/lsb-functions ] || ! [ -r /etc/grml/script-functions ] ; the exit 1 fi +# shellcheck source=/dev/null . /etc/grml/lsb-functions +# shellcheck source=/dev/null . /etc/grml/script-functions # }}} @@ -49,16 +46,12 @@ if ! isgrmlcd ; then fi # make sure we have what we need {{{ -if check4progs mkisofs >/dev/null 2>&1 ; then - MKISO=mkisofs -fi - -if check4progs genisoimage >/dev/null 2>&1 ; then - MKISO=genisoimage +if check4progs xorriso >/dev/null 2>&1 ; then + MKISO='xorriso -as mkisofs' fi if [ -z "$MKISO" ] ; then - echo "Error: neither mkisofs nor genisoimage available. Exiting." >&2 + echo "Error: xorriso not installed. Exiting." >&2 exit 1 fi @@ -69,7 +62,7 @@ if [ -z "$MKSQUASHFS" ] ; then if which mksquashfs >/dev/null 2>&1 ; then MKSQUASHFS=mksquashfs else - echo "Error: mksquashfs is not available. Exiting." >&2 + echo "Error: mksquashfs not installed. Exiting." >&2 exit 1 fi fi @@ -126,9 +119,9 @@ ${GRML_LIVE_EDITOR} /remaster/msg [ -d /remaster/iso ] || mkdir /remaster/iso -for i in ${LIVE_PATH_MAIN}/*; do - if [ ! $i = ${LIVE_PATH_MAIN}/live ]; then - cp -R $i /remaster/iso +for i in "${LIVE_PATH_MAIN}"/*; do + if [ ! "$i" = ${LIVE_PATH_MAIN}/live ]; then + cp -R "$i" /remaster/iso fi done @@ -149,11 +142,11 @@ sed 3,4d "${BOOTSTUFF}"/boot.msg \ >/remaster/iso/boot/isolinux/boot.msg sed 1,2d /remaster/msg >>/remaster/iso/boot/isolinux/boot.msg -SQUASHFS_FQNAME=/remaster/iso/${SQUASHFS_FILE##$LIVE_PATH_MAIN} -mkdir -p $(dirname $SQUASHFS_FQNAME) +SQUASHFS_FQNAME=/remaster/iso/${SQUASHFS_FILE##"$LIVE_PATH_MAIN"} +mkdir -p "$(dirname "$SQUASHFS_FQNAME")" # the next line is necessary for grml2usb to work on the destination image -echo $(basename $SQUASHFS_FQNAME) > $(dirname $SQUASHFS_FQNAME)/filesystem.module -$MKSQUASHFS /remaster/chroot $SQUASHFS_FQNAME +basename "$SQUASHFS_FQNAME" > "$(dirname "$SQUASHFS_FQNAME")/filesystem.module" +$MKSQUASHFS /remaster/chroot "$SQUASHFS_FQNAME" umount /remaster/chroot /remaster/cdrom if [ -f /remaster/iso/boot/isolinux/isolinux.bin ] ; then diff --git a/scripts/generate_netboot_package.sh b/scripts/generate_netboot_package.sh index f4e3d132b..dd5301ea0 100755 --- a/scripts/generate_netboot_package.sh +++ b/scripts/generate_netboot_package.sh @@ -19,7 +19,7 @@ if ! [ -f "${CHROOT}/etc/grml_version" ] ; then exit 1 fi -GRML_VERSION="$(awk '{print $1"_"$2}' ${CHROOT}/etc/grml_version)" +GRML_VERSION=$(awk '{print $1"_"$2}' "${CHROOT}/etc/grml_version") if ! [ -r "${CHROOT}/usr/lib/syslinux/pxelinux.0" ] ; then echo "Error: /usr/lib/syslinux/pxelinux.0 not found. Please install syslinux[-common]." >&2 diff --git a/scripts/release_helper.sh b/scripts/release_helper.sh index 40c532d11..a47bc0512 100755 --- a/scripts/release_helper.sh +++ b/scripts/release_helper.sh @@ -31,7 +31,7 @@ fi printf "Building debian/changelog: " if [ -n "${AUTOBUILD:-}" ] ; then # since=$(git show -s --pretty="tformat:%h") - eval $(grep '^GRML_LIVE_VERSION=' grml-live) + eval "$(grep '^GRML_LIVE_VERSION=' grml-live)" DATE=$(date -R) UNIXTIME=$(date +%s) @@ -51,7 +51,7 @@ EOF git commit -m "Releasing ${GRML_LIVE_VERSION}-~autobuild${UNIXTIME} (auto build)" else since=v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') - git-dch --ignore-branch --since=$since \ + git-dch --ignore-branch --since="$since" \ --id-length=7 --meta --multimaint-merge -S printf "OK\n" fi @@ -83,7 +83,7 @@ if [[ "$script_version" == "$debian_version" ]] ; then printf "OK\n" else printf "FAILED\n." - printf "Debian package version ($debian_version) does not match script version ($script_version).\n" + echo "Debian package version ($debian_version) does not match script version ($script_version)." exit 1 fi @@ -98,8 +98,8 @@ if [ -n "${AUTOBUILD:-}" ] ; then rm -rf ../grml-live.build-area/grml-live* # otherwise we're keeping files forever... git-buildpackage --git-ignore-branch --git-ignore-new --git-export-dir=../grml-live.build-area -us -uc else - git-buildpackage --git-ignore-branch --git-ignore-new $* - printf "Finished execution of $(basename $0). Do not forget to tag release ${debian_version}\n" + git-buildpackage --git-ignore-branch --git-ignore-new "$*" + echo "Finished execution of $(basename "$0"). Do not forget to tag release ${debian_version}" fi if [ -n "${AUTOBUILD:-}" ] ; then @@ -109,11 +109,12 @@ if [ -n "${AUTOBUILD:-}" ] ; then dpkg-scanpackages . /dev/null | gzip > Packages.gz ) git checkout master - git branch -D ${autobuild_branch} || true + git branch -D "${autobuild_branch}" || true env APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none sudo apt-get update PACKAGES=$(dpkg --list grml-live\* | awk '/^ii/ {print $2}') + # shellcheck disable=SC2086 # PACKAGES needs word-splitting. env APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none sudo apt-get -y \ -o DPkg::Options::=--force-confmiss \ -o DPkg::Options::=--force-confnew \ diff --git a/templates/EFI/debian/BOOT/README b/templates/EFI/debian/BOOT/README index 32e2d3c3a..5a6651cc6 100644 --- a/templates/EFI/debian/BOOT/README +++ b/templates/EFI/debian/BOOT/README @@ -1,6 +1,6 @@ # debian approach: -shimx64.efi.signed = /usr/lib/shim/shimx64.efi.signed from https://deb.debian.org/debian/pool/main/s/shim-signed/shim-signed_1.38+15.4-7_amd64.deb -grubx64.efi.signed = /usr/lib/grub/x86_64-efi-signed/gcdx64.efi.signed from https://deb.debian.org/debian/pool/main/g/grub-efi-amd64-signed/grub-efi-amd64-signed_1+2.06+7_amd64.deb +shimx64.efi.signed = /usr/lib/shim/shimx64.efi.signed from https://deb.debian.org/debian/pool/main/s/shim-signed/shim-signed_1.44+15.8-1_amd64.deb +grubx64.efi.signed = /usr/lib/grub/x86_64-efi-signed/gcdx64.efi.signed from https://deb.debian.org/debian/pool/main/g/grub-efi-amd64-signed/grub-efi-amd64-signed_1+2.12+5_amd64.deb # NOTE: # shimx64.efi.signed ends up as /EFI/BOOT/bootx64.efi inside [grml_cd]/boot/efi.img, and # grubx64.efi.signed ends up as /EFI/BOOT/grubx64.efi inside [grml_cd]/boot/efi.img, whereas diff --git a/templates/EFI/debian/BOOT/grubx64.efi.signed b/templates/EFI/debian/BOOT/grubx64.efi.signed index c87eb6f68..9f6efb7dc 100644 Binary files a/templates/EFI/debian/BOOT/grubx64.efi.signed and b/templates/EFI/debian/BOOT/grubx64.efi.signed differ diff --git a/templates/EFI/debian/BOOT/shimx64.efi.signed b/templates/EFI/debian/BOOT/shimx64.efi.signed index dcd8b5049..f2336f6d8 100644 Binary files a/templates/EFI/debian/BOOT/shimx64.efi.signed and b/templates/EFI/debian/BOOT/shimx64.efi.signed differ diff --git a/templates/GRML/grml-cheatcodes.txt b/templates/GRML/grml-cheatcodes.txt index c5de19004..cf8ebf2a3 100644 --- a/templates/GRML/grml-cheatcodes.txt +++ b/templates/GRML/grml-cheatcodes.txt @@ -15,19 +15,21 @@ fb1280x1024 Use fixed framebuffer graphics (1) fb1024x768 Use fixed framebuffer graphics (2) [notice: Grml's default] fb800x600 Use fixed framebuffer graphics (3) nofb Disable framebuffer -floppy Boot from floppydisk -hd / hd1 / hd2 / hd3 Boot from (local) primary / secondary /... harddisk -debug Get shells during process of booting for debugging +floppy Boot from primary floppy drive +hd / hd1 /hd2 / hd3 Boot from first .. fourth primary partition of (local) harddisk +hd0 / fd0 Chainload MBR from first harddisk / floppy drive +debug Be verbose during the process of booting for debugging forensic Do not touch any harddisks during hardware recognition serial Activate ttyS0 and start a getty -grub Boot Grub bootloader (special all-in-one-image) -dos Boot FreeDOS +grub Boot Grub bootloader hdt Boot Hardware Detection Tool (from syslinux project) Further documentation regarding the boot process can be found at: * https://manpages.debian.org/live-boot-doc/live-boot.7.en.html * https://manpages.debian.org/initramfs-tools-core/initramfs-tools.7.en.html * https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html +* https://wiki.syslinux.org/wiki/index.php?title=SYSLINUX +* https://wiki.syslinux.org/wiki/index.php?title=Doc/chain + https://wiki.syslinux.org/wiki/index.php?title=Comboot/chain.c32 The following boot options can be combined. Notice: not all of them are available on all the Grml flavours. @@ -150,14 +152,9 @@ grml ignore_bootid Disable bootid verification. Debugging related settings: --------------------------- -grml debug Get shells during process of booting, using GNU screen, be verbose -grml debug=1 Get shells during process of booting, using GNU screen, be verbose and - display shell code being executed in initramfs. -grml debug=noscreen Get shells during process of booting, verbose, but without using GNU screen grml nocolor Disable colorized output while booting Also set SYSTEMD_COLORS=0 to disable colors in systemd output grml log Log error messages while booting to /tmp/grml.log.`date +%Y%m%d`" - and /var/log/boot grml testcd Check CD data integrity and md5sums Security / login related settings: diff --git a/templates/boot/grub/%SHORT_NAME%_default.cfg b/templates/boot/grub/%SHORT_NAME%_default.cfg index 5b343835c..b39a11ff2 100644 --- a/templates/boot/grub/%SHORT_NAME%_default.cfg +++ b/templates/boot/grub/%SHORT_NAME%_default.cfg @@ -1,4 +1,4 @@ -menuentry "%GRML_NAME% - release %VERSION% (default)" { +menuentry "%GRML_NAME% %VERSION%" { set gfxpayload=keep echo 'Loading kernel...' linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" ${kernelopts} nomce net.ifnames=0 diff --git a/templates/boot/grub/%SHORT_NAME%_options.cfg b/templates/boot/grub/%SHORT_NAME%_options.cfg index 01684590d..dd0a83e2e 100644 --- a/templates/boot/grub/%SHORT_NAME%_options.cfg +++ b/templates/boot/grub/%SHORT_NAME%_options.cfg @@ -1,4 +1,4 @@ -submenu "%GRML_NAME% - advanced options ->" --class=submenu { +submenu " ⇢ Options" --class=submenu { menuentry "Enable Predictable Network Interface Names" { set gfxpayload=keep echo 'Loading kernel...' @@ -66,7 +66,7 @@ menuentry "Graphical Mode" { menuentry "Disable Framebuffer" { set gfxpayload=text echo 'Loading kernel...' - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% nomce net.ifnames=0 "${loopback}" ${kernelopts} video=ofonly radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 cirrus.modeset=0 mgag200.modeset=0 nomodeset + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% nomce net.ifnames=0 "${loopback}" ${kernelopts} radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 cirrus.modeset=0 mgag200.modeset=0 nomodeset echo 'Loading initrd...' initrd /boot/%SHORT_NAME%/initrd.img } diff --git a/templates/boot/grub/addons.cfg b/templates/boot/grub/addons.cfg index 5aea93196..1760e4e4e 100644 --- a/templates/boot/grub/addons.cfg +++ b/templates/boot/grub/addons.cfg @@ -1,4 +1,4 @@ -submenu "Addons ->" --class=submenu { +submenu "Addons ⇢" --class=submenu { # EFI: if [ "${grub_platform}" == "efi" ] ; then @@ -25,111 +25,42 @@ fi # BIOS/non-EFI: if [ "${grub_platform}" != "efi" ] ; then - # try to detect amd64 by checking whether CPU supports 64-bit (long) mode - if cpuid -l ; then - if test -e /boot/addons/memtest86+x64.bin ; then - menuentry "Memory test (memtest86+x64.bin)" { - insmod linux16 - linux16 /boot/addons/memtest86+x64.bin - } - elif test -e /boot/addons/memtest ; then # fallback to old memtest - menuentry "Memory test (memtest86+)" { - insmod linux16 - linux16 /boot/addons/memtest - } - fi - else # assume i386 - if test -e /boot/addons/memtest86+ia32.bin ; then - menuentry "Memory test (memtest86+ia32.bin)" { - insmod linux16 - linux16 /boot/addons/memtest86+ia32.bin - } - elif test -e /boot/addons/memtest ; then # fallback to old memtest - menuentry "Memory test (memtest86+)" { - insmod linux16 - linux16 /boot/addons/memtest - } - fi + if test -e /boot/addons/memtest ; then + menuentry "Memory test (memtest86+)" { + insmod linux16 + linux16 /boot/addons/memtest + } fi fi -menuentry "iPXE - boot via network/PXE" { - if [ "${grub_platform}" == "efi" ] ; then +if [ "${grub_platform}" == "efi" ] ; then + if test -e /boot/addons/ipxe.efi ; then + menuentry "iPXE - boot via network/PXE" { chainloader /boot/addons/ipxe.efi - else + } + fi +else + if test -e /boot/addons/ipxe.lkrn ; then + menuentry "iPXE - boot via network/PXE" { insmod linux16 linux16 /boot/addons/ipxe.lkrn - fi -} + } + fi +fi -menuentry "Netboot.xyz" { - if [ "${grub_platform}" == "efi" ] ; then +if [ "${grub_platform}" == "efi" ] ; then + if test -e /boot/addons/netboot.xyz.efi ; then + menuentry "Netboot.xyz" { chainloader /boot/addons/netboot.xyz.efi - else - insmod linux16 - linux16 /boot/addons/netboot.xyz.lkrn - fi -} - -if [ "${grub_platform}" != "efi" ] ; then + } + fi +else + if test -e /boot/addons/netboot.xyz.lkrn ; then menuentry "Netboot.xyz" { insmod linux16 linux16 /boot/addons/netboot.xyz.lkrn } + fi +fi - menuentry "GRUB - all in one image" { - insmod linux16 - linux16 /boot/addons/memdisk - initrd16 /boot/addons/allinone.img - } - - menuentry "FreeDOS" { - insmod linux16 - linux16 /boot/addons/memdisk - initrd16 /boot/addons/balder10.imz - } - - if [ ${iso_path} ] ; then - # assume loopback.cfg boot - menuentry "MirOS bsd4grml (via loopback)" { - multiboot /boot/addons/bsd4grml/ldbsd.com - module /boot/addons/bsd4grml/bsd.rd bsd - module /boot/addons/bsd4grml/loopback.0 boot.cfg - module /boot/addons/bsd4grml/loopback.1 boot.1 - module /boot/addons/bsd4grml/loopback.2 boot.2 - module /boot/addons/bsd4grml/loopback.3 boot.3 - module /boot/addons/bsd4grml/loopback.4 boot.4 - module /boot/addons/bsd4grml/loopback.5 boot.5 - module /boot/addons/bsd4grml/loopback.6 boot.6 - } - else - # assume grub.cfg boot - menuentry "MirOS bsd4grml (regular method)" { - multiboot /boot/addons/bsd4grml/ldbsd.com - } - - menuentry "MirOS bsd4grml (fallback method)" { - multiboot /boot/addons/bsd4grml/ldbsd.com - module /boot/addons/bsd4grml/bsd.rd bsd.rd - module /boot/addons/bsd4grml/boot.1 boot.1 - module /boot/addons/bsd4grml/boot.2 boot.2 - module /boot/addons/bsd4grml/boot.3 boot.3 - module /boot/addons/bsd4grml/boot.4 boot.4 - module /boot/addons/bsd4grml/boot.5 boot.5 - module /boot/addons/bsd4grml/boot.6 boot.6 - module /boot/addons/bsd4grml/boot.cfg boot.cfg - module /boot/grub/grub.img grub.img - } - fi # iso_path -fi # efi mode -} - -if [ "${grub_platform}" == "efi" ] ; then -menuentry "UEFI Firmware Settings" { - fwsetup -} -fi # efi mode - -menuentry "Boot from next device" { - exit } diff --git a/templates/boot/grub/grml-theme/grml-logo.png b/templates/boot/grub/grml-theme/grml-logo.png deleted file mode 100644 index 34efa2d75..000000000 Binary files a/templates/boot/grub/grml-theme/grml-logo.png and /dev/null differ diff --git a/templates/boot/grub/grml-theme/item_c.png b/templates/boot/grub/grml-theme/item_c.png new file mode 100644 index 000000000..d2776a509 Binary files /dev/null and b/templates/boot/grub/grml-theme/item_c.png differ diff --git a/templates/boot/grub/grml-theme/logo.png b/templates/boot/grub/grml-theme/logo.png new file mode 100644 index 000000000..8b1c5e5c5 Binary files /dev/null and b/templates/boot/grub/grml-theme/logo.png differ diff --git a/templates/boot/grub/grml-theme/menu_c.png b/templates/boot/grub/grml-theme/menu_c.png new file mode 100644 index 000000000..d2776a509 Binary files /dev/null and b/templates/boot/grub/grml-theme/menu_c.png differ diff --git a/templates/boot/grub/grml-theme/menu_e.png b/templates/boot/grub/grml-theme/menu_e.png new file mode 100644 index 000000000..23a3fdc03 Binary files /dev/null and b/templates/boot/grub/grml-theme/menu_e.png differ diff --git a/templates/boot/grub/grml-theme/menu_s.png b/templates/boot/grub/grml-theme/menu_s.png new file mode 100644 index 000000000..390bc05e4 Binary files /dev/null and b/templates/boot/grub/grml-theme/menu_s.png differ diff --git a/templates/boot/grub/grml-theme/sb-theme.txt b/templates/boot/grub/grml-theme/sb-theme.txt index f9d533553..12118deb0 100644 --- a/templates/boot/grub/grml-theme/sb-theme.txt +++ b/templates/boot/grub/grml-theme/sb-theme.txt @@ -1,45 +1,55 @@ -# This is the theme to be used in Secure Boot mode - title-text: "" -title-color: "#FFFFFF" +title-color: "#FFF" desktop-image: "black.png" -message-color: "#FFFFFF" + image { - file = "grml-logo.png" - left = 45% - top = 2% + file = "logo.png" + left = 4% + top = 4% +} ++ image { + file = "uefisec.png" + left = 96%-250 + top = 4% } + boot_menu { - left = 15% - width = 70% - top = 16% - height = 36% - item_color = "#FFFFFF" - selected_item_color = "orange" + left = 4%+90 + width = 92%-180 + top = 25% + height = 55% + item_color = #FFF + selected_item_color = #000 item_spacing = 4 - item_height = 12 - border_color = "#FFFFFF" + item_padding = 10 + item_height = 20 + menu_pixmap_style = "menu_*.png" + item_pixmap_style = "item_*.png" + selected_item_pixmap_style = "sel_*.png" + item_icon_space = 0 + icon_width = 0 + icon_height = 0 + scrollbar_frame = "scbf_*.png" + scrollbar_thumb = "scbt_*.png" + scrollbar_width = 2 } - - -# Show an informational message. + vbox { - top = 55% - left = 20% - + label {text = "Running in Secure Boot mode" color = "white" align = "left"} - + label {text = ""} - + label {text = "Press ENTER to boot or E to edit menu entry " color = "white"} - + label {text = "Press C to enter the Grub commandline" color = "white"} + left = 4%+100 + width = 80% + top = 90% + + label {text = "Press ENTER to boot" color = "white" align = "left" } + + label {text = "Press E to edit menu entry" color = "white" align = "left" } + + label {text = "Press C to enter the GRUB commandline" color = "white" } } - + progress_bar { - id = "__timeout__" - top = 75% - left = 20% - text_color = "#FFFFFF" - fg_color = "orange" - bg_color = #66B - border_color = #006 - text = "@TIMEOUT_NOTIFICATION_LONG@" + id = "__timeout__" + top = 90%+26 + left = 96%-300 + width = 190 + height = 16 + text_color = #000 + fg_color = "#F47820" + bg_color = #FFF + border_color = #000 + #border_color = "#F47820" + text = "@TIMEOUT_NOTIFICATION_MIDDLE@" } diff --git a/templates/boot/grub/grml-theme/scbf_c.png b/templates/boot/grub/grml-theme/scbf_c.png new file mode 100644 index 000000000..a1afe4636 Binary files /dev/null and b/templates/boot/grub/grml-theme/scbf_c.png differ diff --git a/templates/boot/grub/grml-theme/scbf_n.png b/templates/boot/grub/grml-theme/scbf_n.png new file mode 100644 index 000000000..a1afe4636 Binary files /dev/null and b/templates/boot/grub/grml-theme/scbf_n.png differ diff --git a/templates/boot/grub/grml-theme/scbf_s.png b/templates/boot/grub/grml-theme/scbf_s.png new file mode 100644 index 000000000..a1afe4636 Binary files /dev/null and b/templates/boot/grub/grml-theme/scbf_s.png differ diff --git a/templates/boot/grub/grml-theme/scbt_c.png b/templates/boot/grub/grml-theme/scbt_c.png new file mode 100644 index 000000000..7d5c2b005 Binary files /dev/null and b/templates/boot/grub/grml-theme/scbt_c.png differ diff --git a/templates/boot/grub/grml-theme/scbt_n.png b/templates/boot/grub/grml-theme/scbt_n.png new file mode 100644 index 000000000..7d5c2b005 Binary files /dev/null and b/templates/boot/grub/grml-theme/scbt_n.png differ diff --git a/templates/boot/grub/grml-theme/scbt_s.png b/templates/boot/grub/grml-theme/scbt_s.png new file mode 100644 index 000000000..7d5c2b005 Binary files /dev/null and b/templates/boot/grub/grml-theme/scbt_s.png differ diff --git a/templates/boot/grub/grml-theme/sel_c.afphoto b/templates/boot/grub/grml-theme/sel_c.afphoto new file mode 100644 index 000000000..ad4dc465a Binary files /dev/null and b/templates/boot/grub/grml-theme/sel_c.afphoto differ diff --git a/templates/boot/grub/grml-theme/sel_c.png b/templates/boot/grub/grml-theme/sel_c.png new file mode 100644 index 000000000..7d5c2b005 Binary files /dev/null and b/templates/boot/grub/grml-theme/sel_c.png differ diff --git a/templates/boot/grub/grml-theme/theme.txt b/templates/boot/grub/grml-theme/theme.txt index 3a7be37ae..806308aec 100644 --- a/templates/boot/grub/grml-theme/theme.txt +++ b/templates/boot/grub/grml-theme/theme.txt @@ -1,43 +1,55 @@ -# This is the default GRUB theme of Grml - title-text: "" -title-color: "#FFFFFF" +title-color: "#FFF" desktop-image: "black.png" -message-color: "#FFFFFF" + image { - file = "grml-logo.png" - left = 45% - top = 2% + file = "logo.png" + left = 4% + top = 4% +} ++ image { + file = "uefi.png" + left = 96%-250 + top = 4% } + boot_menu { - left = 15% - width = 70% - top = 16% - height = 36% - item_color = "#FFFFFF" - selected_item_color = "orange" + left = 4%+90 + width = 92%-180 + top = 25% + height = 55% + item_color = #FFF + selected_item_color = #000 item_spacing = 4 - item_height = 12 - border_color = "#FFFFFF" + item_padding = 10 + item_height = 20 + menu_pixmap_style = "menu_*.png" + item_pixmap_style = "item_*.png" + selected_item_pixmap_style = "sel_*.png" + item_icon_space = 0 + icon_width = 0 + icon_height = 0 + scrollbar_frame = "scbf_*.png" + scrollbar_thumb = "scbt_*.png" + scrollbar_width = 2 } - - -# Show an informational message. + vbox { - top = 55% - left = 20% - + label {text = "Press ENTER to boot or E to edit menu entry " color = "white" align = "left"} - + label {text = "Press C to enter the Grub commandline" color = "white"} + left = 4%+100 + width = 80% + top = 90% + + label {text = "Press ENTER to boot" color = "white" align = "left" } + + label {text = "Press E to edit menu entry" color = "white" align = "left" } + + label {text = "Press C to enter the GRUB commandline" color = "white" } } - + progress_bar { - id = "__timeout__" - top = 75% - left = 20% - text_color = "#FFFFFF" - fg_color = "orange" - bg_color = #66B - border_color = #006 - text = "@TIMEOUT_NOTIFICATION_LONG@" + id = "__timeout__" + top = 90%+26 + left = 96%-300 + width = 190 + height = 16 + text_color = #000 + fg_color = "#F47820" + bg_color = #FFF + border_color = #000 + #border_color = "#F47820" + text = "@TIMEOUT_NOTIFICATION_MIDDLE@" } diff --git a/templates/boot/grub/grml-theme/uefi.png b/templates/boot/grub/grml-theme/uefi.png new file mode 100644 index 000000000..cddc452ff Binary files /dev/null and b/templates/boot/grub/grml-theme/uefi.png differ diff --git a/templates/boot/grub/grml-theme/uefisec.png b/templates/boot/grub/grml-theme/uefisec.png new file mode 100644 index 000000000..ddb2772e9 Binary files /dev/null and b/templates/boot/grub/grml-theme/uefisec.png differ diff --git a/templates/boot/grub/grub.cfg b/templates/boot/grub/grub.cfg index bdcea7ff7..4f735582d 100644 --- a/templates/boot/grub/grub.cfg +++ b/templates/boot/grub/grub.cfg @@ -3,11 +3,31 @@ source /boot/grub/header.cfg insmod regexp -for config in /boot/grub/*_default.cfg ; do source "$config" ; done -for config in /boot/grub/*_options.cfg ; do source "$config" ; done +for config in /boot/grub/*_default.cfg ; do + source "$config" + regexp --set 1:config "(/boot/grub/.+)_default.cfg" "$config" + set config="${config}_options.cfg" + source "$config" +done + +# separator entry, no action +menuentry "" { + true +} + if [ -f /boot/grub/addons.cfg ] ; then - source "/boot/grub/addons.cfg" + source "/boot/grub/addons.cfg" fi +if [ "${grub_platform}" == "efi" ] ; then +menuentry "UEFI Firmware Settings" { + fwsetup +} +fi # efi mode + +menuentry "Boot from next device" { + exit +} + source /boot/grub/footer.cfg # EOF diff --git a/templates/boot/grub/header.cfg b/templates/boot/grub/header.cfg index bf79d81ee..3d94888dd 100644 --- a/templates/boot/grub/header.cfg +++ b/templates/boot/grub/header.cfg @@ -1,7 +1,7 @@ set default=0 set timeout=20 -if loadfont /boot/grub/ascii.pf2 ; then +if loadfont /boot/grub/unicode.pf2 ; then insmod png set gfxmode=auto insmod gfxterm diff --git a/templates/boot/isolinux/addon_10_grub2.cfg b/templates/boot/isolinux/addon_10_grub2.cfg index 7bcc79644..eaf87f669 100644 --- a/templates/boot/isolinux/addon_10_grub2.cfg +++ b/templates/boot/isolinux/addon_10_grub2.cfg @@ -1,6 +1,6 @@ label grub menu label Run Bootloader Grub^2 - kernel /boot/addons/mboot.c32 /boot/grub/grub.img + kernel /boot/isolinux/mboot.c32 /boot/grub/grub.img text help Start Bootloader Grub (version 2). diff --git a/templates/boot/isolinux/addon_20_allinone.cfg b/templates/boot/isolinux/addon_20_allinone.cfg deleted file mode 100644 index 842fa5d8c..000000000 --- a/templates/boot/isolinux/addon_20_allinone.cfg +++ /dev/null @@ -1,12 +0,0 @@ -label allinone - menu label Run ^All-in-One-Image - kernel /boot/addons/memdisk - append initrd=/boot/addons/allinone.img - - text help - Start All-in-One-Image, being a special - version of Grub with an easy to use - interface for booting from local disks, - booting via PXE (with gPXE support),... - endtext - diff --git a/templates/boot/isolinux/addon_25_gxpe.cfg b/templates/boot/isolinux/addon_25_ixpe.cfg similarity index 100% rename from templates/boot/isolinux/addon_25_gxpe.cfg rename to templates/boot/isolinux/addon_25_ixpe.cfg diff --git a/templates/boot/isolinux/addon_30_dos.cfg b/templates/boot/isolinux/addon_30_dos.cfg deleted file mode 100644 index 290caf5c7..000000000 --- a/templates/boot/isolinux/addon_30_dos.cfg +++ /dev/null @@ -1,9 +0,0 @@ -label dos - menu label Run ^FreeDOS - kernel /boot/addons/memdisk - append initrd=/boot/addons/balder10.imz - - text help - Boot FreeDOS. - endtext - diff --git a/templates/boot/isolinux/addon_45_hdt.cfg b/templates/boot/isolinux/addon_45_hdt.cfg index 58fde89c4..bb70780b3 100644 --- a/templates/boot/isolinux/addon_45_hdt.cfg +++ b/templates/boot/isolinux/addon_45_hdt.cfg @@ -1,6 +1,6 @@ label hdt menu label Run Hardware Detection ^Tool - kernel /boot/addons/hdt.c32 + kernel /boot/isolinux/hdt.c32 append pciids=/boot/addons/pci.ids text help diff --git a/templates/boot/isolinux/f3 b/templates/boot/isolinux/f3 index dc51208ce..c94250697 100644 --- a/templates/boot/isolinux/f3 +++ b/templates/boot/isolinux/f3 @@ -12,10 +12,10 @@ forensic do not touch any harddisks during hardware recognition serial activate serial console grub boot GRand Unified Bootloader (GRUB) - dos boot FreeDOS 1.0 hdt boot Hardware Detection Tool + A list with all supported boot options can be found on the CD at /run/live/medium/grml/*/grml-cheatcodes.txt diff --git a/templates/boot/isolinux/hidden.cfg b/templates/boot/isolinux/hidden.cfg index c6268f56e..b31cf8125 100644 --- a/templates/boot/isolinux/hidden.cfg +++ b/templates/boot/isolinux/hidden.cfg @@ -3,26 +3,11 @@ menu hide kernel /boot/%SHORT_NAME%/vmlinuz append apm=power-off vga=791 initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% splash nomce net.ifnames=0 -label debug -menu hide -kernel /boot/%SHORT_NAME%/vmlinuz -append apm=power-off vga=791 verbose debug=vc initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% initcall_debug nomce net.ifnames=0 - label grmlx menu hide kernel /boot/%SHORT_NAME%/vmlinuz append apm=power-off startx vga=791 initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% nomce net.ifnames=0 -label nofb -menu hide -kernel /boot/%SHORT_NAME%/vmlinuz -append apm=power-off vga=normal video=ofonly initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% nomce net.ifnames=0 radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 cirrus.modeset=0 mgag200.modeset=0 nomodeset - -label nokms -menu hide -kernel /boot/%SHORT_NAME%/vmlinuz -append apm=power-off initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 cirrus.modeset=0 mgag200.modeset=0 nomodeset nomce net.ifnames=0 vga=791 - label vmlinuz menu hide kernel /boot/%SHORT_NAME%/vmlinuz @@ -48,11 +33,6 @@ menu hide kernel /boot/%SHORT_NAME%/vmlinuz append apm=power-off vga=788 initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% nomce net.ifnames=0 -label serial -menu hide -kernel /boot/%SHORT_NAME%/vmlinuz -append apm=power-off vga=normal video=vesafb:off initrd=/boot/%SHORT_NAME%/initrd.img boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% nomce net.ifnames=0 console=tty1 console=ttyS0,115200n8 - label userdef menu hide menu hide @@ -61,12 +41,12 @@ append ######################################################################### label hda menu hide -kernel /boot/addons/chain.c32 +kernel /boot/isolinux/chain.c32 append hd0 0 label fd0 menu hide -kernel /boot/addons/chain.c32 +kernel /boot/isolinux/chain.c32 append fd0 label hd diff --git a/templates/boot/isolinux/isolinux.cfg b/templates/boot/isolinux/isolinux.cfg index fb64279c7..91f7fa828 100644 --- a/templates/boot/isolinux/isolinux.cfg +++ b/templates/boot/isolinux/isolinux.cfg @@ -56,10 +56,7 @@ # # b = Back to main menu... # 2 = Grub2 -# 1 = Grub1 -# a = All-in-One-Image -# x = GPXE -# f = FreeDOS +# x = iPXE # m = Memtest86+ # t = Hardware Detection Tool # diff --git a/templates/grub-theme-sources/README.md b/templates/grub-theme-sources/README.md new file mode 100644 index 000000000..617b7b748 --- /dev/null +++ b/templates/grub-theme-sources/README.md @@ -0,0 +1,5 @@ +Grub Theme image sources +======================== + +Source files used to build the PNGs in templates/boot/grub/grml-theme. +Affinity Photo 2 was used. diff --git a/templates/grub-theme-sources/logo.afphoto b/templates/grub-theme-sources/logo.afphoto new file mode 100644 index 000000000..1eec52927 Binary files /dev/null and b/templates/grub-theme-sources/logo.afphoto differ diff --git a/templates/grub-theme-sources/menu_c.afphoto b/templates/grub-theme-sources/menu_c.afphoto new file mode 100644 index 000000000..c166c4ee3 Binary files /dev/null and b/templates/grub-theme-sources/menu_c.afphoto differ diff --git a/templates/grub-theme-sources/menu_e.afphoto b/templates/grub-theme-sources/menu_e.afphoto new file mode 100644 index 000000000..03d2d5c92 Binary files /dev/null and b/templates/grub-theme-sources/menu_e.afphoto differ diff --git a/templates/grub-theme-sources/menu_s.afphoto b/templates/grub-theme-sources/menu_s.afphoto new file mode 100644 index 000000000..d750ac782 Binary files /dev/null and b/templates/grub-theme-sources/menu_s.afphoto differ diff --git a/templates/grub-theme-sources/scbf_c_n_s.afphoto b/templates/grub-theme-sources/scbf_c_n_s.afphoto new file mode 100644 index 000000000..226029541 Binary files /dev/null and b/templates/grub-theme-sources/scbf_c_n_s.afphoto differ diff --git a/templates/grub-theme-sources/scbt_c_n_s.afphoto b/templates/grub-theme-sources/scbt_c_n_s.afphoto new file mode 100644 index 000000000..328cdbe22 Binary files /dev/null and b/templates/grub-theme-sources/scbt_c_n_s.afphoto differ diff --git a/templates/grub-theme-sources/uefi.afphoto b/templates/grub-theme-sources/uefi.afphoto new file mode 100644 index 000000000..5bd89bc4d Binary files /dev/null and b/templates/grub-theme-sources/uefi.afphoto differ diff --git a/templates/grub-theme-sources/uefisec.afphoto b/templates/grub-theme-sources/uefisec.afphoto new file mode 100644 index 000000000..5b825d508 Binary files /dev/null and b/templates/grub-theme-sources/uefisec.afphoto differ diff --git a/templates/wallpaper/font.otf b/templates/wallpaper/font.otf new file mode 120000 index 000000000..3f6100860 --- /dev/null +++ b/templates/wallpaper/font.otf @@ -0,0 +1 @@ +graphicoreBitmapFont0-Light.otf \ No newline at end of file diff --git a/fonts/graphicoreBitmapFont0-Light.otf b/templates/wallpaper/graphicoreBitmapFont0-Light.otf similarity index 100% rename from fonts/graphicoreBitmapFont0-Light.otf rename to templates/wallpaper/graphicoreBitmapFont0-Light.otf diff --git a/etc/grml/fai/config/files/usr/share/grml/desktop-bg.png/GRMLBASE b/templates/wallpaper/input.png similarity index 100% rename from etc/grml/fai/config/files/usr/share/grml/desktop-bg.png/GRMLBASE rename to templates/wallpaper/input.png diff --git a/test/docker-build-deb.sh b/test/docker-build-deb.sh new file mode 100755 index 000000000..1e0e3993c --- /dev/null +++ b/test/docker-build-deb.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Build a deb. +# To be run inside docker, as this script assumes it can modify the running OS. + +set -eu -o pipefail +set -x + +if [ "${1:-}" != "--autobuild" ]; then + echo "$0: Only intended for CI scenarios, will destroy source files and modify running OS." >&2 + exit 1 +fi +BUILD_NUMBER="${2:-}" +if [ -z "$BUILD_NUMBER" ]; then + echo "$0: missing build number in arguments" >&2 + exit 1 +fi + +apt-get update +apt-get install -qq -y --no-install-recommends build-essential devscripts equivs + +SOURCEDIR=$PWD + +cd /tmp +mk-build-deps -ir -t 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y' "$SOURCEDIR"/debian/control + +dpkg-source -b "$SOURCEDIR" +dpkg-source -x ./*.dsc builddir +cd builddir + +OLD_VERSION=$(dpkg-parsechangelog -SVersion) + +cat > debian/changelog < $(date -R) +EOT + +dpkg-buildpackage -b --no-sign + +mv ../*deb "$SOURCEDIR"/ diff --git a/test/gha-build-deb.sh b/test/gha-build-deb.sh new file mode 100755 index 000000000..81f53aa80 --- /dev/null +++ b/test/gha-build-deb.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Entrypoint for GitHub Actions to build a deb. + +set -eu -o pipefail +set -x + +if [ -z "${CI:-}" ] || [ -z "${GITHUB_RUN_NUMBER:-}" ]; then + echo "Running outside of CI pipeline." >&2 + exit 1 +fi + +docker run --privileged -v "$(pwd)":/code --rm -i debian:"$HOST_RELEASE" \ + bash -c 'TERM='"$TERM"' cd /code && ./test/docker-build-deb.sh --autobuild '"$GITHUB_RUN_NUMBER" diff --git a/test/gha-build-iso.sh b/test/gha-build-iso.sh new file mode 100755 index 000000000..5061d11c2 --- /dev/null +++ b/test/gha-build-iso.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Entrypoint for GitHub Actions to build an ISO with a minimal setup, +# just to validate grml-live itself. + +set -euxo pipefail + +MODE=$1 + +# Install as few Debian packages as possible, +# we do not want to test *Debian*. +cat > config/package_config/GRML_GHACI <build-gha-ci-test-config-initial <build-gha-ci-test-config-build-only-first <build-gha-ci-test-config-build-only-second <)IPREFIX}) _wanted list expl 'classe(s)' compadd -S, -F already -q ${expl} -- \ - /etc/grml/fai/config/class/*(.N:t:r) ${static_classes} + /usr/share/grml-live/config/class/*(.N:t:r) ${static_classes} } #}}} _grmllive_suites() { #{{{ @@ -62,7 +62,7 @@ arguments=( #{{{ '-c[available grml-live classes]:classe(s):_grmllive_classes' '-C[configuration file for grml-live]:configuration file:_files' '-d[use specified date instead of build time as date of release]:date:' - '-D[use specified configuration directory instead of /etc/grml/fai]:directory:_path_files -/' + '-D[use specified configuration directory instead of /usr/share/grml-live/config]:directory:_path_files -/' '-e[extract ISO and squashfs contents from iso_name]:ISO file:' '-F[force execution without prompting for yes/no]' '-g[grml flavour to use]:grml flavour(s):_grmllive_flavours'