File: getty-run.postinst

package info (click to toggle)
runit 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,248 kB
  • sloc: ansic: 5,590; sh: 3,690; makefile: 385
file content (33 lines) | stat: -rwxr-xr-x 1,429 bytes parent folder | download
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
31
32
33
#!/bin/sh
set -e

if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
  #copy the template to runtime dir: this usually happens later
  #with the trigger invocation but we need the dir now to create the
  #named instance with 'cpsv p'
  mkdir -p /usr/share/runit/sv.now
  cp -a /usr/share/runit/sv/getty@default /usr/share/runit/sv.now
  # getty on console is needed on Hurd only, see #1128066
  #TODO also support this inside DPKG_ROOT
  if  [ -z "$DPKG_ROOT" ] && [ "$(uname -s)" = 'GNU' ] ; then
    if [ -d /usr/share/runit/sv.current/getty@default ]; then
      #create the getty@console instance under /etc/sv/
      if [ -e /usr/bin/cpsv ]; then
        cpsv p getty@default getty@console
      elif [ ! -d /etc/sv/getty@console ]; then
        #getty run does not depeds on runit..  copy as fallback
        cp -a /usr/share/runit/sv.now/getty@default  /etc/sv/getty@console
        rm -f /etc/sv/getty@console/supervise
        ln -s /run/runit/supervise/getty@console /etc/sv/getty@console/supervise
      fi
      rm -f /etc/sv/getty@console/down #created in prerm
      #and enable it
      if [ ! -e /etc/service/.getty@console ] && [ ! -h /etc/service/.getty@console ]; then
        if [ ! -h /etc/service/getty@console ]; then
          ln -s /etc/sv/getty@console  /etc/service/getty@console
        fi
      fi
    fi
  fi
fi
#DEBHELPER#