Unifiy local config handling
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 37-portmap
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/37-portmap
3 # Purpose:       configure portmap of 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 [ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
13 [ -n "$GRML_LIVE_LOCAL_CONFIG" ] && . "$GRML_LIVE_LOCAL_CONFIG"
14
15 # Work around a bug in the portmap package, see
16 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=317358
17
18 CONFFILE="$target/etc/default/portmap"
19
20 # modify only if the file is present, nowadays we have rpcbind
21 if [ -r "$CONFFILE" ] ; then
22  # modify it iff we have portmap's default configuration
23  if grep -q '^OPTIONS="-i 127.0.0.1"' "$CONFFILE" ; then
24    # disable the "-i 127.0.0.1" configuration so it works e.g. with
25    # grml-terminalserver OOTB:
26    printf "Removing loopback-interface-only option (workaround #317358) in /etc/default/portmap: "
27    sed -i 's/^OPTIONS.*/# OPTIONS="-i 127.0.0.1"/' "$CONFFILE" && echo OK || echo ERROR
28  fi
29 fi
30
31 ## END OF FILE #################################################################
32 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2