File: postinst

package info (click to toggle)
ifupdown 0.8.44
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 952 kB
  • sloc: ansic: 2,781; sh: 899; perl: 513; makefile: 90
file content (30 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e

MYNAME="${0##*/}"

report() { echo "${MYNAME}: $*" ; }
report_warn() { report "Warning: $*" >&2 ; }
report_err() { report "Error: $*" >&2 ; }

if [ "$1" = configure ]; then
  addgroup --quiet --system netdev || true
fi

# Generic stuff done on all configurations
if [ "$1" = "configure" ] ; then
  # We don't need loopback interface definition anymore as
  # ifupdown handles loopback interface on its own from now
  if [ ! -f /etc/network/interfaces ] ; then
    if [ -z "$2" ]; then
      echo "Creating /etc/network/interfaces."
      echo "# interfaces(5) file used by ifup(8) and ifdown(8)" > /etc/network/interfaces
      echo "# Include files from /etc/network/interfaces.d:" >> /etc/network/interfaces
      echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
    else
      report_warn "/etc/network/interfaces does not exist"
    fi
  fi
fi

#DEBHELPER#