Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

initial checkin
authorMichael Prokop <mika@grml.org>
Wed Feb 21 12:26:44 2007 +0100 (21 months ago)
changeset 0ff71f7d7ce07
manifestff71f7d7ce07
child 1de055272e540
initial checkin
Makefile
debian/changelog
debian/compat
debian/control
debian/copyright
debian/dirs
debian/docs
debian/rules
grml-config.txt
mkpersistenthome
restore-config
save-config
save-config.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,20 @@
+all: doc
+
+doc: doc_man doc_html
+
+doc_html: html-stamp
+
+html-stamp:
+ asciidoc -b xhtml11 grml-config.txt
+ touch html-stamp
+
+doc_man: man-stamp
+
+man-stamp:
+ asciidoc -d manpage -b docbook grml-config.txt
+ sed -i 's/<emphasis role="strong">/<emphasis role="bold">/' grml-config.xml
+ xsltproc /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-config.xml
+ touch man-stamp
+
+clean:
+ rm -rf grml-config.html grml-config.xml grml-config html-stamp man-stamp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/changelog Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,20 @@
+grml-saveconfig (0.1-3) unstable; urgency=low
+
+ * Use $runas in create_config(). Thanks to Robert Giebel.
+ [Closes: issue130]
+
+ -- Michael Prokop <mika@grml.org> Wed, 21 Feb 2007 12:25:49 +0100
+
+grml-saveconfig (0.1-2) unstable; urgency=low
+
+ * Updated mkpersistenthome (detect usb devices as well, thanks tklauser!).
+ * Updated documentation (thanks for help, tklauser and Karl Voit!).
+
+ -- Michael Prokop <mika@grml.org> Sun, 23 Oct 2005 13:54:48 +0200
+
+grml-saveconfig (0.1-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- Michael Prokop <mika@grml.org> Sun, 23 Oct 2005 00:55:11 +0200
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/compat Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,1 @@
+4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/control Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,28 @@
+Source: grml-saveconfig
+Section: grml
+Priority: optional
+Maintainer: Michael Prokop <mika@grml.org>
+Build-Depends: debhelper (>= 4.0.0), asciidoc, xsltproc, docbook-xsl
+Standards-Version: 3.6.2
+
+Package: grml-saveconfig
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, zsh
+Conflicts: grml-scripts (<= 0.4-36)
+Description: utilities and documentation for saving and restoring configuration
+ This package provides the utilities and documentation for saving
+ and restoring configuration on grml system.
+ .
+ The following scripts are available:
+ .
+ * save-config: save specific parts of running system into
+ a bzip2 compressed tar archive
+ * restore-config: restore configuration via provided configuration
+ archive
+ * mkpersistenthome: create a persistent home directory on a specific
+ partition either using a loopback file or the whole
+ partition
+ .
+ For more details (especially boot parameters and usage scenarios)
+ take a look at the provided documentation available under
+ /usr/share/doc/grml-saveconfig/grml-config.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/copyright Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,26 @@
+This package was debianized by Michael Prokop <mika@grml.org> on
+Sun, 23 Oct 2005 00:55:11 +0200.
+
+It was downloaded from http://grml.org/
+
+Copyright Holder: Michael Prokop <mika@grml.org>
+
+License:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/dirs Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/docs Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,1 @@
+grml-config.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/rules Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,74 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/grml-saveconfig.sgml > grml-saveconfig.1
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/grml-saveconfig.
+ install -m 755 mkpersistenthome debian/grml-saveconfig/usr/bin/
+ install -m 755 restore-config debian/grml-saveconfig/usr/bin/
+ install -m 755 save-config debian/grml-saveconfig/usr/bin/
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs grml-config.html
+ dh_installman save-config.1
+ dh_link /usr/share/man/man1/save-config.1.gz /usr/share/man/man1/restore-config.1.gz
+ dh_link /usr/share/man/man1/save-config.1.gz /usr/share/man/man1/mkpersistenthome.1.gz
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/grml-config.txt Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,423 @@
+grml-config(1)
+==============
+
+NAME
+----
+save-config - save configuration ; restore-config - restore
+configuration; mkpersistenthome - create persistent home directory;
+more options available via bootoptions (see following documentation)
+
+SYNOPSIS
+--------
+save-config - please take a look at 'save-config -h' ; restore-config
+- please take a look at 'restore-config -h', mkpersistenthome (no
+options available)
+
+*******************************************************************************
+Documentation written by mailto:mika@grml.org['Michael Prokop'] using AsciiDoc.
+
+Please notice that the config framework is at an early stage of
+development. Please report bugs, wishes and feedback
+link:http://grml.org/contact/[to the grml-team]!
+*******************************************************************************
+
+Introduction
+------------
+
+By using the config-framework it is possible to save the configuration
+of a running grml system and restore it later. save-config is a script
+to store your running configuration inside a bzip2 compressed tar
+archive (from now on known as the 'configuration file').
+restore-config is a script to restore a configuration using the stored
+configuration file. Several bootoptions provide additional features.
+If you do not know where to start just take a look at the available
+options and read the section <<X7,usage scenarios>>.
+
+TIP: The generated configuration archives are plain bzip2 compressed tar
+archives. All the files are generated starting from the root-directory
+'/' so it is easy to handle. You can generate configuration archives
+manually as well, save-config is just a frontend which should make it
+easier to use.
+
+Autoconfiguration
+-----------------
+
+By default the booting process tries to mount a device labeled
+'GRMLCFG'. This provides the possibility to restore a configuration
+(named config.tbz) and execute a script (named grml.sh) without the
+need to specify any bootparams. If you want to disable this feature
+please take a look at the 'noautoconfig' bootparam.
+
+Boot options
+------------
+
+As you probably know you can adjust boot parameters on the bootprompt.
+You want to set some boot options permanently? That's possible via
+adding a directory named 'bootparams' to the grml-ISO which has to be
+located at /cdrom/bootparams/ afterwards. Place a textfile inside the
+directory containing the bootoptions which should be appended to
+default ones (this corresponds to booting without any special
+options). If you want to be able to boot from your grml-CD you have to
+create a multisession CD. See the <<X7,usage scenarios>> for more
+details how to use it.
+
+Scripts
+-------
+
+save-config - save configuration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This script generates a plain bzip2 compressed tar archive containing
+the specified files. The following options are supported for
+specifying which parts should be saved in the configuration file:
+
+ -home store hidden files from $HOME ($HOME/.*)
+ -etc store modified files from /etc
+ -configdir store $HOME/config
+ -all store all configuration files (:= -home, -configdir and -etc)
+
+TIP: It is also possible to use environment variables for specifying which parts
+should be saved. Just set the corresponding variable: $SAVE_HOME, $SAVE_ETC,
+$SAVE_CONFIGDIR and $SAVE_ALL
+
+The default filename of the generated configuration file is
+config.tbz. The following options are supported for specifying
+another destination of the configuration file:
+
+ -ssh user@host:/path/to/file copy configuration via ssh/scp to remote host
+ -mail <recipient> send configuration via mail
+ -file foo_bar_config.tbz save configuration in specified file
+
+Usage examples:
+
+ save-config -all => store all configuration files in config.tbz in current dir
+ save-config -home -mail devnull@grml.org => store $HOME/.* in config.tbz and send it via mail
+ save-config -etc -ssh devnull@grml.org:/path/ => store /etc in config.tbz and scp it to specified host
+ save-config -all -file foo.tbz => store all configuration files in foo.tbz
+ SAVE_ALL=yes save-config -file /path/foo.tbz => store all configuration files in /path/foo.tbz
+
+restore-config - restore configuration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can restore a configuration using the bootoptions or by a script
+file named 'restore-config'. Specify the filename of the
+configuration archive which should be used as a parameter. The
+following options are available to specify which parts of the archive
+should be extracted.
+
+ -home extract hidden files from $HOME ($HOME/.*)
+ -etc extract modified files from /etc
+ -configdir extract $HOME/config
+
+The default is to extract (restore) all files found in the archive.
+
+TIP: It is also possible to use environment variables for specifying
+which part should be restored. Just set the corresponding variable:
+$RESTORE_HOME, $RESTORE_ETC, $RESTORE_CONFIGDIR and $RESTORE_ALL
+
+Usage examples:
+
+ restore-config -home foo_bar_config.tbz => restore configuration from file foo_bar_config.tbz
+ restore-config config.tbz => restore configuration from file config.tbz
+
+mkpersistenthome - use persistent home-directory
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You have a local partition you would like to use as your
+home-directory? Just use the interactive script called
+'mkpersistenthome'. It will either create a file named grml.img on the
+specified partition or create a partition using the ext2 filesystem
+(you can specify the option in a dialog inside the program). grml.img
+is a loopback device which size you can specify manually. It is
+possible to scan through the partitions to identify the appropriate
+partition. To use a home-directory located on your hard-drive use the
+appropriate bootoption on bootprompt:
+
+ home=/dev/hda3 => use /dev/hda3 as the homepartition
+ home=scan => scan through the available partitions and search for file grml.img
+
+Boot-Options
+------------
+
+The following bootoptions are supported. Use them at the (isolinux)
+bootprompt as documented here.
+
+myconfig::
+ This option is for restoring configuration using the file config.tbz
+ on the specified device. Usage examples:
+
+ myconfig=/dev/sda1 => use file config.tbz from usb-device
+ myconfig=/dev/fd0 => use file config.tbz from floppy-disk
+ myconfig=/dev/sda1 file=config_foobar.tbz => use file config_foobar.tbz from usb-device
+
+home::
+ This option is for setting a specific partition as home directory.
+ Usage examples:
+
+ home=/dev/hda3 => use /dev/hda3 as the homepartition
+ home=scan => scan through the available partitions and search
+ for file grml.img
+
+partconf::
+
+ This option mounts the specified device in read-only mode and tries
+ to copy all files specified in /etc/grml/partconf to the grml
+ system. This provides the possibility to use the configuration of a
+ harddisk installation. For example using the network configuration
+ (which is specified in /etc/network) is possible using this
+ bootoption. Usage example:
+
+ partconf=/dev/hda2 => try to mount /dev/hda2 and copy files specified
+ in /etc/grml/partconf to the booted grml system
+
+netconfig::
+ Use this option to restore configuration using wget to download
+ a configuration file from specified destination. Usage example:
+
+ netconfig=server.tld/path/to/config.tbz => restore configuration using wget to download file config.tbz
+
+extract::
+
+ Extract specific directories from configuration archive. Notice:
+ This bootparam is useful only with bootparams which are able to
+ extract configuration archives.
+
+ extract=/home/grml => extract only /home/grml from archive
+ extract=/etc => extract only /etc from archive
+ extract=/home/grml/config => extract only $HOME/config from archive
+
+scripts::
+ This option can start a script located in /cdrom/scripts/.
+ Usage examples:
+
+ scripts => run script /cdrom/scripts/grml.sh
+ scripts=foobar.sh => run script foobar.sh in /cdrom/scripts/
+
+config::
+ Use this option to restore a configuration using directory
+ /cdrom/config (located in root-directory on a usb-device). Usage
+ examples:
+
+ config => restore configuration using file config.tbz from directory /cdrom/config/
+ config=config_foobar.tbz => restore configuration using file config_foobar.tbz from directory /cdrom/config/
+
+debs::
+
+ This options allows automatic installation of deb packages while
+ booting. The debian packages have to be located in directory
+ /cdrom/debs/. Usage examples:
+
+ debs => install all debian packages (suffix .deb) from directory /cdrom/debs/
+ debs=01 => install all debian packages (suffix .deb) starting with 01 in the filename from directory /cdrom/debs/
+
+
+noautoconfig::
+ Deactivate automounting. By default the command 'mount' tries to mount a
+ device with label 'GRMLCFG'. If you specify the noautoconfig bootparam
+ the automounting will be deactivated.
+
+ noautoconfig => disables auto mounting of label 'GRMLCFG'
+
+
+[[X7]]
+Usage scenarios
+---------------
+
+Personal configuration files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You are a fan of the editor vim? Great. You probably have your own
+~/.vimrc and want to use it on the grml system. You also don't like
+the default zsh configuration and want to use your own ~/.zshrc?
+How to procede? Copy your .vimrc and .zshrc to $HOME of user 'grml'.
+Place additional files in $HOME/config. Now create a configuration for
+your files running:
+
+ save-config -home -configdir
+
+Now you should have a file named config.tbz containing your
+configuration files. You can copy the archive to a webserver
+and restore it via downloading during reboot using the following
+commandline on bootprompt:
+
+ grml netconfig=server.tld/path/to/config.tbz
+
+You don't have network access but own a floppy drive? Copy the file
+to a floppy disk and boot with:
+
+ grml myconfig=/dev/fd0
+
+Floppy is to small or to slow? Ok, let's use a usb device:
+
+ grml myconfig=/dev/sda1
+
+
+Network configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+You need a specific network setup and want to use your own
+/etc/network/interfaces by default? Generate the configuration
+archive running the following command as user root:
+
+ save-config -etc
+
+Now you should have a file named config.tbz containing your
+configuration files. If you want to use it with a floppy disk copy the
+file to a floppy and boot via using the following command on
+bootprompt:
+
+ grml myconfig=/dev/fd0
+
+Floppy is to small or to slow? Ok, let's use a usb device:
+
+ grml myconfig=/dev/sda1
+
+You do have an existing harddisk installation and want to use its
+configuration? Let's say the debian system is located in /dev/hda2. You
+want to use the directory /etc/network. This directory is activated by
+default in /etc/grml/partconf so we don't have to do any further work.
+We just need to activate it via using the following commandline on
+bootprompt:
+
+ grml partconf=/dev/hda2
+
+Automatic installation of debian packages
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You have a specified debian package named 'foobar.deb' and want to use
+it with (therefore: install it on) grml by default? Notice: this feature
+is useful especially for grml-small (a 50 MB ISO). If you want to use it
+with the 700MB version of grml you have to overburn the ISO.
+
+Let's assume you have burned the grml iso to a CD-RW using a commandline like:
+
+ cdrecord dev=/dev/hdc -v -multi -tao grml_0.5.iso
+
+Now create a directory named debs and place foobar.deb in it:
+
+ mkdir debs/ && cp foobar.deb debs/
+
+Notice: This directory will be located in /cdrom after burning the second session.
+
+Now create the second session containing this directory:
+
+ mkisofs -M grml_0.5.iso -C `cdrecord -msinfo dev=/dev/hdc` -R -o 2nd_session.iso debs
+
+Finally append the second session to the cd using:
+
+ cdrecord dev=/dev/hdc -v -multi -tao 2nd_session.iso
+
+TIP: the application k3b (not available on the live-CD but available
+through the Debian repositories) provides an easy to use interface for
+doing the multisession task.
+
+Now boot from your new personalized grml cd using the debs option:
+
+ grml debs
+
+Run your own commands
+~~~~~~~~~~~~~~~~~~~~~
+
+You know that booting with 'grml service=foobar' executes
+/etc/init.d/foobar when booting grml. But you want to setup a more
+complex network configuration, adjust some other stuff and so on on your
+own? Just write a script named grml.sh which does the job and use own
+of the mentioned bootparams. Let's say you have placed grml.sh on your
+usb device (usb stick) then use the following commandline on bootprompt:
+
+ grml myconfig=/dev/sda1
+
+Or even better: create a floppy disk with label GRMLCFG running:
+
+ fdformat /dev/fd0 # format the floppy disk if not done already
+ mkfs.ext2 -L GRMLCFG /dev/fd0 # now create ext2 filesystem with label GRMLCFG on it:
+
+TIP: several filesystems provide the possibility to provide a label.
+For example FAT provides this through: 'mkfs.vfat -n GRMLCFG
+/dev/sda1' (attention: this will destroy data on /dev/sda1 of
+course!). Take a look at the documentation/manpage of the filesystem
+you want to use.
+
+Now place your configuration archive (see save-config and the other
+usage scenarios) and the script grml.sh on the floppy disk. Now you can
+boot your system without specifying any bootparameters on bootprompt
+because devices labeled with GRMLCFG are mounted readonly and used by
+default. If you did not label your device you can use the device anyway
+using 'grml myconfig=/dev/ice' on the bootprompt.
+
+Debug remote systems
+~~~~~~~~~~~~~~~~~~~~
+
+You are responsible for a customer's system in her data center. The
+system has failed and you need to debug from remote, and the remote
+hands available in the data center do not have enough knowledge to get
+grml booted and configure the network without external help?
+
+If the hard disk of the system is still available, you hopefully have
+saved a configuration file with IP address, netmask and default
+gateway somewhere on that hard disk. grml can use the information
+found on a partition. Take a look at the 'partconf' boot parameter.
+Usage example: 'grml partconf=/dev/hda2' copies files defined in
+/etc/grml/partconf from /dev/hda2 to the grml system. As /etc/network
+is predefined in /etc/grml/partconf the configuration from /dev/hda2
+will be taken.
+
+Or you use a standard grml medium and have grml read IP address,
+netmask and default gateway from another medium like a floppy or an USB
+stick. Take a look at the script saveconfig and the boot parameter
+myconfig.
+
+Adjust boot parameters
+~~~~~~~~~~~~~~~~~~~~~~
+
+You want to set some boot options permanently? Just add a directory
+named 'bootparams' to the CD-ROM so it is located at
+/cdrom/bootparams/ and contains a textfile with the bootparams you
+would like to use.
+
+ mkdir bootparams
+ echo lang=de > bootparams/my_bootparams
+
+Now burn a multisession CD where directory bootparams is located in the
+root directory of the CD.
+
+TIP: the application k3b (not available on the live-CD but available
+through the Debian repositories) provides an easy to use interface for
+doing the multisession task.
+
+Use persistent home directory
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You want to use a persistent home directory which includes all the files
+located in $HOME. Use the script mkpersistenthome to create such a
+persistent home directory. You have the options to either use a
+specific partition as your home directory or add a loopback file
+named grml.img on the specified partition (the default).
+
+TIP: /dev/external in the partition selection of mkpersistenthome is
+an usb device without partitions. /dev/external1 corresponds to the
+first partition on an usb device (usually an usb stick).
+
+After running the script mkpersistenthome you can use the boot
+parameter home to activate the home directory. If you are using the
+option with the loopback file (grml.img) you can boot via:
+
+ grml home=scan
+
+which will scan through the partitions and if a file grml.img is found
+it will be mounted as your $HOME-directory. If you want to use a
+partition as your home directory specify the device as an option. If
+you want to use /dev/hda2 as your $HOME boot via:
+
+ grml home=/dev/hda2
+
+Notice: the files located in /etc/skel will be copied to the partition
+(but will not overwrite any files).
+
+Bugs
+~~~~
+Please report feedback, bugreports and wishes link:http://grml.org/contact/[to us]!
+
+Author
+~~~~~~
+(c) 2005, Michael Prokop <mika@grml.org>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mkpersistenthome Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,247 @@
+#!/bin/bash
+# Filename: mkpersistenthome
+# Purpose: mkpersistenthome - create grml home directory image
+# Authors: grml-team (grml.org), (c) Klaus Knopper Feb 2003, (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2.
+# Latest change: Sun Oct 23 13:54:40 CEST 2005 [mika]
+################################################################################
+
+PATH="/bin:/sbin:/usr/bin:/usr/sbin"
+export PATH
+
+# Get root
+[ "`id -u`" != "0" ] && exec sudo "$0" "$@"
+
+TMP=$(mktemp)
+DIRECTORY=""
+DIALOG="dialog"
+
+bailout(){
+ rm -f "$TMP" "$TMP.done" "$TMP.err"
+ [ -n "$DIRECTORY" ] && umount "$DIRECTORY" 2>/dev/null
+ exit 0
+}
+
+trap bailout 1 2 3 15
+
+# LANGUAGE etc.
+[ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
+[ -z "$LANG" ] && export LANG
+[ -z "$LANGUAGE" ] && export LANGUAGE
+#[ -z "$CHARSET" ] && export CHARSET
+
+HOMEKB="$(du -sk $HOME 2>/dev/null | awk '{print $1}')"
+
+# Language-dependent messages
+case "$LANGUAGE" in
+de*|at*|ch*)
+TITLE1="Permanentes grml Heimverzeichnis anlegen"
+MESSAGE1="Dieses Skript richtet ein permanentes Heimverzeichnis für den User \"grml\" auf Ihrer Festplatte oder einem Wechselmedium wie Memorystick, Compactflash oder ZIP-Medium ein. Dadurch ist es möglich, Daten und persönliche Konfigurationen über einen Reboot hinaus zu speichern, sofern sie im persönlichen Heimverzeichnis des Benutzers abgelegt werden. Per Bootoption, z.B. \"home=/dev/sda1\" für die erste Partition einer SCSI-Festplatte oder eines USB-Memorystick, können Sie beim Systemstart das permanente Heimverzeichnis wieder aktivieren. Die Bootoption \"home=scan\" durchsucht automatisch alle Partitionen und erkannten Speichermedien nach einem persistenten grml-Heimverzeichnis.
+
+Möchten Sie das Heimverzeichnis des Benutzers \"grml\" permanent speichern?"
+MESSAGE2="Bitte wählen Sie die Partition, auf der Sie das Heimverzeichnis (oder ein Image davon) anlegen möchten."
+MESSAGE3="Möchten Sie die KOMPLETTE Partition verwenden und mit den Linux-Dateisystem formatieren?
+
+NEIN=Image-Datei auf bestehendem Dateisystem anlegen."
+SUCCESS="FERTIG!
+
+Die grml-Konfiguration wurde erfolgreich gespeichert. Ihre Konfigurationsdateien werden beim nächsten grml-Bootvorgang in die Ramdisk restauriert, wenn Sie im Bootscreen \"grml floppyconfig\" (Diskette) bzw. \"grml myconfig=/mnt/verzeichnisname\" angeben."
+ERROR="Leider konnte die grml-Konfiguration NICHT gespeichert werden:"
+MESSAGE_NO_PARTS="Keine passende Partition gefunden. Zur Erinnerung: NTFS-Partitonen können mit Linux nicht beschrieben werden."
+;;
+*)
+TITLE1="Create persistent grml home directory"
+MESSAGE1="This script creates a persistent home directory for the \"grml\" account on your harddisk or on a changeable medium like memory stick, compact flash or zip media. Using this features makes it possible to store personal data and config files permanently over a reboot, if they are stored inside the home directory of the \"grml\" user. The boot option \"home=/dev/sda1\", for the first partition of a SCSI harddisk or USB memory stick as example, activates the persistent home directory at system startup. You can also let grml scan all autodetected storage devices using the boot option \"home=scan\".
+
+Do you want to create a persistent home directory for the \"grml\" user?"
+
+MESSAGE2="Please select partition for creating persistent homedir (or image):"
+MESSAGE3="Do you want to use the ENTIRE Partition, and would like to format it with the Linux filesystem?
+
+NO=Just create an image in the existing filesystem."
+SUCCESS="SUCCESS!
+
+Creation of grml configuration floppy was successful. Your configuration files will be reinstalled to the ramdisk on next grml boot if you specify \"grml floppyconf\" (floppy disk), or \"grml myconfig=/mnt/directoryname\" at the boot prompt."
+ERROR="The grml configuration could NOT be saved:"
+MESSAGE_NO_PARTS="No suitable partitions could be found. Remember that NTFS-Partitions are not writable with linux."
+;;
+esac
+
+$DIALOG --cr-wrap --clear --title "$TITLE1" --yesno "$MESSAGE1" 18 75 || bailout
+
+# Partition selector
+PARTITIONS=""
+count=0
+# for i in `awk '/^\/dev\/[hs]d[a-z].*\/mnt\/[hs]d[a-z]/{if(!/ntfs/){print $1}}' /etc/fstab` # \
+for i in `awk '/^\/dev\/[hse][dx][a-z].*\/mnt\/[hse][dx][a-z]/{if(!/ntfs/){print $1}}' /etc/fstab` # \
+# /dev/fd0 \
+# /dev/external \
+# /dev/external1 ;
+do
+ PARTITIONS="$PARTITIONS ${i} [Disk/Partition] off"
+done
+[ -z "$PARTITIONS" ] && { $DIALOG --cr-wrap --clear --title "$TITLE1" --msgbox "$ERROR $MESSAGE_NO_PARTS" 10 75; bailout; }
+
+DIRECTORY=""
+PARTITION=""
+while [ -z "$PARTITION" -o -z "$DIRECTORY" -o ! -e "$DIRECTORY" ]; do
+ rm -f "$TMP"
+ $DIALOG --cr-wrap --clear --title "$TITLE1" --radiolist "$MESSAGE2" 18 75 9 $PARTITIONS 2>"$TMP" || bailout
+ PARTITION="$(<$TMP)"
+ DIRECTORY="/mnt/${PARTITION##/dev/}"
+done
+
+DEVICE=""
+if $DIALOG --cr-wrap --clear --title "$TITLE1" --defaultno --yesno "$MESSAGE3" 15 75; then
+ DEVICE="$PARTITION"
+else
+ DEVICE="$DIRECTORY/grml.img"
+ mount | grep -q "$DIRECTORY" || mount -r "$DIRECTORY" 2>"$TMP.err"
+ [ "$?" != "0" ] && { $DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR `cat $TMP.err`" 10 75; bailout; }
+ mount | grep -q "$DIRECTORY.*ntfs" && { $DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR NTFS" 10 75; bailout; }
+ mount -o remount,rw "$DIRECTORY"
+fi
+
+# More language-dependent Messages
+case "$LANGUAGE" in
+ de*|at*|ch*)
+ MESSAGE4="Sind Sie ABSOLUT SICHER, dass Sie die Partition $PARTITION formatieren möchten? ALLE DATEN WERDEN DADURCH GELÖSCHT!"
+ MESSAGE5="Möchten Sie Ihr Heimverzeichnis mit AES256 (=Advanced Encryption Standard 256bit, s.a. http://csrc.nist.gov/encryption/aes/) verschlüsselt speichern? Hierzu ist die Eingabe eines sehr langen Passwortes beim Einrichten sowie beim Einbinden des Verzeichnisses beim Systemstart erforderlich. NEIN=unverschlüsselt"
+ MESSAGE6="Bitte geben Sie die gewünschte Größe Ihres persistenten Heimverzeichnisses in MB an (aktuell belegt: $HOMEKB Kilobyte, verfügbar:"
+ MESSAGE7="Formatiere $DEVICE mit dem ext2 Dateisystem und kopiere Daten..."
+ MESSAGE8="Lege Datenbereich für Linux an..."
+ SUCCESS="$DEVICE wurde erfolgreich mit dem Linux ext2 Dateisystem formatiert, und Ihre Heimverzeichnis-Daten wurden darauf transferiert.
+
+Sie können jetzt Ihren Computer neu starten, und beim grml boot:-Prompt durch Eingabe von \"grml home=$PARTITION\" oder \"grml home=scan\" Ihr permanentes Heimverzeichnis aktivieren. Falls Sie außerdem (mit dem save-config Skript) die Systemeinstellungen gesichert haben, können Sie diese Option mit der Angabe von \"myconf=$PARTITION\" kombinieren."
+ ;;
+ *)
+ MESSAGE4="Are you positively SURE that you want to format partition $PARTITION? ALL DATA WILL BE LOST!"
+ MESSAGE5="Do you want to save your home directory encrypted with AES256 (Advanced Encryption Standard, see http://csrc.nist.gov/encryption/aes/)? If yes, you will have to specify a very long password at homedir creation and boot time."
+ MESSAGE6="Please enter the desired size of your persistent homedir in MB (currently used: $HOMEKB kB, available:"
+ MESSAGE7="Formatting $DEVICE with ext2 filesystem and copying data..."
+ MESSAGE8="Preparing for Linux filesystem..."
+ SUCCESS="$DEVICE has been succeessfully formatted with the Linux ext2 filesystem, and your home directory has been transferred to it.
+
+You may now reboot your computer and type \"grml home=$PARTITION\" or \"grml home=scan\" at the grml boot: prompt to take advantage of your new persistent home directory. If you have also saved the system configuration (using the save-config script), you can use this in combination with \"myconf=$PARTITION\"."
+ ;;
+esac
+
+gauge(){
+ rm -f "$TMP.done"
+ status=0
+ while [ ! -e "$TMP.done" ]; do
+ echo "$status" ; status="`expr \( 100 - $status \) / 4 + $status`"; sleep 2;
+ done | $DIALOG --title "$TITLE1" --gauge "$1" 8 75 0
+}
+
+# Stop status bar
+killgauge(){
+ touch "$TMP.done" ; wait ; rm -f "$TMP.done"
+}
+
+if [ "$DEVICE" = "$PARTITION" ]; then
+ $DIALOG --cr-wrap --clear --title "$TITLE1" --defaultno --yesno "$MESSAGE4" 6 75 || bailout
+else
+ AMOUNT=0
+ AVAIL="$(df -m $DIRECTORY/. | awk '/^\/dev\//{print $4}')"
+ until [ "$AMOUNT" -ge 1 -a "$AMOUNT" -le "$AVAIL" ] 2>/dev/null; do
+ $DIALOG --cr-wrap --clear --title "$TITLE1" --inputbox "$MESSAGE6 $AVAIL MB)" 10 62 "30" 2>"$TMP" || bailout
+ AMOUNT="$(<$TMP)"
+ done
+ gauge "$MESSAGE8" &
+ dd if=/dev/urandom of="$DEVICE" bs=1M count="$AMOUNT" 1>/dev/null || { killgauge; sleep 2; bailout; }
+ killgauge
+fi
+
+#ENCRYPTION=""
+#$DIALOG --cr-wrap --clear --title "$TITLE1" --defaultno --yesno "$MESSAGE5" 9 75 && ENCRYPTION="AES256"
+
+findfreeloop(){
+ i=0
+ for i in 0 1 2 3 4 5 6 7; do
+ LOOP="/dev/loop$i"
+ losetup "$LOOP" >/dev/null 2>&1 || { echo "$LOOP"; return 0; }
+ done
+ return 1
+}
+
+getpassword(){
+case "$LANGUAGE" in
+ de*|at*|ch*)
+ HEADER="AES256 Verschlüsselungs-Passwort (Minimum 20 Zeichen!)"
+ ENTER="Eingabe:"
+ AGAIN="Noch einmal, um sicherzugehen:"
+ ;;
+ *)
+ HEADER="AES256 encryption password (minimum 20 characters!)"
+ ENTER="Enter:"
+ AGAIN="Again, just to be sure:"
+ ;;
+esac
+
+PASS1=""
+PASS2=""
+
+until [ -n "$PASS1" -a "$PASS1" = "$PASS2" ]; do
+ rm -f "$TMP.pass"
+# if [ "$DIALOG" = "Xdialog" ]; then
+# Xdialog --title "$TITLE1" --password --password --2inputsbox "$HEADER" 15 60 "$ENTER" "" "$AGAIN" "" 2>"$TMP.pass" || bailout
+# PASSWORDS="$(<$TMP.pass)"
+# PASS1="${PASSWORDS%%/*}"
+# PASS2="${PASSWORDS##*/}"
+# else
+ dialog --title "$HEADER" --passwordbox "$ENTER" 8 65 "" 2>"$TMP.pass" || bailout
+ PASS1="$(<$TMP.pass)"
+ dialog --title "$HEADER" --passwordbox "$AGAIN" 8 65 "" 2>"$TMP.pass" || bailout
+ PASS2="$(<$TMP.pass)"
+# fi
+done
+rm -f "$TMP.pass"
+echo "$PASS1" >&2
+}
+
+#LOOPDEV="$(findfreeloop)"
+#FORMAT=""
+#if [ -n "$ENCRYPTION" -a -n "$LOOPDEV" ]; then
+#getpassword 2>"$TMP"
+#PASSWORD="$(<$TMP)"
+#rm -f "$TMP"
+#losetup -p0 -e "$ENCRYPTION" "$LOOPDEV" "$DEVICE" 2>"$TMP.err" <<EOT
+#$PASSWORD
+#EOT
+#if [ "$?" != "0" ]; then
+#$DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR `cat $TMP.err`" 10 75
+#bailout
+#fi
+
+# Start progress display
+#gauge "$MESSAGE7" &
+#mke2fs -m0 "$LOOPDEV" 2>"$TMP.err" || { killgauge; $DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR `cat $TMP.err`" 10 75; bailout; }
+#mkdir -p /tmp/grmlhome
+#mount -t ext2 "$LOOPDEV" /tmp/grmlhome 2>"$TMP.err" && rsync -Ha "$HOME/" /tmp/grmlhome 2>"$TMP.err" || { killgauge; $DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR `cat $TMP.err`" 10 75; bailout; }
+#umount -l /tmp/grmlhome
+#losetup -d "$LOOPDEV"
+#umount "$DIRECTORY" 2>/dev/null
+#killgauge
+#else
+
+# Normal loopback file or partition
+gauge "$MESSAGE7" &
+# Just to make sure...
+umount "$DEVICE" 2>/dev/null
+mke2fs -F -m0 "$DEVICE" 1>/dev/null 2>"$TMP.err" || { killgauge; $DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR `cat $TMP.err`" 10 75; bailout; }
+LOOPOPT=""
+[ -f "$DEVICE" ] && LOOPOPT="-o loop"
+mkdir -p /tmp/grmlhome
+mount -t ext2 $LOOPOPT "$DEVICE" /tmp/grmlhome 2>"$TMP.err" && rsync -Ha "$HOME/" /tmp/grmlhome 2>"$TMP.err" || { killgauge; umount /tmp/grmlhome 2>/dev/null; $DIALOG --cr-wrap --title "$TITLE1" --msgbox "$ERROR `cat $TMP.err`" 10 75; bailout; }
+umount /tmp/grmlhome
+umount "$DIRECTORY" 2>/dev/null
+killgauge
+#fi
+
+$DIALOG --cr-wrap --title "$TITLE1" --msgbox "$SUCCESS" 17 65
+
+bailout
+
+## END OF FILE #################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/restore-config Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,159 @@
+#!/usr/bin/zsh
+# Filename: restore-config
+# Purpose: generate grml configuration archive and store it anywhere
+# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2.
+# Latest change: Tue Oct 18 15:54:43 CEST 2005 [mika]
+################################################################################
+
+# some zsh-stuff {{{
+ autoload colors ; colors
+ [ -r /etc/grml/sh-lib ] && . /etc/grml/sh-lib
+# }}}
+
+# set variables {{{
+ LANG=C
+ LC_ALL=C
+ PROGRAMNAME=${0##*/}
+ TMPDIR=/tmp
+
+# functions {{{
+debug(){
+ if [[ $DEBUG -gt 0 ]] ; then
+ echo "debug: $*"
+ fi
+# setopt xtrace
+# set -x
+}
+
+bailout(){
+ rm -f "$TMP_FILELIST"
+}
+
+trap bailout 1 2 3 15
+# }}}
+
+# usage information {{{
+usage()
+{
+ print 1>&2 "
+$bg[black]$fg[green]${boldcolor}${PROGRAMNAME} - restore configuration of grml system${reset_color}
+
+$bg[black]$fg[blue]${boldcolor}Usage:${reset_color}
+ $PROGRAMNAME [-target_options] <configuration_file>
+
+$bg[black]$fg[blue]${boldcolor}Target options:${reset_color}
+ -home extract hidden files from \$HOME (\$HOME/.*)
+ -etc extract modified files from /etc
+ -configdir extract \$HOME/config
+
+ Default: restore/extract complete archive.
+
+ Notice: it is also possible to use environment variables:
+ \$RESTORE_HOME, \$RESTORE_ETC, \$RESTORE_CONFIGDIR and \$RESTORE_ALL
+
+$bg[black]$fg[blue]${boldcolor}Usage examples:${reset_color}
+ $PROGRAMNAME -home foo_bar_config.tbz => restore configuration from file foo_bar_config.tbz
+ $PROGRAMNAME config.tbz => restore configuration from file config.tbz
+
+More information on restore-config can be found in the manual page: man restore-config
+
+See also: save-config(1), bootoptions: myconfig=/dev/ice, extract=PATH,
+ netconfig=server.tld/path/to/config.tbz
+
+Report bugs, send wishes and feedback to the grml team:
+http://grml.org/bugs/ - contact (at) grml.org
+"
+}
+# }}}
+
+
+# extract configuration file {{{
+restore_all(){
+ echo "Trying to extract $FILENAME"
+ ( cd / && unp $FILENAME )
+}
+
+restore_home(){
+ echo "Trying to extract $FILENAME in $HOME"
+ ( cd $HOME && unp $FILENAME -- -x $HOME )
+}
+
+restore_etc(){
+ echo "Trying to extract $FILENAME in /etc"
+ ( cd /etc && unp $FILENAME -- -x /etc )
+}
+
+restore_config(){
+ echo "Trying to extract $FILENAME in $HOME/config"
+ ( cd $HOME && unp $FILENAME -- -x $HOME/config )
+}
+# }}}
+
+
+# commandline parsing {{{
+parse_options()
+{
+ zparseopts -K -- help=o_help file:=o_file home=o_home etc=o_etc \
+ configdir=o_configdir all=o_all
+
+ if [[ "$#" == 0 || "$o_help" != "" || "$1" == '-h' || "$1" == '--help' ]]; then
+ usage ; exit
+ fi
+
+ if [[ "$1" == "" ]]; then
+ echo "Error: No filename provided." ; exit 1
+ else
+ eval FILENAME=\${$#}
+ FILENAME=`readlink -f $FILENAME`
+ fi
+
+ if [[ "$o_home" != "" ]]; then
+ echo "debug: home is set"
+ RESTORE_HOME="yes"
+ fi
+
+ if [[ "$o_etc" != "" ]]; then
+ echo "debug: etc is set"
+ RESTORE_ETC="yes"
+ fi
+
+ if [[ "$o_configdir" != "" ]]; then
+ echo "debug: configdir is set"
+ RESTORE_CONFIGDIR="yes"
+ fi
+
+}
+parse_options $*
+# }}}
+
+runit(){
+ if [[ $RESTORE_HOME == "yes" ]]; then
+ debug "running restore_home"
+ restore_home
+ RESTORE_SET=1
+ fi
+ if [[ $RESTORE_ETC == "yes" ]] ; then
+ debug "running restore_etc"
+ restore_etc
+ RESTORE_SET=1
+ fi
+ if [[ $RESTORE_CONFIGDIR == "yes" ]] ; then
+ debug "running restore_configdir"
+ restore_config
+ RESTORE_SET=1
+ fi
+ debug "FILENAME = $FILENAME"
+ if [ -z $RESTORE_SET ] ; then
+ debug "running restore all"
+ restore_all
+ fi
+}
+
+# now run it
+ runit
+ bailout
+
+## END OF FILE #################################################################
+# vim:foldmethod=marker
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/save-config Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,201 @@
+#!/usr/bin/zsh
+# Filename: save-config
+# Purpose: generate grml configuration archive and store it anywhere
+# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2.
+# Latest change: Mit Feb 21 12:24:27 CET 2007 [mika]
+################################################################################
+
+# some zsh-stuff {{{
+ autoload colors ; colors
+ [ -r /etc/grml/sh-lib ] && . /etc/grml/sh-lib
+# }}}
+
+# set variables {{{
+ LANG=C
+ LC_ALL=C
+ [[ $UID != 0 ]] && runas='sudo' # important for /etc
+ CONFIG=/etc/grml/saveconfig ; [ -r $CONFIG ] && . $CONFIG
+ PROGRAMNAME=${0##*/}
+ HOSTNAME=$(hostname)
+ DATE=$(date)
+ GRML_VERSION=$(awk '{print $1}' /etc/grml_version 2>/dev/null || print "not a grml system")
+ KERNEL=$(uname -a)
+ TMPDIR=/tmp
+ MAIL="$TMPDIR/mail.txt"
+# FILELIST='/etc/grml/saveconfig.list'
+ if [ -z $FILELIST ] ; then
+ TMP_FILELIST=$(mktemp $TMPDIR/filelist.XXXXXX)
+ fi
+
+# functions {{{
+debug(){
+ if [[ $DEBUG -gt 0 ]] ; then
+ echo "debug: $*"
+ fi
+# setopt xtrace
+# set -x
+}
+
+bailout(){
+ rm -f "$TMP_FILELIST"
+ rm -f "$TMPDIR/mail-etc.txt"
+}
+
+trap bailout 1 2 3 15
+# }}}
+
+# usage information {{{
+usage()
+{
+ print 1>&2 "
+$bg[black]$fg[green]${boldcolor}${PROGRAMNAME} - save configuration of grml system${reset_color}
+
+$bg[black]$fg[blue]${boldcolor}Usage:${reset_color}
+ $PROGRAMNAME [-target_options] -{all,home,etc,configdir}
+
+$bg[black]$fg[blue]${boldcolor}Target options:${reset_color}
+ -ssh user@host:/path/to/file copy configuration via ssh/scp to remote host
+ -mail <recipient> send configuration via mail
+ -file foo_bar_config.tbz save configuration in specified file
+
+ Notice: if no option is specified the default is assumed:
+ create file config.tbz in current directory
+
+$bg[black]$fg[blue]${boldcolor}Files-to-store options:${reset_color}
+ -home store hidden files from \$HOME (\$HOME/.*)
+ -etc store modified files from /etc
+ -configdir store \$HOME/config
+ -all store all configuration files (:= -home, -configdir and -etc)
+
+ Notice: it is also possible to use environment variables:
+ \$SAVE_HOME, \$SAVE_ETC, \$SAVE_CONFIGDIR and \$SAVE_ALL
+
+$bg[black]$fg[blue]${boldcolor}Usage examples:${reset_color}
+ $PROGRAMNAME -all => store all configuration files in config.tbz in current dir
+ $PROGRAMNAME -home -mail devnull@grml.org => store \$HOME/.* in config.tbz and send it via mail
+ $PROGRAMNAME -etc -ssh devnull@grml.org:/path/ => store /etc in config.tbz and scp it to specified host
+ $PROGRAMNAME -all -file foo.tbz => store all configuration files in foo.tbz
+ SAVE_ALL=yes $PROGRAMNAME -file /path/foo.tbz => store all configuration files in /path/foo.tbz
+
+More information on save-config can be found in the manual page: man save-config
+
+See also: restore-config(1), bootoptions: myconfig=/dev/ice, extract=PATH,
+ netconfig=server.tld/path/to/config.tbz
+
+Report bugs, send wishes and feedback to the grml team:
+http://grml.org/bugs/ - contact (at) grml.org
+"
+}
+# }}}
+
+# what do we want to store? {{{
+save_home(){
+ debug "save home"
+ for i in $HOME/.* ; do findchanged "$i" /etc/skel/$(basename "$i"); done >> $TMP_FILELIST
+ debug "debug: $TMP_FILELIST"
+}
+
+save_etc(){
+ debug "save etc"
+ $runas findchanged /etc /GRML/etc >> $TMP_FILELIST
+}
+
+save_configdir(){
+ debug "save configdir"
+ if [ -d $HOME/config ] ; then
+ ls $HOME/config/* >> $TMP_FILELIST 2>/dev/null
+ ls $HOME/config/.* >> $TMP_FILELIST 2>/dev/null
+ fi
+}
+
+# create configuration file {{{
+create_config(){
+ BZIP2=-9 $runas tar -T - -cpPjf "$FILENAME" <"$TMP_FILELIST"
+ echo "Successfully stored configuration in file $FILENAME"
+}
+# }}}
+
+# commandline parsing {{{
+parse_options()
+{
+ zparseopts -K -- help=o_help mail:=o_mail \
+ file:=o_file home=o_home etc=o_etc \
+ configdir=o_configdir all=o_all ssh:=o_ssh
+
+ if [[ "$#" == 0 || "$o_help" != "" || "$1" == '-h' || "$1" == '--help' ]]; then
+ usage ; exit
+ fi
+
+ if [[ "$o_file" != "" ]]; then
+ FILENAME="$o_file[2]"
+ else
+ FILENAME="config.tbz"
+ fi
+
+ if [[ "$o_home" != "" ]]; then
+ debug "home is set"
+ SAVE_HOME="yes"
+ fi
+
+ if [[ "$o_etc" != "" ]]; then
+ debug "etc is set"
+ SAVE_ETC="yes"
+ fi
+
+ if [[ "$o_configdir" != "" ]]; then
+ debug "configdir is set"
+ SAVE_CONFIGDIR="yes"
+ fi
+
+ if [[ "$o_all" != "" ]]; then
+ debug "home, etc and configdir are set"
+ SAVE_HOME="yes"
+ SAVE_ETC="yes"
+ SAVE_CONFIGDIR="yes"
+ fi
+
+ if [[ "$o_ssh" != "" ]]; then
+ debug "scp $FILENAME $o_ssh[2]"
+ scp $FILENAME $o_ssh[2]
+ fi
+
+ if [[ "$o_mail" != "" ]]; then
+ recipient=$o_mail[2]
+ debug "send mail to $recipient"
+ echo "Created on $DATE on host $HOSTNAME running grml $GRML_VERSION" > $MAIL
+ muttng -s "configuration of $HOSTNAME ($DATE)" -a $FILENAME $recipient < $MAIL
+ fi
+}
+parse_options $*
+# }}}
+
+runit(){
+ if [[ $SAVE_HOME == "yes" ]]; then
+ debug "running save_home"
+ save_home
+ SETSAVE=1
+ fi
+ if [[ $SAVE_ETC == "yes" ]] ; then
+ debug "running save_etc"
+ save_etc
+ SETSAVE=1
+ fi
+ if [[ $SAVE_CONFIGDIR == "yes" ]] ; then
+ debug "running save_configdir"
+ save_configdir
+ SETSAVE=1
+ fi
+ if [ -z $SETSAVE ] ; then
+ echo "Sorry, you did not select any configuration which should be saved. Exiting." ; exit 1
+ fi
+}
+
+# now run it
+ runit
+ create_config
+ bailout
+
+## END OF FILE #################################################################
+# vim:foldmethod=marker
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/save-config.1 Wed Feb 21 12:26:44 2007 +0100
@@ -0,0 +1,438 @@
+.\"Generated by db2man.xsl. Don't modify this, modify the source.
+.de Sh \" Subsection
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.TH "GRML-CONFIG" 1 "" "" ""
+.SH NAME
+save-config \- save configuration ; restore-config - restore configuration; mkpersistenthome - create persistent home directory; more options available via bootoptions (see following documentation)
+.SH "SYNOPSIS"
+
+
+save\-config \- please take a look at \fIsave\-config \-h\fR ; restore\-config \- please take a look at \fIrestore\-config \-h\fR, mkpersistenthome (no options available)
+
+
+Documentation written by \fIMichael Prokop\fR: \fImailto:mika@grml.org\fR using AsciiDoc\&.
+
+
+Please notice that the config framework is at an early stage of development\&. Please report bugs, wishes and feedback to the grml\-team: \fIhttp://grml.org/contact/\fR!
+
+.SH "INTRODUCTION"
+
+
+By using the config\-framework it is possible to save the configuration of a running grml system and restore it later\&. save\-config is a script to store your running configuration inside a bzip2 compressed tar archive (from now on known as the \fIconfiguration file\fR)\&. restore\-config is a script to restore a configuration using the stored configuration file\&. Several bootoptions provide additional features\&. If you do not know where to start just take a look at the available options and read the section usage scenarios\&.
+
+.RS
+.Sh "Tip"
+
+
+The generated configuration archives are plain bzip2 compressed tar archives\&. All the files are generated starting from the root\-directory \fI/\fR so it is easy to handle\&. You can generate configuration archives manually as well, save\-config is just a frontend which should make it easier to use\&.
+
+.RE
+
+.SH "AUTOCONFIGURATION"
+
+
+By default the booting process tries to mount a device labeled \fIGRMLCFG\fR\&. This provides the possibility to restore a configuration (named config\&.tbz) and execute a script (named grml\&.sh) without the need to specify any bootparams\&. If you want to disable this feature please take a look at the \fInoautoconfig\fR bootparam\&.
+
+.SH "BOOT OPTIONS"
+
+
+As you probably know you can adjust boot parameters on the bootprompt\&. You want to set some boot options permanently? That's possible via adding a directory named \fIbootparams\fR to the grml\-ISO which has to be located at /cdrom/bootparams/ afterwards\&. Place a textfile inside the directory containing the bootoptions which should be appended to default ones (this corresponds to booting without any special options)\&. If you want to be able to boot from your grml\-CD you have to create a multisession CD\&. See the usage scenarios for more details how to use it\&.
+
+.SH "SCRIPTS"
+
+.SS "save-config - save configuration"
+
+
+This script generates a plain bzip2 compressed tar archive containing the specified files\&. The following options are supported for specifying which parts should be saved in the configuration file:
+
+.nf
+\-home store hidden files from $HOME ($HOME/\&.*)
+\-etc store modified files from /etc
+\-configdir store $HOME/config
+\-all store all configuration files (:= \-home, \-configdir and \-etc)
+.fi
+
+.RS
+.Sh "Tip"
+
+
+It is also possible to use environment variables for specifying which parts should be saved\&. Just set the corresponding variable: $SAVE_HOME, $SAVE_ETC, $SAVE_CONFIGDIR and $SAVE_ALL
+
+.RE
+
+
+The default filename of the generated configuration file is config\&.tbz\&. The following options are supported for specifying another destination of the configuration file:
+
+.nf
+\-ssh user@host:/path/to/file copy configuration via ssh/scp to remote host
+\-mail <recipient> send configuration via mail
+\-file foo_bar_config\&.tbz save configuration in specified file
+.fi
+
+
+Usage examples:
+
+.nf
+save\-config \-all => store all configuration files in config\&.tbz in current dir
+save\-config \-home \-mail devnull@grml\&.org => store $HOME/\&.* in config\&.tbz and send it via mail
+save\-config \-etc \-ssh devnull@grml\&.org:/path/ => store /etc in config\&.tbz and scp it to specified host
+save\-config \-all \-file foo\&.tbz => store all configuration files in foo\&.tbz
+SAVE_ALL=yes save\-config \-file /path/foo\&.tbz => store all configuration files in /path/foo\&.tbz
+.fi
+
+.SS "restore-config - restore configuration"
+
+
+You can restore a configuration using the bootoptions or by a script file named \fIrestore\-config\fR\&. Specify the filename of the configuration archive which should be used as a parameter\&. The following options are available to specify which parts of the archive should be extracted\&.
+
+.nf
+\-home extract hidden files from $HOME ($HOME/\&.*)
+\-etc extract modified files from /etc
+\-configdir extract $HOME/config
+.fi
+
+
+The default is to extract (restore) all files found in the archive\&.
+
+.RS
+.Sh "Tip"
+
+
+It is also possible to use environment variables for specifying which part should be restored\&. Just set the corresponding variable: $RESTORE_HOME, $RESTORE_ETC, $RESTORE_CONFIGDIR and $RESTORE_ALL
+
+.RE
+
+
+Usage examples:
+
+.nf
+restore\-config \-home foo_bar_config\&.tbz => restore configuration from file foo_bar_config\&.tbz
+restore\-config config\&.tbz => restore configuration from file config\&.tbz
+.fi
+
+.SS "mkpersistenthome - use persistent home-directory"
+
+
+You have a local partition you would like to use as your home\-directory? Just use the interactive script called \fImkpersistenthome\fR\&. It will either create a file named grml\&.img on the specified partition or create a partition using the ext2 filesystem (you can specify the option in a dialog inside the program)\&. grml\&.img is a loopback device which size you can specify manually\&. It is possible to scan through the partitions to identify the appropriate partition\&. To use a home\-directory located on your hard\-drive use the appropriate bootoption on bootprompt:
+
+.nf
+home=/dev/hda3 => use /dev/hda3 as the homepartition
+home=scan => scan through the available partitions and search for file grml\&.img
+.fi
+
+.SH "BOOT-OPTIONS"
+
+
+The following bootoptions are supported\&. Use them at the (isolinux) bootprompt as documented here\&.
+
+.TP
+myconfig
+This option is for restoring configuration using the file config\&.tbz on the specified device\&. Usage examples:
+
+.nf
+myconfig=/dev/sda1 => use file config\&.tbz from usb\-device
+myconfig=/dev/fd0 => use file config\&.tbz from floppy\-disk
+myconfig=/dev/sda1 file=config_foobar\&.tbz => use file config_foobar\&.tbz from usb\-device
+.fi
+
+.TP
+home
+This option is for setting a specific partition as home directory\&. Usage examples:
+
+.nf
+home=/dev/hda3 => use /dev/hda3 as the homepartition
+home=scan => scan through the available partitions and search
+ for file grml\&.img
+.fi
+
+.TP
+partconf
+This option mounts the specified device in read\-only mode and tries to copy all files specified in /etc/grml/partconf to the grml system\&. This provides the possibility to use the configuration of a harddisk installation\&. For example using the network configuration (which is specified in /etc/network) is possible using this bootoption\&. Usage example:
+
+.nf
+partconf=/dev/hda2 => try to mount /dev/hda2 and copy files specified
+ in /etc/grml/partconf to the booted grml system
+.fi
+
+.TP
+netconfig
+Use this option to restore configuration using wget to download a configuration file from specified destination\&. Usage example:
+
+.nf
+netconfig=server\&.tld/path/to/config\&.tbz => restore configuration using wget to download file config\&.tbz
+.fi
+
+.TP
+extract
+Extract specific directories from configuration archive\&. Notice: This bootparam is useful only with bootparams which are able to extract configuration archives\&.
+
+.nf
+extract=/home/grml => extract only /home/grml from archive
+extract=/etc => extract only /etc from archive
+extract=/home/grml/config => extract only $HOME/config from archive
+.fi
+
+.TP
+scripts
+This option can start a script located in /cdrom/scripts/\&. Usage examples:
+
+.nf
+scripts => run script /cdrom/scripts/grml\&.sh
+scripts=foobar\&.sh => run script foobar\&.sh in /cdrom/scripts/
+.fi
+
+.TP
+config
+Use this option to restore a configuration using directory /cdrom/config (located in root\-directory on a usb\-device)\&. Usage examples:
+
+.nf
+config => restore configuration using file config\&.tbz from directory /cdrom/config/
+config=config_foobar\&.tbz => restore configuration using file config_foobar\&.tbz from directory /cdrom/config/
+.fi
+
+.TP
+debs
+This options allows automatic installation of deb packages while booting\&. The debian packages have to be located in directory /cdrom/debs/\&. Usage examples:
+
+.nf
+debs => install all debian packages (suffix \&.deb) from directory /cdrom/debs/
+debs=01 => install all debian packages (suffix \&.deb) starting with 01 in the filename from directory /cdrom/debs/
+.fi
+
+.TP
+noautoconfig
+Deactivate automounting\&. By default the command \fImount\fR tries to mount a device with label \fIGRMLCFG\fR\&. If you specify the noautoconfig bootparam the automounting will be deactivated\&.
+
+.nf
+noautoconfig => disables auto mounting of label 'GRMLCFG'
+.fi
+
+.SH "USAGE SCENARIOS"
+
+.SS "Personal configuration files"
+
+
+You are a fan of the editor vim? Great\&. You probably have your own ~/\&.vimrc and want to use it on the grml system\&. You also don't like the default zsh configuration and want to use your own ~/\&.zshrc? How to procede? Copy your \&.vimrc and \&.zshrc to $HOME of user \fIgrml\fR\&. Place additional files in $HOME/config\&. Now create a configuration for your files running:
+
+.nf
+save\-config \-home \-configdir
+.fi
+
+
+Now you should have a file named config\&.tbz containing your configuration files\&. You can copy the archive to a webserver and restore it via downloading during reboot using the following commandline on bootprompt:
+
+.nf
+grml netconfig=server\&.tld/path/to/config\&.tbz
+.fi
+
+
+You don't have network access but own a floppy drive? Copy the file to a floppy disk and boot with:
+
+.nf
+grml myconfig=/dev/fd0
+.fi
+
+
+Floppy is to small or to slow? Ok, let's use a usb device:
+
+.nf
+grml myconfig=/dev/sda1
+.fi
+
+.SS "Network configuration"
+
+
+You need a specific network setup and want to use your own /etc/network/interfaces by default? Generate the configuration archive running the following command as user root:
+
+.nf
+save\-config \-etc
+.fi
+
+
+Now you should have a file named config\&.tbz containing your configuration files\&. If you want to use it with a floppy disk copy the file to a floppy and boot via using the following command on bootprompt:
+
+.nf
+grml myconfig=/dev/fd0
+.fi
+
+
+Floppy is to small or to slow? Ok, let's use a usb device:
+
+.nf
+grml myconfig=/dev/sda1
+.fi
+
+
+You do have an existing harddisk installation and want to use its configuration? Let's say the debian system is located in /dev/hda2\&. You want to use the directory /etc/network\&. This directory is activated by default in /etc/grml/partconf so we don't have to do any further work\&. We just need to activate it via using the following commandline on bootprompt:
+
+.nf
+grml partconf=/dev/hda2
+.fi