From f3b335ea5c94d5cf24ec6b9184106b298849f311 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 26 Jun 2011 17:43:01 +0200 Subject: [PATCH] Implement -D option to set configuration directory; fai.conf: don't set variables grml-live is setting via cmdline now; provide new scripts to deploy configuration files (/etc/inittab, /etc/locale.gen, /etc/modules); rework and adapt cleanup scripts accordingly [Closes: issue880] Get rid of /etc/grml/fai/config/grml/grml-cleanup_chroot*. and also drop deprecated checks. Do NOT clean up /home/grml and /root unless using the RELEASE class. This might make some users happy I guess. :) Deploy /etc/inittab, /etc/locale.gen and /etc/modules using according fcopy commands. Now shipping new scripts GRMLBASE/16-depmod, GRMLBASE/41-modules, GRMLBASE/91-update-pciids, GRMLBASE/92-update-freshclam, GRML_SMALL/90-update-alternatives, GRML_SMALL/98-clean-chroot, RELEASE/98-clean-chroot, REMOVE_DOCS/98-clean-chroot and LATEX/98-clean-chroot. While at it build /etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE based on /etc/grml/fai/apt/sources.list to get rid of editing config files on the fly. This is a major Q/A rework, giving the user a much better handling of scripts using FAI's class concept. --- TODO | 3 - debian/grml-live.dirs | 1 - docs/design.txt | 2 +- docs/grml-live.txt | 79 +++-- etc/grml/fai/apt/important_note.txt | 4 - etc/grml/fai/apt/sources.list | 12 +- .../files/etc/apt/apt.conf.d/15grml-live/GRMLBASE | 2 +- etc/grml/fai/config/files/etc/fstab/GRMLBASE | 4 +- etc/grml/fai/config/files/etc/hosts/GRMLBASE | 4 +- etc/grml/fai/config/files/etc/inittab/GRMLBASE | 98 ++++++ etc/grml/fai/config/files/etc/inittab/GRML_SMALL | 98 ++++++ etc/grml/fai/config/files/etc/locale.gen/GRMLBASE | 23 ++ etc/grml/fai/config/files/etc/locale.gen/GRML_FULL | 98 ++++++ etc/grml/fai/config/files/etc/locale.gen/LOCALES | 98 ++++++ .../files/etc/modprobe.d/loop-part.conf/GRMLBASE | 4 +- .../files/etc/modprobe.d/radeon-kms.conf/GRMLBASE | 4 +- etc/grml/fai/config/files/etc/modules/GRMLBASE | 10 + etc/grml/fai/config/files/etc/motd/GRMLBASE | 2 +- .../config/files/etc/network/interfaces/GRMLBASE | 4 +- .../fai/config/files/etc/runlevel.conf/GRMLBASE | 4 +- etc/grml/fai/config/files/etc/sudoers/GRMLBASE | 4 +- .../initramfs-tools/scripts/init-top/grml/GRMLBASE | 4 +- etc/grml/fai/config/hooks/instsoft.GRMLBASE | 35 +- etc/grml/fai/config/hooks/updatebase.GRMLBASE | 14 +- .../scripts/DEBORPHAN/98-clean-chroot} | 12 +- etc/grml/fai/config/scripts/GRMLBASE/01-packages | 4 +- etc/grml/fai/config/scripts/GRMLBASE/02-run | 4 +- etc/grml/fai/config/scripts/GRMLBASE/05-hostname | 4 +- .../fai/config/scripts/GRMLBASE/10-build-initramfs | 9 +- etc/grml/fai/config/scripts/GRMLBASE/15-initsetup | 7 +- etc/grml/fai/config/scripts/GRMLBASE/16-depmod | 25 ++ etc/grml/fai/config/scripts/GRMLBASE/18-timesetup | 4 +- etc/grml/fai/config/scripts/GRMLBASE/20-sudo | 4 +- etc/grml/fai/config/scripts/GRMLBASE/21-usersetup | 4 +- etc/grml/fai/config/scripts/GRMLBASE/25-locales | 42 ++- etc/grml/fai/config/scripts/GRMLBASE/30-fstab | 4 +- etc/grml/fai/config/scripts/GRMLBASE/31-motd | 4 +- etc/grml/fai/config/scripts/GRMLBASE/32-xorg | 4 +- etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup | 27 +- etc/grml/fai/config/scripts/GRMLBASE/34-hosts | 4 +- etc/grml/fai/config/scripts/GRMLBASE/35-network | 4 +- .../fai/config/scripts/GRMLBASE/36-cpufrequtils | 4 +- etc/grml/fai/config/scripts/GRMLBASE/37-portmap | 4 +- etc/grml/fai/config/scripts/GRMLBASE/38-udev | 4 +- etc/grml/fai/config/scripts/GRMLBASE/39-modprobe | 4 +- etc/grml/fai/config/scripts/GRMLBASE/40-deborphan | 4 +- etc/grml/fai/config/scripts/GRMLBASE/41-modules | 15 + .../config/scripts/GRMLBASE/90-update-alternatives | 62 ++-- .../fai/config/scripts/GRMLBASE/91-update-pciids | 33 ++ .../config/scripts/GRMLBASE/92-update-freshclam | 31 ++ .../config/scripts/GRMLBASE/95-package-information | 8 +- .../fai/config/scripts/GRMLBASE/96-apt-listbugs | 13 +- .../fai/config/scripts/GRMLBASE/97-apt-listchanges | 13 +- .../fai/config/scripts/GRMLBASE/98-clean-chroot | 217 ++++++++++--- .../config/scripts/GRMLBASE/99-finish-grml-build | 9 +- .../scripts/GRML_SMALL/90-update-alternatives | 32 ++ .../fai/config/scripts/GRML_SMALL/98-clean-chroot | 60 ++++ etc/grml/fai/config/scripts/LATEX/98-clean-chroot | 22 ++ .../fai/config/scripts/RELEASE/98-clean-chroot | 25 ++ .../fai/config/scripts/REMOVE_DOCS/98-clean-chroot | 33 ++ etc/grml/fai/fai.conf | 11 +- etc/grml/fai/grml/grml_cleanup_chroot | 351 --------------------- .../fai/grml/grml_cleanup_chroot.latex_cleanup | 21 -- etc/grml/fai/grml/grml_cleanup_chroot.online | 51 --- etc/grml/fai/grml/grml_cleanup_chroot.remove_docs | 33 -- etc/grml/fai/make-fai-nfsroot.conf | 2 +- etc/grml/grml-live.conf | 4 +- grml-live | 109 +++---- 68 files changed, 1152 insertions(+), 800 deletions(-) delete mode 100644 etc/grml/fai/apt/important_note.txt create mode 100644 etc/grml/fai/config/files/etc/inittab/GRMLBASE create mode 100644 etc/grml/fai/config/files/etc/inittab/GRML_SMALL create mode 100644 etc/grml/fai/config/files/etc/locale.gen/GRMLBASE create mode 100644 etc/grml/fai/config/files/etc/locale.gen/GRML_FULL create mode 100644 etc/grml/fai/config/files/etc/locale.gen/LOCALES create mode 100644 etc/grml/fai/config/files/etc/modules/GRMLBASE rename etc/grml/fai/{grml/grml_cleanup_chroot.deborphan => config/scripts/DEBORPHAN/98-clean-chroot} (63%) create mode 100755 etc/grml/fai/config/scripts/GRMLBASE/16-depmod create mode 100755 etc/grml/fai/config/scripts/GRMLBASE/41-modules create mode 100755 etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids create mode 100755 etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam create mode 100755 etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives create mode 100755 etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot create mode 100755 etc/grml/fai/config/scripts/LATEX/98-clean-chroot create mode 100755 etc/grml/fai/config/scripts/RELEASE/98-clean-chroot create mode 100755 etc/grml/fai/config/scripts/REMOVE_DOCS/98-clean-chroot delete mode 100755 etc/grml/fai/grml/grml_cleanup_chroot delete mode 100755 etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup delete mode 100755 etc/grml/fai/grml/grml_cleanup_chroot.online delete mode 100755 etc/grml/fai/grml/grml_cleanup_chroot.remove_docs diff --git a/TODO b/TODO index e20428b..84b9af5 100644 --- a/TODO +++ b/TODO @@ -20,9 +20,6 @@ Patches, ideas and feedback welcome. * support multiple kernel versions installed in one single live-system -* support configuration of grml-live through specific directory instead - of /etc/grml/* [see http://bts.grml.org/grml/issue880] - * Provide different interfaces for easy and common use of grml-live: - a console interface (using dialog/stfl/...) - a graphical interface (for example using pygtk) diff --git a/debian/grml-live.dirs b/debian/grml-live.dirs index 0b5c285..200b9b0 100644 --- a/debian/grml-live.dirs +++ b/debian/grml-live.dirs @@ -1,4 +1,3 @@ -etc/grml/fai/live-initramfs usr/sbin usr/share/doc/grml-live usr/share/grml-live diff --git a/docs/design.txt b/docs/design.txt index 91ca7d9..4c5d368 100644 --- a/docs/design.txt +++ b/docs/design.txt @@ -57,7 +57,7 @@ Configuration handling: * parse_config_files(mainconfig=/etc/grml/grml-live.conf, localconfig=/etc/grml/grml-live.local): read /etc/grml/grml-live.local and /etc/grml/grml-live.conf * cmdline_opts(): parse commandline, overrides configuration from parse_config() -* update_config_files(): write active configuration to configuration files (like /etc/grml/fai/apt/sources.list) +* update_config_files(): write active configuration to configuration files (like ${GRML_FAI_CONFIG}/apt/sources.list) Installation of files: diff --git a/docs/grml-live.txt b/docs/grml-live.txt index 7757fd3..8cc0955 100644 --- a/docs/grml-live.txt +++ b/docs/grml-live.txt @@ -35,8 +35,9 @@ 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 /etc/grml/fai. This ensures that it does not clash with -default FAI configuration and packages, so you can use grml-live and FAI +provides and uses ${GRML_FAI_CONFIG} which is pointing to /etc/grml/fai by default +(unless overriden 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! [NOTE] @@ -104,9 +105,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 /etc/grml/fai/config. Instead use +supported inside the scripts/hooks/classes at ${GRML_FAI_CONFIG}/config. Instead use /etc/grml/grml-live.local for configuration stuff used inside -/etc/grml/fai/config. +${GRML_FAI_CONFIG}/config. -d **DATE**:: @@ -118,6 +119,16 @@ the bootsplash related files. This option is useful if you want to provide an ISO with release information for a specific date but have to build it in 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. + -F:: Force execution and do not prompt for acknowledgment of configuration. @@ -182,7 +193,7 @@ Specify name of the release. Specify the Debian suite you want to use for your live-system. Defaults to "squeeze" (being current Debian/stable). Supported values are: etch, lenny, squeeze, sid. Debian "squeeze" requires a recent base.tgz -(/etc/grml/fai/config/basefiles/$CLASSNAME.tar.gz) or a recent version of +(${GRML_FAI_CONFIG}/config/basefiles/$CLASSNAME.tar.gz) or a recent version of debootstrap. -t **TEMPLATE_DIRECTORY**:: @@ -273,11 +284,11 @@ grml-live, as well as the architecture dependent class which provides the kernel GRML_SMALL, GRML_MEDIUM or GRML_FULL). The following files and directories are relevant for class GRMLBASE by default: - /etc/grml/fai/config/scripts/GRMLBASE/ - /etc/grml/fai/config/debconf/GRMLBASE - /etc/grml/fai/config/class/GRMLBASE.var - /etc/grml/fai/config/hooks/instsoft.GRMLBASE - /etc/grml/fai/config/package_config/GRMLBASE + ${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 Take a look at the next section for information about the concept of those files/directories. @@ -298,8 +309,8 @@ Available classes ----------------- The package selection part of the classes can be found in -/etc/grml/fai/config/package_config whereas some further classes are defined for -example in /etc/grml/fai/config/scripts/ so specific feature sets can be +${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 selected. The following classes are predefined: * DEBORPHAN: get rid of all packages listed in output of Deborphan @@ -347,7 +358,7 @@ 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 /etc/grml/fai/fai.conf instead. For more details see +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 @@ -371,56 +382,56 @@ 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. - /etc/grml/fai/fai.conf + ${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 -FAI_CONFIGDIR=/etc/grml/fai/config - both pointing to a directory shipped by +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. - /etc/grml/fai/make-fai-nfsroot.conf + ${GRML_FAI_CONFIG}/make-fai-nfsroot.conf This file is used by make-fai-nfsroot(8) only. Usually you don't have to change anything inside this file. If you want to modify NFSROOT though you can adjust it there. - /etc/grml/fai/NFSROOT + ${GRML_FAI_CONFIG}/NFSROOT This file specifies the package list for creating the NFSROOT. - /etc/grml/fai/apt/sources.list + ${GRML_FAI_CONFIG}/apt/sources.list This file specifies which mirrors should be considered for retrieving the Debian packages when creating the main chroot (including all the software you would like to see included). Important: this file should *not* be adjusted manually! Instead use the GRML_LIVE_SOURCES variable inside /etc/grml/grml-live.conf or -/etc/grml/grml-live.local which modifies /etc/grml/fai/apt/sources.list +/etc/grml/grml-live.local which modifies ${GRML_FAI_CONFIG}/apt/sources.list on-the-fly via grml-live then. If you want to generally adjust apt configuration -use FAI's fcopy command with /etc/grml/fai/config/files instead. +use FAI's fcopy command with ${GRML_FAI_CONFIG}/config/files instead. - /etc/grml/fai/config/ + ${GRML_FAI_CONFIG}/config/ The main directory for configuration of FAI/grml-live. More details below. - /etc/grml/fai/config/class/ + ${GRML_FAI_CONFIG}/config/class/ This directory contains files which specify main configuration variables for the FAI classes. - /etc/grml/fai/config/debconf/ + ${GRML_FAI_CONFIG}/config/debconf/ This directory provides the files for preseeding/configuration of debconf through files. - /etc/grml/fai/config/hooks/ + ${GRML_FAI_CONFIG}/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. - /etc/grml/fai/config/package_config/ + ${GRML_FAI_CONFIG}/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 @@ -432,11 +443,11 @@ 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. - /etc/grml/fai/config/scripts/ + ${GRML_FAI_CONFIG}/config/scripts/ Scripts for customising the ISO within the build process. - /etc/grml/fai/live-initramfs/ + ${GRML_FAI_CONFIG}/live-initramfs/ This directory provides the files used for building the initramfs/initrd via live-initramfs(8). @@ -812,6 +823,18 @@ worked as expected the last line of the shell output should look like: and the ISO can be found inside /grml-live/grml-live/grml_isos/ then. +[[grml_fai_config_variable]] +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 +configuration files, scripts and hooks will be taken from your +'$GRML_FAI_CONFIG' directory. + [[fai-on-etch]] Help, I'm using Debian etch and I don't have FAI version >3.2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -908,7 +931,7 @@ adjust MIRROR_DIRECTORY and MIRROR_SOURCES inside /etc/grml/grml-live.conf as well. Unless you specify GRML_LIVE_SOURCES and/or FAI_DEBOOTSTRAP the default from -/etc/grml/fai/apt/sources.list and /etc/grml/fai/make-fai-nfsroot.conf will be +${GRML_FAI_CONFIG}/apt/sources.list and ${GRML_FAI_CONFIG}/make-fai-nfsroot.conf will be taken. If you customise the variables in /etc/grml/grml-live.conf then the two files will be adjusted during runtime automatically. diff --git a/etc/grml/fai/apt/important_note.txt b/etc/grml/fai/apt/important_note.txt deleted file mode 100644 index ed10c48..0000000 --- a/etc/grml/fai/apt/important_note.txt +++ /dev/null @@ -1,4 +0,0 @@ -# NOTE: This directory is *NOT* meant for manual customisation! Files in this -# directory are written by grml-live only and any changes might be overridden. -# You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* -# or FAI's fcopy command with /etc/grml/fai/config/files instead! diff --git a/etc/grml/fai/apt/sources.list b/etc/grml/fai/apt/sources.list index b5671a1..95f030b 100644 --- a/etc/grml/fai/apt/sources.list +++ b/etc/grml/fai/apt/sources.list @@ -1,7 +1,9 @@ -# NOTE: This file is *NOT* meant for manual customisation! This file is -# modified by grml-live and any changes might be overridden. -# You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* -# or FAI's fcopy command with /etc/grml/fai/config/files instead! +# NOTE: This file is used as input file for generating +# ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRMLBASE +# which is copied to /etc/apt/sources.list to the chroot. +# Do *NOT* modify this file directly but instead consider using +# GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* or FAI's +# fcopy command with ${GRML_FAI_CONFIG}/config/files instead! deb http://deb.grml.org/ grml-stable main deb http://deb.grml.org/ grml-testing main -deb http://cdn.debian.net/debian lenny main contrib non-free +deb http://cdn.debian.net/debian squeeze main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE b/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE index 4b92b37..aa23109 100644 --- a/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE +++ b/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE @@ -1,4 +1,4 @@ -// Installed via /etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE +// 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" diff --git a/etc/grml/fai/config/files/etc/fstab/GRMLBASE b/etc/grml/fai/config/files/etc/fstab/GRMLBASE index 89da7df..4a1e5a7 100644 --- a/etc/grml/fai/config/files/etc/fstab/GRMLBASE +++ b/etc/grml/fai/config/files/etc/fstab/GRMLBASE @@ -1,8 +1,8 @@ # /etc/fstab - static file system information # # This file was deployed via grml-live's -# /etc/grml/fai/config/scripts/GRMLBASE/30-fstab script, using -# /etc/grml/fai/config/files/etc/fstab/GRMLBASE +# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/30-fstab script, using +# ${GRML_FAI_CONFIG}/config/files/etc/fstab/GRMLBASE # # proc /proc proc rw,nosuid,nodev,noexec 0 0 diff --git a/etc/grml/fai/config/files/etc/hosts/GRMLBASE b/etc/grml/fai/config/files/etc/hosts/GRMLBASE index 5912c03..3f0650e 100644 --- a/etc/grml/fai/config/files/etc/hosts/GRMLBASE +++ b/etc/grml/fai/config/files/etc/hosts/GRMLBASE @@ -1,6 +1,6 @@ # This file was deployed via grml-live's -# /etc/grml/fai/config/scripts/GRMLBASE/34-hosts script, using -# /etc/grml/fai/config/files/etc/hosts/GRMLBASE +# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/34-hosts script, using +# ${GRML_FAI_CONFIG}/config/files/etc/hosts/GRMLBASE 127.0.0.1 $HOSTNAME localhost diff --git a/etc/grml/fai/config/files/etc/inittab/GRMLBASE b/etc/grml/fai/config/files/etc/inittab/GRMLBASE new file mode 100644 index 0000000..30257ea --- /dev/null +++ b/etc/grml/fai/config/files/etc/inittab/GRMLBASE @@ -0,0 +1,98 @@ +# This file was deployed via grml-live's +# ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/15-initsetup script, using +# ${GRML_FAI_CONFIG}/config/files/etc/inittab/GRMLBASE +################################################################################ +# Filename: inittab +# Purpose: init(8) 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. +################################################################################ + +# The default runlevel. +id:2:initdefault: + +# Boot-time system configuration/initialization script. +# This is run first except when booting in emergency (-b) mode. +si::sysinit:/etc/init.d/rcS + +# What to do in single-user mode. +~~:S:respawn:/bin/zsh --login >/dev/tty1 2>&1 ::: +# 4 virtual consoles with immortal shells +# Note that on most Debian systems tty7 is used by the X Window System. +# Use tty8 a second xserver. +1:12345:respawn:/sbin/rungetty tty1 --noclear -u root -g root --autologin root /usr/bin/zsh-login +2:2345:respawn:/sbin/rungetty tty2 -u root -g root --autologin root /usr/bin/grml-screen +3:2345:respawn:/sbin/rungetty tty3 -u root -g root --autologin root /usr/bin/grml-screen +4:2345:respawn:/sbin/rungetty tty4 -u grml -g grml --autologin grml /usr/bin/grml-init +5:2345:respawn:/sbin/rungetty tty5 -u grml -g grml --autologin grml /usr/bin/grml-init +6:2345:respawn:/sbin/rungetty tty6 -u grml -g grml --autologin grml /usr/bin/grml-init +9:2345:respawn:/sbin/getty 38400 tty9 +10:2345:respawn:/bin/zsh --login -c "/usr/sbin/grml-iptstate ; /usr/bin/grml-screen" >/dev/tty10 2>&1 /dev/tty11 2>&1 /dev/tty12 2>&1 +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +################################################################################ + +# The default runlevel. +id:2:initdefault: + +# Boot-time system configuration/initialization script. +# This is run first except when booting in emergency (-b) mode. +si::sysinit:/etc/init.d/rcS + +# What to do in single-user mode. +~~:S:respawn:/bin/zsh --login >/dev/tty1 2>&1 ::: +# 4 virtual consoles with immortal shells +# Note that on most Debian systems tty7 is used by the X Window System. +# Use tty8 a second xserver. +1:12345:respawn:/sbin/rungetty tty1 --noclear -u root -g root --autologin root /usr/bin/zsh-login +2:2345:respawn:/sbin/rungetty tty2 -u grml -g grml --autologin grml /usr/bin/grml-init +3:2345:respawn:/sbin/rungetty tty3 -u grml -g grml --autologin grml /usr/bin/grml-init +#4:2345:respawn:/sbin/rungetty tty4 -u grml -g grml --autologin grml /usr/bin/grml-init +#5:2345:respawn:/sbin/rungetty tty5 -u grml -g grml --autologin grml /usr/bin/grml-init +#6:2345:respawn:/sbin/rungetty tty6 -u grml -g grml --autologin grml /usr/bin/grml-init +#9:2345:respawn:/sbin/getty 38400 tty9 +#10:2345:respawn:/bin/zsh --login -c "/usr/sbin/grml-iptstate ; /usr/bin/grml-screen" >/dev/tty10 2>&1 /dev/tty11 2>&1 /dev/tty12 2>&1 # Bug-Reports: see http://grml.org/bugs/ @@ -9,6 +9,9 @@ set -u set -e +GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list" +DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list" + # if hooks/updatebase.GRMLBASE fails for whatever reason # and can't skip instsoft.GRMLBASE we have to make sure # we exit here as well @@ -62,28 +65,22 @@ EOF # FAI softupdate executes upgrade only with the sources.list being # present in the chroot - so let's do it on our own: - if [ -r /etc/grml/fai/apt/sources.list ] ; then - if [ -L $target/etc/apt/sources.list ] ; then - rm $target/etc/apt/sources.list - fi - - # install grml-live's (on the fly adjusted) sources.list config - cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list.d/grml-live.list + fcopy /etc/apt/sources.list + + # when re-running grml-live with the -u option we do not want to use the + # sources.list config of the live system but grml-live's config instead, + # therefore temporarly move known files and restore them again later on + # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup: + if [ -r "$GRML_SOURCES_LIST" ] ; then + mv "$GRML_SOURCES_LIST" "${GRML_SOURCES_LIST}.unused" + fi - # when re-running grml-live with the -u option we do not want to use the - # sources.list config of the live system but grml-live's config instead, - # therefore temporarly move known files and restore them again later on - # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup: - if [ -r $target/etc/apt/sources.list.d/grml.list ] ; then - mv $target/etc/apt/sources.list.d/grml.list $target/etc/apt/sources.list.d/grml.unused - fi - if [ -r $target/etc/apt/sources.list.d/debian.list ] ; then - mv $target/etc/apt/sources.list.d/debian.list $target/etc/apt/sources.list.d/debian.unused - fi + if [ -r "$DEBIAN_SOURCES_LIST" ] ; then + mv "$DEBIAN_SOURCES_LIST" "${DEBIAN_SOURCES_LIST}.unused" fi # run it on our own, as updatebase is used at the wrong stage for our needs, - # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE + # see ${GRML_FAI_CONFIG}/hooks/updatebase.GRMLBASE # the apt-get update might return an error if there's for example # a hashsum mismatch on Debian mirror sources, we might want to continue # but should warn the user diff --git a/etc/grml/fai/config/hooks/updatebase.GRMLBASE b/etc/grml/fai/config/hooks/updatebase.GRMLBASE index e38754d..52a3eee 100755 --- a/etc/grml/fai/config/hooks/updatebase.GRMLBASE +++ b/etc/grml/fai/config/hooks/updatebase.GRMLBASE @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/hooks/updatebase.GRMLBASE +# Filename: ${GRML_FAI_CONFIG}/hooks/updatebase.GRMLBASE # Purpose: Updates the base packages of the system, prepare chroot for instsoft # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -54,20 +54,14 @@ if [ -n "$BOOTSTRAP_ONLY" ] ; then skiptask configure fi -# no softupdate but updating chroot e.g. based on /etc/grml/fai/config/basefiles/* +# no softupdate but updating chroot e.g. based on ${GRML_FAI_CONFIG}/basefiles/* echo "Action $FAI_ACTION of FAI (hooks/updatebase.GRMLBASE) via grml-live running" # install all apt related files fcopy -r /etc/apt -# remove grml-live's notice file from chroot: -if [ -r $target/etc/apt/important_note.txt ] ; then - grep -q GRML_LIVE_SOURCES $target/etc/apt/important_note.txt && rm $target/etc/apt/important_note.txt -fi - -# install grml gpg key: -fcopy /etc/apt/grml.key +# install Grml gpg key: $ROOTCMD apt-key add /etc/apt/grml.key ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/grml/grml_cleanup_chroot.deborphan b/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot similarity index 63% rename from etc/grml/fai/grml/grml_cleanup_chroot.deborphan rename to etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot index 13e2291..a5515f0 100755 --- a/etc/grml/fai/grml/grml_cleanup_chroot.deborphan +++ b/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot @@ -1,17 +1,21 @@ #!/bin/bash -# Filename: /etc/grml/fai/grml/grml_cleanup_chroot.deborphan +# Filename: ${GRML_FAI_CONFIG}/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/ # License: This file is licensed under the GPL v2. ################################################################################ +set -u +set -e + # remove all packages not necessary anymore: -apt-get -y --purge autoremove +$ROOTCMD apt-get -y --purge autoremove # remove packages until deborphan does not find anymore: -while [ "$(deborphan)" != "" ] ; do - apt-get -y --purge remove $(deborphan) +while [ "$($ROOTCMD deborphan)" != "" ] ; do + $ROOTCMD apt-get -y --purge remove $(deborphan) done ## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/01-packages b/etc/grml/fai/config/scripts/GRMLBASE/01-packages index 3033c72..b598516 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/01-packages +++ b/etc/grml/fai/config/scripts/GRMLBASE/01-packages @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/01-packages +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -27,4 +27,4 @@ else fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/02-run b/etc/grml/fai/config/scripts/GRMLBASE/02-run index 86b86ee..6fab557 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/02-run +++ b/etc/grml/fai/config/scripts/GRMLBASE/02-run @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/02-run +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/02-run # Purpose: cleanup after initscripts postinst for /run # Authors: grml-team (grml.org) # Bug-Reports: see http://grml.org/bugs/ @@ -25,4 +25,4 @@ if [ -L "$target/run" ] ; then fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/05-hostname b/etc/grml/fai/config/scripts/GRMLBASE/05-hostname index df9c832..4751ecc 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/05-hostname +++ b/etc/grml/fai/config/scripts/GRMLBASE/05-hostname @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/05-hostname +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -37,4 +37,4 @@ if [ -r $target/etc/bacula/bacula-fd.conf ] ; then fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/10-build-initramfs b/etc/grml/fai/config/scripts/GRMLBASE/10-build-initramfs index ea21a6a..b85fc80 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/10-build-initramfs +++ b/etc/grml/fai/config/scripts/GRMLBASE/10-build-initramfs @@ -1,11 +1,12 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/10-build-initramfs +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/10-build-initramfs # Purpose: configure live-initramfs and build initramfs for booting # 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 /usr/share/initramfs-tools/scripts/init-top/grml @@ -13,11 +14,11 @@ fcopy /etc/initramfs-tools/hooks/000-udev-shutup fcopy /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 + echo "Error: live-boot/-initramfs does not seem to be present, can not create initramfs. Exiting.">&2 + exit 1 fi # The initramfs itself will be created through grml-live script itself. ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup b/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup index fd8b1c6..c49f70c 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/15-initsetup +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -28,5 +28,8 @@ cp $target/etc/runlevel.conf $target/etc/runlevel.conf.original # provide Grml's default file-rc configuration fcopy /etc/runlevel.conf +# provide Grml's inittab configuration +fcopy /etc/inittab + ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/16-depmod b/etc/grml/fai/config/scripts/GRMLBASE/16-depmod new file mode 100755 index 0000000..3f41ca8 --- /dev/null +++ b/etc/grml/fai/config/scripts/GRMLBASE/16-depmod @@ -0,0 +1,25 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/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/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +set -u +set -e + +if ! [ -x $target/sbin/depmod ] ; then + echo "Warning: depmod not installed" + exit 0 +fi + +# detect kernel version, assume newest kernel version +for kernel in $(find $target/lib/modules/ -maxdepth 1 -type d -name [0-9]*) ; do + kernelversion=$(basename $kernel) + echo "Updating modules.dep for kernel $kernelversion" + $ROOTCMD depmod -ae -F /boot/System.map-"$kernelversion" "$kernelversion" +done + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/18-timesetup b/etc/grml/fai/config/scripts/GRMLBASE/18-timesetup index de37666..21b5084 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/18-timesetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/18-timesetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/18-timesetup +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -31,4 +31,4 @@ if [ -n "$TIMEZONE" ] ; then fi ## END OF FILE ################################################################ -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/20-sudo b/etc/grml/fai/config/scripts/GRMLBASE/20-sudo index 22c07cb..d89c196 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/20-sudo +++ b/etc/grml/fai/config/scripts/GRMLBASE/20-sudo @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/20-sudo +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -19,4 +19,4 @@ sed -i "s/\$USERNAME/$USERNAME/" $target/etc/sudoers chmod 440 $target/etc/sudoers ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup b/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup index de3d2cc..6ca33c7 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/21-usersetup +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -80,4 +80,4 @@ if [ -r $target/bin/zsh ] ; then fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/25-locales b/etc/grml/fai/config/scripts/GRMLBASE/25-locales index ccc4028..58ed8c7 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/25-locales +++ b/etc/grml/fai/config/scripts/GRMLBASE/25-locales @@ -1,36 +1,26 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/25-locales +# Filename: ${GRML_FAI_CONFIG}/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/ # License: This file is licensed under the GPL v2 or any later version. ################################################################################ +set -u set -e -if [ -z "$ROOTCMD" ] ; then - echo "variable \$ROOTCMD not set, exiting to avoid any possible damage">&2 - exit 1 -fi - -# use full locales setup only in classes GRML_FULL and LOCALES -if ifclass GRML_FULL || ifclass LOCALES ; then - echo 'Using /etc/locale.gen.grml for locales generation' - cp $target/etc/locale.gen.grml $target/etc/locale.gen -else - echo 'Using /etc/locale.gen.minimal for locales generation' - cp $target/etc/locale.gen.minimal $target/etc/locale.gen -fi +# set up /etc/locale.gen, only GRML_FULL and LOCALES have +# the full setup, GRMLBASE installs a minimal configuration +fcopy /etc/locale.gen # get rid of locales unless using class LOCALES -# TODO -# * this should be improved in the long run, ideas welcome :) -# * what about /usr/share/i18n/locales? +set +u if ! ifclass LOCALES ; then +set -u echo 'Removing /usr/share/locale' # get rid of the original - $ROOTCMD rm -rf /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 @@ -52,15 +42,19 @@ if [ -x $target/usr/sbin/localepurge ] ; then $ROOTCMD dpkg-reconfigure -f noninteractive localepurge fi -if [ -x $target/usr/sbin/locale-gen ] ; then - $ROOTCMD locale-gen +if ! [ -x $target/usr/sbin/locale-gen ] ; then + echo 'Warning: locale-gen [package locales] not installed' else - echo 'Warning: locale-gen [package locales] not available' + echo "Running locale-gen" + $ROOTCMD locale-gen fi -if [ -x $target/usr/sbin/localepurge ] ; then - $ROOTCMD localepurge +if ! [ -x $target/usr/sbin/localepurge ] ; then + echo "Warning: localepurge not installed" +else + echo "Running localepurge." + $ROOTCMD localepurge fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/30-fstab b/etc/grml/fai/config/scripts/GRMLBASE/30-fstab index c6fb844..850d2af 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/30-fstab +++ b/etc/grml/fai/config/scripts/GRMLBASE/30-fstab @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/30-fstab +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -18,4 +18,4 @@ fcopy /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=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/31-motd b/etc/grml/fai/config/scripts/GRMLBASE/31-motd index a83dfe9..71cf1f8 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/31-motd +++ b/etc/grml/fai/config/scripts/GRMLBASE/31-motd @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/31-motd +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/31-motd # Purpose: replace motd # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -12,4 +12,4 @@ set -e fcopy /etc/motd ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/32-xorg b/etc/grml/fai/config/scripts/GRMLBASE/32-xorg index b149005..238af5d 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/32-xorg +++ b/etc/grml/fai/config/scripts/GRMLBASE/32-xorg @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/32-xorg +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -19,4 +19,4 @@ if [ "$(readlink $target/etc/X11/X)" = "/bin/true" ] ; then fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup b/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup index 002e000..e4922a9 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup @@ -1,35 +1,26 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup +# Filename: ${GRML_FAI_CONFIG}/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/ # License: This file is licensed under the GPL v2 or any later version. ################################################################################ +set -u set -e -if [ -L "$target"/etc/apt/sources.list ] ; then - echo "Note: $target/etc/apt/sources.list seems to be the old sources.list setup." - echo "|-> Not modifying anything. If you want to switch to the new setup just" - echo "\`-> remove symlink $target/etc/apt/sources.list" - exit 0 -fi - -# remove leftover from /etc/grml/fai/config/hooks/instsoft.GRMLBASE: -rm -f $target/etc/apt/sources.list.d/grml-live.list +GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list" +DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list" # restore original grml sources.list file (temporarly moved via # /etc/grml/fai/config/hooks/instsoft.GRMLBASE): -if [ -r $target/etc/apt/sources.list.d/grml.unused ] ; then - mv $target/etc/apt/sources.list.d/grml.unused $target/etc/apt/sources.list.d/grml.list +if [ -r "${GRML_SOURCES_LIST}.unused" ] ; then + mv "${GRML_SOURCES_LIST}.unused" "${GRML_SOURCES_LIST}" fi -if [ -r $target/etc/apt/sources.list.d/debian.unused ] ; then - mv $target/etc/apt/sources.list.d/debian.unused $target/etc/apt/sources.list.d/debian.list +if [ -r "${DEBIAN_SOURCES_LIST}.unused" ] ; then + mv "${DEBIAN_SOURCES_LIST}.unused" "${DEBIAN_SOURCES_LIST}" fi -GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list" -DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list" - [ -d $target/etc/apt/sources.list.d ] || mkdir $target/etc/apt/sources.list.d # remove any existing sources.list and inform user about the new @@ -105,4 +96,4 @@ EOF fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/34-hosts b/etc/grml/fai/config/scripts/GRMLBASE/34-hosts index a96bd64..3f9cec1 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/34-hosts +++ b/etc/grml/fai/config/scripts/GRMLBASE/34-hosts @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/34-hosts +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -20,4 +20,4 @@ fcopy /etc/hosts sed -i "s/\$HOSTNAME/$HOSTNAME/" $target/etc/hosts ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/35-network b/etc/grml/fai/config/scripts/GRMLBASE/35-network index 1b2ba72..135b3f9 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/35-network +++ b/etc/grml/fai/config/scripts/GRMLBASE/35-network @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/35-network +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -12,4 +12,4 @@ set -e fcopy /etc/network/interfaces ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/36-cpufrequtils b/etc/grml/fai/config/scripts/GRMLBASE/36-cpufrequtils index 00b9c49..81a6367 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/36-cpufrequtils +++ b/etc/grml/fai/config/scripts/GRMLBASE/36-cpufrequtils @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/36-cpufrequtils +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/36-cpufrequtils # Purpose: configure cpufrequtils of live-system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -20,4 +20,4 @@ if [ -r $target/usr/share/doc/cpufrequtils/examples/cpufrequtils.sample ] ; then fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# 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 index 017d7d2..4dc5e3d 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/37-portmap +++ b/etc/grml/fai/config/scripts/GRMLBASE/37-portmap @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/37-portmap +# 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/ @@ -43,4 +43,4 @@ EOF fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/38-udev b/etc/grml/fai/config/scripts/GRMLBASE/38-udev index d90669c..92bd257 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/38-udev +++ b/etc/grml/fai/config/scripts/GRMLBASE/38-udev @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/38-udev +# Filename: ${GRML_FAI_CONFIG}/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/ @@ -29,4 +29,4 @@ else fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# 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 index e773fbd..6b00768 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/39-modprobe +++ b/etc/grml/fai/config/scripts/GRMLBASE/39-modprobe @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/39-modprobe +# 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/ @@ -24,4 +24,4 @@ fcopy /etc/modprobe.d/radeon-kms.conf fcopy /etc/modprobe.d/loop-part.conf ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/40-deborphan b/etc/grml/fai/config/scripts/GRMLBASE/40-deborphan index a592f5c..148880d 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/40-deborphan +++ b/etc/grml/fai/config/scripts/GRMLBASE/40-deborphan @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/40-deborphan +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/40-deborphan # Purpose: configure packages for deborphan (usually exception rules) # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ @@ -26,4 +26,4 @@ if [ -r $target//usr/lib/libstdc++-libc6.2-2.so.3 -a -x $target/usr/bin/deborpha fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/41-modules b/etc/grml/fai/config/scripts/GRMLBASE/41-modules new file mode 100755 index 0000000..796449d --- /dev/null +++ b/etc/grml/fai/config/scripts/GRMLBASE/41-modules @@ -0,0 +1,15 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/41-modules +# Purpose: set up /etc/modules +# 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 /etc/modules + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives b/etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives index b564477..b28abdd 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives +++ b/etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/90-update-alternatives +# Filename: ${GRML_FAI_CONFIG}/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,72 +9,50 @@ set -u set -e -## 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 - # 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 - # $ROOTCMD update-alternatives --set vi /usr/bin/vim.tiny - $ROOTCMD ln -sf /etc/alternatives/editor /usr/bin/editor - $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/editor - $ROOTCMD ln -sf /etc/alternatives/vi /usr/bin/vi - $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/vi - $ROOTCMD ln -sf /etc/alternatives/vim /usr/bin/vim - $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/vim - $ROOTCMD ln -sf /etc/alternatives/view /usr/bin/view - $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/view - fi -fi - if [ -r $target/usr/bin/vim.basic ] ; then - $ROOTCMD update-alternatives --set editor /usr/bin/vim.basic - $ROOTCMD update-alternatives --set vi /usr/bin/vim.basic - $ROOTCMD update-alternatives --set vim /usr/bin/vim.basic - $ROOTCMD update-alternatives --set view /usr/bin/vim.basic + $ROOTCMD update-alternatives --set editor /usr/bin/vim.basic + $ROOTCMD update-alternatives --set vi /usr/bin/vim.basic + $ROOTCMD update-alternatives --set vim /usr/bin/vim.basic + $ROOTCMD update-alternatives --set view /usr/bin/vim.basic fi if [ -r $target/usr/bin/vim.gtk ] ; then - $ROOTCMD update-alternatives --set editor /usr/bin/vim.gtk - $ROOTCMD update-alternatives --set vi /usr/bin/vim.gtk - $ROOTCMD update-alternatives --set vim /usr/bin/vim.gtk - $ROOTCMD update-alternatives --set view /usr/bin/vim.gtk + $ROOTCMD update-alternatives --set editor /usr/bin/vim.gtk + $ROOTCMD update-alternatives --set vi /usr/bin/vim.gtk + $ROOTCMD update-alternatives --set vim /usr/bin/vim.gtk + $ROOTCMD update-alternatives --set view /usr/bin/vim.gtk fi if [ -r $target/usr/bin/uxterm ] ; then - $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/uxterm + $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/uxterm elif [ -r $target/usr/bin/xterm ] ; then - $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/xterm + $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/xterm fi if [ -r $target/etc/X11/cursors/whiteglass.theme ] ; then - $ROOTCMD update-alternatives --set x-cursor-theme /etc/X11/cursors/whiteglass.theme + $ROOTCMD update-alternatives --set x-cursor-theme /etc/X11/cursors/whiteglass.theme fi if [ -r $target/usr/bin/iceweasel ] || [ -L $target/usr/bin/iceweasel ] ; then - $ROOTCMD update-alternatives --set x-www-browser /usr/bin/iceweasel + $ROOTCMD update-alternatives --set x-www-browser /usr/bin/iceweasel fi if [ -r $target/usr/bin/w3m ] ; then - $ROOTCMD update-alternatives --set www-browser /usr/bin/w3m + $ROOTCMD update-alternatives --set www-browser /usr/bin/w3m fi if [ -r $target/usr/bin/wm-ng ] ; then - # activate wm-ng only if it is registered as x-window-manager: - if $ROOTCMD update-alternatives --list x-window-manager | grep -q wm-ng ; then - $ROOTCMD update-alternatives --set x-window-manager /usr/bin/wm-ng - fi + # activate wm-ng only if it is registered as x-window-manager: + if $ROOTCMD update-alternatives --list x-window-manager | grep -q wm-ng ; then + $ROOTCMD update-alternatives --set x-window-manager /usr/bin/wm-ng + fi 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 - $ROOTCMD ln -sf /sbin/mount.ntfs-3g /sbin/mount.ntfs + $ROOTCMD ln -sf /sbin/mount.ntfs-3g /sbin/mount.ntfs fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids b/etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids new file mode 100755 index 0000000..03c674c --- /dev/null +++ b/etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids @@ -0,0 +1,33 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/91-update-pciids +# 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 91-update-pciids as NO_ONLINE is set." + exit 0 +fi + +set -u +set -e + +[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT="" + +if ! [ -x $target/usr/bin/update-pciids ] ; then + echo "Warning: update-pciids/update-usbids not installed" +else + echo "Updating PCI- and USB-ids" + if [ -n "$TIMEOUT" ] ; then + $ROOTCMD timeout $TIMEOUT update-pciids + $ROOTCMD timeout $TIMEOUT update-usbids + else + $ROOTCMD update-pciids + $ROOTCMD update-usbids + 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/92-update-freshclam b/etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam new file mode 100755 index 0000000..e34a707 --- /dev/null +++ b/etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam @@ -0,0 +1,31 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/92-update-freshclam +# Purpose: update freshclam database +# 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 91-update-pciids as NO_ONLINE is set." + exit 0 +fi + +set -u +set -e + +[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT="" + +if ! [ -x $target/usr/bin/freshclam ] ; then + echo "freshclam not installed" +else + echo "Updating clamav database via running freshclam" + if [ -n "$TIMEOUT" ] ; then + $ROOTCMD timeout $TIMEOUT /usr/bin/freshclam + else + $ROOTCMD /usr/bin/freshclam + 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 index 6886d9f..f1196de 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/95-package-information +++ b/etc/grml/fai/config/scripts/GRMLBASE/95-package-information @@ -1,11 +1,14 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/95-package-information +# 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 + HOSTNAME='' [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local @@ -13,7 +16,7 @@ HOSTNAME='' PACKAGE_LOG=/var/log/fai/"$HOSTNAME"/last/ # generate the package list and store it on the ISO itself for grml-docs: -[ -d $target/usr/share/doc/grml-docs/packages ] || mkdir $target/usr/share/doc/grml-docs/packages +[ -d $target/usr/share/doc/grml-docs/packages ] || mkdir -p $target/usr/share/doc/grml-docs/packages COLUMNS=200 $ROOTCMD dpkg --list > $target/usr/share/doc/grml-docs/packages/dpkg_list if ! [ -w "$PACKAGE_LOG" ] ; then @@ -31,3 +34,4 @@ else 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 index 65a1f53..c5095de 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs +++ b/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs @@ -1,21 +1,23 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/96-apt-listbugs # Purpose: retreive 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 + 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 HOSTNAME='' [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local @@ -57,3 +59,4 @@ if ifclass RELEASE ; then 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 index fe7c9c2..02372db 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges +++ b/etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges @@ -1,11 +1,12 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/97-apt-listchanges +# 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: @@ -16,14 +17,14 @@ set -e #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 - + 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 + 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 index 7d1239a..9a781b1 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot +++ b/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot @@ -1,70 +1,195 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot +# 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 or any later version. +# License: This file is licensed under the GPL v2. ################################################################################ +set -u set -e -# remove some big directories when using class LATEX_CLEANUP: -if ifclass LATEX_CLEANUP ; then - cp /etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup $target/root/ - $ROOTCMD /root/grml_cleanup_chroot.latex_cleanup - rm $target/root/grml_cleanup_chroot.latex_cleanup +if ! [ $(ls $target/boot/config-* 2>/dev/null) ] ; then + echo "No kernel config files (/boot/config-*) found. No kernel-image package installed?" >&2 + exit 1 fi -# skip tasks which require only when using class NO_ONLINE: -if ! ifclass NO_ONLINE ; then - cp /etc/grml/fai/grml/grml_cleanup_chroot.online $target/root/ - $ROOTCMD /root/grml_cleanup_chroot.online - rm $target/root/grml_cleanup_chroot.online +echo "Creating ~/.zshrc" +touch $target/root/.zshrc + +if [ -x $target/usr/sbin/localepurge ] ; then + echo "Running localepurge" + $ROOTCMD localepurge +else + echo "Warning: localepurg not installed" +fi + +# find /var -name \*.pid +echo "Removing pid-files" +find $target/var/run -name \*.pid -exec rm {} \; + +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/*IndexDiff \ + $target/var/lib/apt/lists/*.gpg \ + $target/var/cache/apt-show-versions/* \ + $target/var/cache/debconf/templates.dat-old \ + $target/var/cache/apt/*.bin +$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* + +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 +rm -rf $target/etc/sysconfig/* $target/etc/motd.dpkg-* $target/etc/auto.master.*dpkg* \ + $target/etc/samba/*.SID $target/etc/samba/*.tdb \ + $target/var/run/ $target/var/log/ksymoops/* $target/var/lock/* \ + $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/main $target/tmp/* \ + $target/var/tmp/* $target/var/backups/* \ + $target/var/lib/mysql $target/var/log/lilo_log.* $target/core* + +# remove only "temporary" or saved files in the given directories +nuke(){ + for i in $(find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.0 2>/dev/null); do + rm -f "$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 2>/dev/null); do + :> "$i" + done +} + +echo "Cleaning log and cache directories" +nuke ${target}/var/log ${target}/var/cache +zero ${target}/var/local ${target}/var/log \ + ${target}/var/spool ${target}/var/lib/games \ + ${target}/var/cache/man ${target}/var/lib/nfs \ + ${target}/var/lib/xkb ${target}/var/mail/grml \ + ${target}/var/account/pacct + +# 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 -# make sure to drop from grml-small what's unnecessary: -if ifclass GRML_SMALL ; then - $ROOTCMD apt-get -y --purge remove aptitude - for pkg in groff-base info locales man-db manpages nano; do - $ROOTCMD apt-get --purge remove --yes $pkg || true - done +if [ -x $target/usr/bin/update-menus ] ; then + echo "Warning: update-menus not installed" +else + echo "Updating windowmanager menus" + $ROOTCMD update-menus -v fi -# drop unnecessary software: -if ifclass GRML_SMALL || ifclass DEBORPHAN ; then - if [ -f /etc/grml/fai/grml/grml_cleanup_chroot.deborphan ] ; then - cp /etc/grml/fai/grml/grml_cleanup_chroot.deborphan $target/root/ - $ROOTCMD /root/grml_cleanup_chroot.deborphan - rm $target/root/grml_cleanup_chroot.deborphan - 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 -# remove /usr/share/doc, /usr/share/info,... only in class REMOVE_DOCS: -# (important: remove them *after* deinstalling packages, otherwise -# removing packages might fail due to lack of /usr/share/man/...) -if ifclass REMOVE_DOCS ; then - cp /etc/grml/fai/grml/grml_cleanup_chroot.remove_docs $target/root/ - $ROOTCMD /root/grml_cleanup_chroot.remove_docs - rm $target/root/grml_cleanup_chroot.remove_docs +if ! [ -d $target/var/lib/clamav/ ] ; then + echo "Warning: clamav[-freshclam] not installed" +else + echo "Cleaning /var/lib/clamav/" + rm -f $target/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 -# misc cleanup: -if [ -f /etc/grml/fai/grml/grml_cleanup_chroot ] ; then - cp /etc/grml/fai/grml/grml_cleanup_chroot $target/root/ - $ROOTCMD /root/grml_cleanup_chroot - rm $target/root/grml_cleanup_chroot + +if ! [ -r $target/etc/ld.so.nohwcap ] ; then + echo "Creating /etc/ld.so.nohwcap" + touch $target/etc/ld.so.nohwcap fi -# make sure GRML_SMALL uses the appropriate configuration: -if ifclass GRML_SMALL ; then - cp $target/etc/inittab.small $target/etc/inittab +# installation of resolvconf in chroot *with* /proc +# is different from an installation without /proc, +# so make sure it is OK in any case +if ! [ -d $target/etc/resolvconf ] ; then + echo "Warning: resolvconf not installed" +else + echo "Setting up resolvconf" + if [ -L $target/etc/resolvconf/run ] ; then # resolvconf with /run + # /etc/resolvconf/run symlinks to /run/resolvconf + RESOLV_CONF=/run/resolvconf/ + else # no /run present + RESOLV_CONF=/etc/resolvconf/run/ + fi + + rm -rf ${target}/${RESOLV_CONF} + mkdir -p ${target}/${RESOLV_CONF} + + touch ${target}/${RESOLV_CONF}/enable-updates + mkdir ${target}/${RESOLV_CONF}/interface + + cat > ${target}/${RESOLV_CONF}/resolv.conf << EOF +# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) +# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN +EOF fi -if ifclass RELEASE ; then - # Remove all FAI logs from chroot via grml-live later then: - touch $target/etc/grml_fai_release - # Remove all files inside /root/ of chroot: - rm -rf $target/root && mkdir -m 0755 $target/root +if ! [ -x $target/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 ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# 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/etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build index da74934..0f1b9d6 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build +++ b/etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build @@ -1,5 +1,5 @@ #!/bin/bash -# Filename: /etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build +# Filename: ${GRML_FAI_CONFIG}/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,11 +9,6 @@ set -u set -e -# Restore usual Debian behaviour -#if [ -r "$target"/etc/apt/apt.conf.d/15grml-live ] ; then -# rm -f "$target"/etc/apt/apt.conf.d/15grml-live -#fi - # 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 @@ -28,4 +23,4 @@ fi touch $target/etc/grml_cd ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# 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/etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives new file mode 100755 index 0000000..afd440d --- /dev/null +++ b/etc/grml/fai/config/scripts/GRML_SMALL/90-update-alternatives @@ -0,0 +1,32 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/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/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +set -u +set -e + +## 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 + # 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 + # $ROOTCMD update-alternatives --set vi /usr/bin/vim.tiny + $ROOTCMD ln -sf /etc/alternatives/editor /usr/bin/editor + $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/editor + $ROOTCMD ln -sf /etc/alternatives/vi /usr/bin/vi + $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/vi + $ROOTCMD ln -sf /etc/alternatives/vim /usr/bin/vim + $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/vim + $ROOTCMD ln -sf /etc/alternatives/view /usr/bin/view + $ROOTCMD ln -sf /usr/bin/vim.tiny /etc/alternatives/view + fi +fi diff --git a/etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot b/etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot new file mode 100755 index 0000000..bfa9db9 --- /dev/null +++ b/etc/grml/fai/config/scripts/GRML_SMALL/98-clean-chroot @@ -0,0 +1,60 @@ +#!/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 /var/cache/debconf/templates.dat" +rm -f $target/var/cache/debconf/templates.dat + +echo "Removing /usr/share/ssh/blacklist.*" +rm -f $target/usr/share/ssh/blacklist.DSA-1024 $target/usr/share/ssh/blacklist.RSA-2048 + +# get rid of large kernel modules: +echo "Removing some very large kernel drivers:" +for kernel in $(find $target/lib/modules/ -maxdepth 1 -type d -name [0-9]*) ; do + kernelversion=$(basename $kernel) + if [ -r "${target}/lib/modules/${kernelversion}/kernel/fs/ocfs2/ocfs2.ko" ] ; then + echo "Removing /lib/modules/${kernelversion}/kernel/fs/ocfs2/ocfs2.ko" + rm -f "${target}/lib/modules/${kernelversion}/kernel/fs/ocfs2/ocfs2.ko" + fi + if [ -d "${target}/lib/modules/${kernelversion}/kernel/drivers/isdn/hisax/" ] ; then + echo "Removing /lib/modules/${kernelversion}/kernel/drivers/isdn/hisax" + rm -rf "${target}/lib/modules/${kernelversion}/kernel/drivers/isdn/hisax" + fi +done + +# make sure to drop from grml-small what's unnecessary: +$ROOTCMD apt-get -y --purge remove aptitude +for pkg in groff-base info locales man-db manpages nano; do + $ROOTCMD apt-get --purge remove --yes $pkg || true +done + +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/config/scripts/LATEX/98-clean-chroot b/etc/grml/fai/config/scripts/LATEX/98-clean-chroot new file mode 100755 index 0000000..d407c92 --- /dev/null +++ b/etc/grml/fai/config/scripts/LATEX/98-clean-chroot @@ -0,0 +1,22 @@ +#!/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 new file mode 100755 index 0000000..d89f5de --- /dev/null +++ b/etc/grml/fai/config/scripts/RELEASE/98-clean-chroot @@ -0,0 +1,25 @@ +#!/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 + +# 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/grml" +rm -rf $target/home/grml +mkdir -m 0755 $target/home/grml + +## 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 new file mode 100755 index 0000000..289bb13 --- /dev/null +++ b/etc/grml/fai/config/scripts/REMOVE_DOCS/98-clean-chroot @@ -0,0 +1,33 @@ +#!/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 index c6ede7d..b5f47cf 100644 --- a/etc/grml/fai/fai.conf +++ b/etc/grml/fai/fai.conf @@ -1,6 +1,4 @@ -# $Id: fai.conf 4294 2007-06-10 11:06:11Z lange $ - -# /etc/fai/fai.conf -- configuration for FAI (Fully Automatic Installation) +# 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 @@ -20,11 +18,12 @@ LOGUSER= FAI_LOGPROTO=ssh # how to access the fai config space -# default if undefined here: nfs://`hostname`/$FAI_CONFIGDIR # 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/config +#FAI_CONFIG_SRC=file:///etc/grml/fai/config +#FAI_CONFIGDIR=/etc/grml/fai # the following variables are read only for most users diff --git a/etc/grml/fai/grml/grml_cleanup_chroot b/etc/grml/fai/grml/grml_cleanup_chroot deleted file mode 100755 index 5c591ef..0000000 --- a/etc/grml/fai/grml/grml_cleanup_chroot +++ /dev/null @@ -1,351 +0,0 @@ -#!/bin/bash -# Filename: /etc/grml/fai/grml/grml_cleanup_chroot -# Purpose: clean up grml chroot -# Authors: (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -# misc stuff - umask 022 - . /etc/grml/lsb-functions || exit 6 - [ -x /lib64 ] && GRML64=yes || GRML64='' - -# detect kernel version, assume newest kernel version - KERNEL=$(ls -1 /lib/modules/ | sort -r -u | head -1) - -if [ -f /usr/share/fonts/X11/misc/artwiz-cursor.pcf.gz ] ; then - if dpkg-divert --list artwiz-cursor | grep -q /usr/share/fonts/X11/misc/cursor.pcf.gz ; then - eerror "Broken diversion of artwiz-cursor, see #341397, trying to fix it" - ( cd /usr/share/fonts/X11/misc/ && - dpkg-divert --remove /usr/share/fonts/X11/misc/cursor.pcf.gz && mkfontdir ) - eend 0 - fi -fi - -# start of main cleanup process... -if ! [ -r /boot/config-"$KERNEL" ] ; then - eerror "/boot/config-$KERNEL not available. \$KERNEL not set to correct value?" - eend 1 - exit 9 -fi - -einfo "Preparing grml-system: $(cat /etc/grml_version)" ; eend 0 - -einfo "Setting up /etc/motd.tail" -echo "" > /etc/motd.tail ; eend 0 - -einfo "Setting up /etc/modules: " -cat>/etc/modules<> /etc/modules -grep '^[a-z]' /etc/grml/modules >> /etc/modules -eend 0 - -einfo "Setting up /etc/inittab" -cp /etc/inittab.grml /etc/inittab -eend $? - -if [ "$(dpkg --list | awk '/^rc/ { print $2}')" != '' ] ; then - einfo "Purging removed packages" - dpkg --purge $(dpkg --list | awk '/^rc/ { print $2}') - eend $? -fi - -if [ -x /usr/bin/make -a -r /usr/src/Makefile ] ; then - einfo "Cleaning up /usr/src/linux-headers-$KERNEL" - ( cd /usr/src - VER=$(/bin/ls -d /usr/src/linux-headers-* | head -1) - VER=${VER##/usr/src/linux-headers-} - if [ -n "$VER" ] ; then - VER=$VER make clean && \ - VER=$VER make symlinks - else - make clean && \ - make symlinks - fi - ) - eend $? -fi - -einfo "Creating ~/.zshrc" - touch ~/.zshrc -eend $? - -if [ -d /usr/lib/valgrind/x86-linux/ ] ; then - einfo "Stripping /usr/lib/valgrind/x86-linux/" - strip --strip-unneeded /usr/lib/valgrind/x86-linux/* - eend $? -else - ewarn "valgrind not installed" ; eend 0 -fi - -if [ -x /usr/sbin/localepurge ] ; then - einfo "Running localepurge" - localepurge ; eend $? -else - ewarn "localepurg not available" ; eend 0 -fi - -# find /var -name \*.pid -einfo "Removing pid-files" - find /var/run -name \*.pid -exec rm {} \; -eend $? - -einfo "Removing /var/lib/apt/lists/*-stuff, dpkg-status-old and pkgcache.bin" - rm -f /var/lib/apt/lists/*Packages - rm -f /var/lib/apt/lists/*Release - rm -f /var/lib/apt/lists/*Sources - rm -f /var/lib/apt/lists/*IndexDiff - rm -f /var/lib/apt/lists/*.gpg - rm -f /var/cache/apt-show-versions/* - rm -f /var/cache/debconf/templates.dat-old - rm -f /var/cache/apt/*.bin - apt-get check 2>/dev/null - dpkg --clear-avail - apt-cache gencaches 2>/dev/null - rm -f /var/lib/dpkg/status-old - rm -f /var/lib/dpkg/available-old -eend $? - -if ifclass GRML_SMALL ; then - einfo "Removing /var/cache/debconf/templates.dat" - rm -f /var/cache/debconf/templates.dat - eend $? - - einfo "Removing /usr/share/ssh/blacklist.*" - rm -f /usr/share/ssh/blacklist.DSA-1024 /usr/share/ssh/blacklist.RSA-2048 - eend $? -fi - -# get rid of large kernel modules: -if ifclass GRML_SMALL ; then - einfo "Identified grml-small, removing some very large kernel drivers:" - if [ -r "/lib/modules/${KERNEL}/kernel/fs/ocfs2/ocfs2.ko" ] ; then - einfo "Removing /lib/modules/${KERNEL}/kernel/fs/ocfs2/ocfs2.ko" - rm -f "/lib/modules/${KERNEL}/kernel/fs/ocfs2/ocfs2.ko" - eend $? - fi - if [ -d "/lib/modules/${KERNEL}/kernel/drivers/isdn/hisax/" ] ; then - einfo "Removing /lib/modules/${KERNEL}/kernel/drivers/isdn/hisax" - rm -rf "/lib/modules/${KERNEL}/kernel/drivers/isdn/hisax" - eend $? - fi -fi - -if [ -x /usr/bin/grep-dctrl ] ; then - einfo "Cleaning up /var/lib/dpkg/status" - grep-dctrl -v -F Status "purge ok not-installed" /var/lib/dpkg/status > status.new && \ - cp status.new /var/lib/dpkg/status && chmod 644 /var/lib/dpkg/status && \ - chown root:root /var/lib/dpkg/status && rm status.new && eend 0 || eend 1 -else - ewarn "Warning: /usr/bin/grep-dctrl not available." -fi - -einfo "Removing x-server-conffiles" - rm -f /etc/X11/xorg.conf /etc/X11/XF86Config-4 \ - /etc/X11/XF86Config /etc/XF86Config /etc/XF86Config-4 -eend $? - -einfo "Removing ssh-keys" - rm -f /etc/ssh/*key* -eend $? - -einfo "Removing unused/backup files" - find / -name *~ -print0 | xargs -0 rm -f -eend $? - -# remove only "temporary" or saved files in the given directories -nuke(){ - for i in `find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.0 2>/dev/null`; do - rm -f "$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 2>/dev/null`; do - :> "$i" - done -} - -#for i in `find /usr/*/man -name \*.\[0-9ln\]` ; do -# [ -f "$i".gz -o -f "$i".bz2 ] && rm -f "$i" -#done - -if [ -d /var/spool/squid/ ] ; then - einfo "Cleaning /var/spool/squid/0*" - rm -rf /var/spool/squid/0* - eend $? -else - ewarn "update-ca-certificates not installed" ; eend 0 -fi - -# delete old dowloaded packages -einfo "Running apt-get clean" - apt-get clean -eend $? - -if [ -x /usr/bin/nvi ] ; then - if ! [ -d /var/tmp/vi.recover ] ; then - einfo "Creating nvi /var/tmp directory" - mkdir -p /var/tmp/vi.recover - chown root:root /var/tmp/vi.recover - chmod 1777 /var/tmp/vi.recover - eend $? - fi -else - ewarn "nvi not installed" ; eend 0 -fi - -if [ -x /sbin/depmod ] ; then - if [ -r /lib/modules/$KERNEL ] ; then - einfo "Updating modules.dep for kernel $KERNEL" - depmod -ae -F /boot/System.map-"$KERNEL" "$KERNEL" - eend $? - fi -else - ewarn "depmod not installed" ; eend 0 -fi - -einfo "Cleaning and removing some misc files and directories" - find /etc -type f -name *.pre_fcopy -delete - rm -f /etc/sysconfig/* /etc/motd.dpkg-new /etc/auto.master.distrib.dpkg-new \ - /etc/samba/*.SID /etc/samba/*.tdb /dev/mouse* /dev/cdrom* /dev/cdwriter* \ - /var/run/*/* /var/run/* /var/log/ksymoops/* /var/lock/*/* /var/lock/* \ - /var/state/*/* /var/state/* /var/log/nessus/* \ - /halt /reboot /ash.static /etc/dhcpc/*.info /etc/dhcpc/resolv* \ - /etc/*passwd- /etc/*shadow- /etc/*group- /var/spool/postfix/maildrop/* \ - /etc/*.old /etc/*.original \ - /etc/lvm/.cache /etc/lvm/cache/.cache /etc/lvm/backup/main 2>/dev/null - rm -rf /tmp/* /var/tmp/* /var/tmp/.* /var/backups/* /.ssh /root/.ssh /home/*/.ssh \ - /home/grml/* /home/grml/.??* /var/lib/texmf/ls-R /var/spool/texmf/ls-R \ - /var/lib/mysql /var/log/lilo_log.* /core* 2>/dev/null - nuke /var/log /var/cache - zero /var/local /var/log /var/spool \ - /var/lib/games /var/cache/man \ - /var/lib/nfs /var/lib/xkb \ - /var/mail/grml /var/account/pacct - # Recreate empty utmp and wtmp - :>/var/run/utmp - :>/var/run/wtmp -eend $? - -if [ -x /usr/sbin/update-ca-certificates ] ; then - einfo "Updating ca-certificates" - update-ca-certificates 1>/dev/null - eend $? -else - ewarn "update-ca-certificates not installed" ; eend 0 -fi - -# regenerate module dependencies and ls.so.cache -if [ -x /sbin/ldconfig ] ; then - einfo "Updating ld.so.cache" - ldconfig - eend $? -else - ewarn "ldconfig not installed" ; eend 0 -fi - -if [ -x /usr/bin/update-menus ] ; then - einfo "Updating windowmanager menus" - update-menus -v - eend $? -else - ewarn "update-menus not installed" ; eend 0 -fi - -if [ -x /usr/bin/mktexlsr ] ; then - einfo "Updating texhash" - mktexlsr - eend $? -else - ewarn "mktexlsr not installed" ; eend 0 -fi - -if [ -x /usr/bin/mandb ] ; then - einfo "Updating mandb" - mandb -c - man doesnotexist >/dev/null 2>&1 - eend $? -else - ewarn "mandb not installed" ; eend 0 -fi - -if [ -d /var/lib/clamav/ ] ; then - einfo "Cleaning /var/lib/clamav/" - rm -f /var/lib/clamav/clamav-* ; eend $? - if [ -f /var/lib/clamav/daily.cvd ] ; then - ( mkdir -p /usr/share/doc/clamav-freshclam/examples/ && \ - cd /usr/share/doc/clamav-freshclam/examples/ && \ - ln -sf /var/lib/clamav/daily.cvd . && \ - ln -sf /var/lib/clamav/main.cvd . ) - fi -else - ewarn "clamav[-freshclam] not installed" ; eend 0 -fi - -if ! [ -r /etc/ld.so.nohwcap ] ; then - einfo "Creating /etc/ld.so.nohwcap" - touch /etc/ld.so.nohwcap -fi - -# installation of resolvconf in chroot *with* /proc -# is different from an installation without /proc, -# so make sure it is OK in any case -if [ -d /etc/resolvconf ] ; then - if [ -L /etc/resolvconf/run ] ; then # resolvconf with /run - # /etc/resolvconf/run symlinks to /run/resolvconf - rm -rf /run/resolvconf - mkdir -p /run/resolvconf - else # no /run present - rm -rf /etc/resolvconf/run - mkdir /etc/resolvconf/run - fi - - touch /etc/resolvconf/run/enable-updates - mkdir /etc/resolvconf/run/interface - cat > /etc/resolvconf/run/resolv.conf << EOF -# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) -# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN -EOF -fi - -if [ -x /usr/bin/updatedb ] ; then - einfo "Updating locate-database" - updatedb --prunepaths='/tmp /usr/tmp /var/tmp /grml /root /proc /sys' - eend $? -else - ewarn "updatedb not installed" ; eend 0 -fi - -################################################################################ -# MISC STUFF -# ~~~~~~~~~~ -# list dangling symlinks: ls **/*(-@) -# -# Security-audit: -# find / \! -type l -perm -2000 -ls > audit/sgid-files -# find / \! -type l -perm -0002 -ls > audit/world-writeable-files -# find / \! -type l -perm -4000 -ls > audit/suid-files -# find / ( -perm 4000 -o -perm -2000 \) -exec ls -ld {} \; -# find / -perm -0777 -type d -ls > audit/writeable-dirs -# find / -size +3000k > audit/big_files.new -# find /all_filesystems -name ".. " -print -xdev | cat -vet -# find / -name ".*" -print -xdev | cat -v > audit/hidden-files -# find / -name ".. " -print -xdev | cat -vet > audit/unusal-file-names -# -# list non-stripped files: -# file /usr/sbin/* | grep -v ', stripped' | grep -v 'perl' | grep -v 'Bourne' | grep -v 'python' | grep -v 'symbolic link' -# -# Is software by grml-repos up2date? -# grep-dctrl --field Maintainer 'Michael Prokop' /var/lib/apt/lists/* | grep Package | awk '{print $2}' | xargs echo -################################################################################ - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup b/etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup deleted file mode 100755 index 2a46dd5..0000000 --- a/etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Filename: /etc/grml/fai/grml/grml_cleanup_chroot_latex_cleanup -# Purpose: remove some large LaTeX directories -# Authors: (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -# misc stuff - . /etc/grml/lsb-functions || exit 6 - -rm -rf /usr/share/doc/texlive-latex-recommended/latex/ \ - /usr/share/doc/texlive-latex-base/latex/ \ - /usr/share/doc/texlive-base-bin/pdftex/thanh/ \ - /usr/share/doc/texlive-latex-base/latex/base/ \ - /usr/share/doc/texlive-latex-base/latex/hyperref/ \ - /usr/share/doc/texlive-latex-base/generic/babel/ \ - /usr/share/doc/texlive-latex-recommended/latex/koma-script/ \ - /usr/share/doc/texmf/pgf/pgfmanual.pdf.gz - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/grml/grml_cleanup_chroot.online b/etc/grml/fai/grml/grml_cleanup_chroot.online deleted file mode 100755 index 25f67f6..0000000 --- a/etc/grml/fai/grml/grml_cleanup_chroot.online +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Filename: /etc/grml/fai/grml/grml_cleanup_chroot_no_online -# Purpose: execute tasks that require network access -# Authors: (c) Michael Prokop -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -# misc stuff - umask 022 - . /etc/grml/lsb-functions || exit 6 - [ -x /usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT="" - -if [ -x /usr/bin/freshclam ] ; then - einfo "Updating clamav database via running freshclam" - if [ -n "$TIMEOUT" ] ; then - timeout $TIMEOUT /usr/bin/freshclam ; eend $? - else - /usr/bin/freshclam ; eend $? - fi -else - ewarn "freshclam not installed" ; eend 0 -fi - -if [ -x /usr/bin/update-pciids ] ; then - einfo "Updating PCI- and USB-ids" - if [ -n "$TIMEOUT" ] ; then - timeout $TIMEOUT update-pciids || echo "Warning: update-pciids was not successfull">&2 - timeout $TIMEOUT update-usbids || echo "Warning: update-usbids was not successfull">&2 - else - update-pciids || echo "Warning: update-pciids was not successfull">&2 - update-usbids || echo "Warning: update-usbids was not successfull">&2 - fi - eend $? -else - ewarn "update-pciids/update-usbids not installed" ; eend 0 -fi - -if [ -x /usr/sbin/nessus-update-plugins ] ; then - einfo "Updating nessus-plugins" - if [ -n "$TIMEOUT" ] ; then - timeout $TIMEOUT nessus-update-plugins || echo "Warning: nessus-update-plugins was not successfull">&2 - else - nessus-update-plugins || echo "Warning: nessus-update-plugins was not successfull">&2 - fi - eend $? -else - ewarn "nessus-update-plugins not installed" ; eend 0 -fi - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/grml/grml_cleanup_chroot.remove_docs b/etc/grml/fai/grml/grml_cleanup_chroot.remove_docs deleted file mode 100755 index a68b1b4..0000000 --- a/etc/grml/fai/grml/grml_cleanup_chroot.remove_docs +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Filename: /etc/grml/fai/grml/grml_cleanup_chroot_remove_docs -# Purpose: remove docs in grml chroot -# Authors: (c) Michael Prokop -# License: This file is licensed under the GPL v2. -################################################################################ - -. /etc/grml/lsb-functions || exit 6 - -einfo "Cleaning documentation directories..." -if [ -d /usr/share/doc/grml-docs ] ; then - mv /usr/share/doc/grml-docs /tmp/ -fi - -rm -rf /usr/share/doc -mkdir /usr/share/doc - -if [ -d /tmp/grml-docs ] ; then - mv /tmp/grml-docs /usr/share/doc/grml-docs -fi - -rm -rf /usr/share/gtk-doc/ -rm -rf /usr/share/man/ -rm -rf /usr/man -rm -rf /usr/share/info -rm -rf /var/cache/man/* -eend $? - -einfo "Creating /usr/share/info/..." -mkdir -p /usr/share/info/ -eend $? - -## END OF FILE ################################################################# diff --git a/etc/grml/fai/make-fai-nfsroot.conf b/etc/grml/fai/make-fai-nfsroot.conf index ace53d9..e6bcb6b 100644 --- a/etc/grml/fai/make-fai-nfsroot.conf +++ b/etc/grml/fai/make-fai-nfsroot.conf @@ -9,7 +9,7 @@ NFSROOT=/srv/fai/nfsroot TFTPROOT=/srv/tftp/fai # location of the configuration space -# FAI_CONFIGDIR=/etc/grml/fai/config +# GRML_FAI_CONFIG=/etc/grml/fai/config # Add a line for mirrorhost and installserver when DNS is not available # on the clients. This line(s) will be added to $nfsroot/etc/hosts. diff --git a/etc/grml/grml-live.conf b/etc/grml/grml-live.conf index d5b1fb0..7f2ff72 100644 --- a/etc/grml/grml-live.conf +++ b/etc/grml/grml-live.conf @@ -66,8 +66,8 @@ # Which Debian mirror do you want to use for main packages (after debootstrapping # has been finished)? # If you do *not* set GRML_LIVE_SOURCES here then grml-live will just take what -# /etc/grml/fai/apt/sources.list provides by default. But please do *not* -# manually edit /etc/grml/fai/apt/sources.list but instead use $GRML_LIVE_SOURCES. +# ${GRML_FAI_CONFIG}/apt/sources.list provides by default. But please do *not* +# manually edit ${GRML_FAI_CONFIG}/apt/sources.list but instead use $GRML_LIVE_SOURCES. # Use the variable as your /etc/apt/sources.list looks like. # GRML_LIVE_SOURCES=" #deb http://deb.grml.org/ grml-stable main diff --git a/grml-live b/grml-live index 5001091..879565b 100755 --- a/grml-live +++ b/grml-live @@ -27,7 +27,6 @@ fi GRML_LIVE_VERSION='0.14.1' PN="$(basename $0)" CMDLINE="$0 $@" -SOURCES_LIST_FILE='/etc/grml/fai/apt/sources.list' ADDONS_LIST_FILE='/boot/isolinux/addons_list.cfg' # }}} @@ -45,6 +44,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 -F force execution without prompting -g set the grml flavour name -h display short usage information and exit @@ -228,7 +228,7 @@ fi # }}} # command line parsing {{{ -while getopts "a:C:c:d:g:i:I:o:r:s:t:v:bBFnNquVz" opt; do +while getopts "a:C:c:d:D:g:i:I:o:r:s:t:v:bBFnNquVz" opt; do case "$opt" in a) ARCH="$OPTARG" ;; b) BUILD_ONLY=1 ;; @@ -236,6 +236,7 @@ while getopts "a:C:c:d:g:i:I:o:r:s:t:v:bBFnNquVz" opt; do c) CLASSES="$OPTARG" ;; C) CONFIG="$OPTARG" ;; d) DATE="$OPTARG" ;; + D) GRML_FAI_CONFIG="$OPTARG" ;; g) GRML_NAME="$OPTARG" ;; i) ISO_NAME="$OPTARG" ;; I) CHROOT_INSTALL="$OPTARG" ;; @@ -258,25 +259,27 @@ shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter # }}} # assume sane defaults (if not set already) {{{ -[ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)" -[ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux' -[ -n "$CLASSES" ] || CLASSES="GRMLBASE,GRML_MEDIUM,I386" -[ -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_NAME" ] || GRML_NAME='grml' -[ -n "$HOSTNAME" ] || HOSTNAME='grml' -[ -n "$HYBRID_METHOD" ] || HYBRID_METHOD='manifold' -[ -n "$NFSROOT_CONF" ] || NFSROOT_CONF='/etc/grml/fai/make-fai-nfsroot.conf' -[ -n "$RELEASENAME" ] || RELEASENAME='grml-live rocks' -[ -n "$SQUASHFS_EXCLUDES_FILE " ] || SQUASHFS_EXCLUDES_FILE='/etc/grml/fai/squashfs-excludes' -[ -n "$SUITE" ] || SUITE='squeeze' -[ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates' -[ -n "$USERNAME" ] || USERNAME='grml' -[ -n "$VERSION" ] || VERSION='0.0.1' +[ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)" +[ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux' +[ -n "$CLASSES" ] || CLASSES="GRMLBASE,GRML_MEDIUM,I386" +[ -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_NAME" ] || GRML_NAME='grml' +[ -n "$HOSTNAME" ] || HOSTNAME='grml' +[ -n "$HYBRID_METHOD" ] || HYBRID_METHOD='manifold' +[ -n "$NFSROOT_CONF" ] || NFSROOT_CONF="${GRML_FAI_CONFIG}/make-fai-nfsroot.conf" +[ -n "$RELEASENAME" ] || RELEASENAME='grml-live rocks' +[ -n "$SOURCES_LIST_INPUT" ] || SOURCES_LIST_INPUT="${GRML_FAI_CONFIG}/apt/sources.list" +[ -n "$SOURCES_LIST_OUTPUT" ] || SOURCES_LIST_OUTPUT="${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRMLBASE" +[ -n "$SQUASHFS_EXCLUDES_FILE " ] || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes" +[ -n "$SUITE" ] || SUITE='squeeze' +[ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates' +[ -n "$USERNAME" ] || USERNAME='grml' +[ -n "$VERSION" ] || VERSION='0.0.1' # output specific stuff, depends on $OUTPUT (iff not set): [ -n "$OUTPUT" ] || OUTPUT='/grml/grml-live' @@ -318,6 +321,7 @@ if [ -z "$FORCE" ] ; then echo " FAI classes: $CLASSES" [ -r "$LOCAL_CONFIG" ] && echo " Local config: /etc/grml/grml-live.local" [ -n "$CONFIG" ] && echo " Configuration: $CONFIG" + [ -n "$GRML_FAI_CONFIG" ] && echo " Config directory: $GRML_FAI_CONFIG" echo " main directory: $OUTPUT" [ -n "$CHROOT_OUTPUT" ] && echo " Chroot target: $CHROOT_OUTPUT" [ -n "$BUILD_OUTPUT" ] && echo " Build target: $BUILD_OUTPUT" @@ -402,34 +406,30 @@ einfo "Logging actions to logfile $LOGFILE" # }}} # on-the-fly configuration {{{ -if [ -n "$MIRROR_DIRECTORY" ] ; then - if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then - log "Error: $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]" - eerror "Error: $MIRROR_DIRECTORY/debian does not seem to exist. Exiting." ; eend 1 - bailout 1 - fi - cat > "$SOURCES_LIST_FILE" << EOF -# NOTE: This file is *NOT* meant for manual customisation! This file is -# modified by grml-live and any changes might be overridden. -# You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* -# or FAI's fcopy command with /etc/grml/fai/config/files instead! -EOF - echo "$MIRROR_SOURCES" >> "$SOURCES_LIST_FILE" - if [ -n "$GRML_LIVE_SOURCES" ] ; then - echo "$GRML_LIVE_SOURCES" >> "$SOURCES_LIST_FILE" - fi -elif [ -n "$GRML_LIVE_SOURCES" ] ; then - cat > "$SOURCES_LIST_FILE" << EOF +mkdir -p "$(dirname $SOURCES_LIST_OUTPUT)" # might not be present in -D config space + +cat > "$SOURCES_LIST_OUTPUT" << EOF # NOTE: This file is *NOT* meant for manual customisation! This file is -# modified by grml-live and any changes might be overridden. +# modified by grml-live and any changes will be overridden. # You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* -# or FAI's fcopy command with /etc/grml/fai/config/files instead! +# or FAI's fcopy command with ${GRML_FAI_CONFIG}/config/files instead! EOF - echo "$GRML_LIVE_SOURCES" >> "$SOURCES_LIST_FILE" + +if [ -n "$MIRROR_DIRECTORY" ] ; then + if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then + log "Error: $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]" + eerror "Error: $MIRROR_DIRECTORY/debian does not seem to exist. Exiting." ; eend 1 + bailout 1 + fi + echo "$MIRROR_SOURCES" >> "$SOURCES_LIST_OUTPUT" +fi + +if [ -n "$GRML_LIVE_SOURCES" ] ; then + echo "$GRML_LIVE_SOURCES" >> "$SOURCES_LIST_OUTPUT" fi if [ -n "$FAI_DEBOOTSTRAP" ] ; then - sed "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF" + sed "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF" fi # does this suck? YES! @@ -449,7 +449,7 @@ case $SUITE in esac DIST=" etch\| stable\| lenny\| squeeze\| wheezy\| testing\| sid\| unstable" -sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" "$SOURCES_LIST_FILE" | sponge "$SOURCES_LIST_FILE" +sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" "$SOURCES_LIST_INPUT" | sponge "$SOURCES_LIST_OUTPUT" for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do if [ -n "$file" ] ; then sed "s/^SUITE=.*/SUITE=\"$SUITE\"/" $file | sponge $file @@ -458,13 +458,13 @@ for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do done # notice: activate grml-live pool only if we are building against unstable: -if grep -qwe unstable -qwe sid "$SOURCES_LIST_FILE" ; then - grep -q 'grml-live.*main' "$SOURCES_LIST_FILE" || \ - grep grml-stable "$SOURCES_LIST_FILE" | \ - sed 's/grml-stable/grml-live/' >> "$SOURCES_LIST_FILE" +if grep -qwe unstable -qwe sid "$SOURCES_LIST_INPUT" ; then + grep -q 'grml-live.*main' "$SOURCES_LIST_OUTPUT" || \ + grep grml-stable "$SOURCES_LIST_OUTPUT" | \ + sed 's/grml-stable/grml-live/' >> "$SOURCES_LIST_OUTPUT" else - grep -q 'grml-live.*main' "$SOURCES_LIST_FILE" && \ - sed 's/.*grml-live.*/# removed grml-live repository/' "$SOURCES_LIST_FILE" | sponge "$SOURCES_LIST_FILE" + grep -q 'grml-live.*main' "$SOURCES_LIST_INPUT" && \ + sed 's/.*grml-live.*/# removed grml-live repository/' "$SOURCES_LIST_INPUT" | sponge "$SOURCES_LIST_OUTPUT" fi for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" "$NFSROOT_CONF" ; do @@ -544,9 +544,10 @@ else echo force-unsafe-io > "$CHROOT_OUTPUT/etc/dpkg/dpkg.cfg.d/unsafe-io" log "Executed FAI command line:" - log "BUILD_ONLY=$BUILD_ONLY BOOTSTRAP_ONLY=$BOOTSTRAP_ONLY fai $VERBOSE -C $GRML_FAI_CONFIG -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS" - BUILD_ONLY="$BUILD_ONLY" BOOTSTRAP_ONLY="$BOOTSTRAP_ONLY" fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u \ - "$HOSTNAME" $FAI_ACTION "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE + log "BUILD_ONLY=$BUILD_ONLY BOOTSTRAP_ONLY=$BOOTSTRAP_ONLY 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" 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 rm -f "$CHROOT_OUTPUT/etc/dpkg/dpkg.cfg.d/unsafe-io" @@ -1229,4 +1230,4 @@ bailout 0 # }}} ## END OF FILE ################################################################# -# vim:foldmethod=marker ts=2 ft=sh ai expandtab tw=80 sw=3 +# vim:foldmethod=marker ts=2 ft=sh ai expandtab tw=80 sw=2 -- 2.1.4