72ac5012cbda5f9a8c92df1f75a56e6a0d648f57
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 15-initsetup
1 #!/bin/bash
2 # Filename:      /etc/grml/fai/config/scripts/GRMLBASE/15-initsetup
3 # Purpose:       configure init system for the live-system
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 set -u
10 set -e
11
12 if ! [ -r $target/etc/runlevel.conf ] ; then
13    echo 'Warning: /etc/runlevel.conf does not exist...'
14    echo '... assuming we do not have file-rc, skipping 15-initsetup'
15    exit 0
16 fi
17
18 # keep a backup of the original runlevel.conf file for reference
19 # but only save it as /etc/runlevel.conf.original if it's not the
20 # according live system version, this should prevent from overriding
21 # /etc/runlevel.conf.original if re-running grml-live with -b option.
22 if ! cmp $target/etc/runlevel.conf $target/etc/runlevel.conf.livecd >/dev/null ; then
23
24    # make sure to store old backup files if they differ as well
25    if [ -r $target/etc/runlevel.conf.original ] ; then
26       if ! cmp $target/etc/runlevel.conf $target/etc/runlevel.conf.original >/dev/null ; then
27          cp $target/etc/runlevel.conf.original $target/etc/runlevel.conf.original."$(date +%Y%m%d_%k:%M:%S)"
28       fi
29    fi
30
31    cp $target/etc/runlevel.conf $target/etc/runlevel.conf.original
32 fi
33
34 # provide Grml's default file-rc configuration
35 fcopy /etc/runlevel.conf
36
37 ## END OF FILE #################################################################
38 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3