This file is indexed.

postinst is in initramfs-tools-tcos 0.89.93ubuntu2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
set -e

# create tcos group if not exists
if ! getent group tcos >/dev/null; then
  addgroup --quiet --system tcos || true
fi

# make sure that tcos.conf is not all readable
chmod -f 644 /etc/tcos/tcos.conf
chown -f root:tcos /etc/tcos/tcos.conf

chmod -f 775 /var/lib/tcos/tftp/pxelinux.cfg
chown -f -R root:tcos /var/lib/tcos/tftp/pxelinux.cfg
chmod -f -R 664 /var/lib/tcos/tftp/pxelinux.cfg/* 2>/dev/null || true

chown -f -R root:tcos /etc/tcos/secrets
chmod -f 755 /etc/tcos/secrets
chmod -f -R 640 /etc/tcos/secrets/* 2>/dev/null || true

if [ -d /etc/tcos/templates ];then
   chown -f -R root:tcos /etc/tcos/templates
   chmod -f 775 /etc/tcos/templates
   chmod -f -R 640 /etc/tcos/templates/tcos* 2>/dev/null || true
fi

# create file
[ ! -e /etc/tcos/modules ] && touch /etc/tcos/modules

# obsolete file, moved to tcos-core:/var/lib/tcos/version.conf
[ -e /etc/tcos/version.conf ] && rm -f /etc/tcos/version.conf

# FIXME, now tftp is /srv/tftp
TFTPBOOT_DEFAULT=/var/lib/tftpboot
TFTPBOOT=


read_inetd() {
    # read tftpboot dir from inetd.conf
    if [ -f /etc/inetd.conf ]; then
      # get last word of tftp file

      tmp=$(awk '/^tftp/ {print $NF}' /etc/inetd.conf 2>/dev/null)
        if [ -d "${tmp}" ]; then
         TFTPBOOT=${tmp}
        fi
    fi
}

read_dnsmasq() {
    # read tftp-root var from /etc/dnsmasq.conf
    if [ -f /etc/dnsmasq.conf ]; then

      tmp=$(awk -F'=' '/^tftp-root/ {print $2}' /etc/dnsmasq.conf 2>/dev/null)
        if [ -d "${tmp}" ]; then
         TFTPBOOT=${tmp}
        fi
    fi
}

read_from_conf() {
    #$1 is conf file
    if [ -f "$1" ]; then
      for txt in $(grep OPTIONS "$1" ); do
        if [ $(echo $txt |grep -c "/" ) = 1 ]; then
         TFTPBOOT=$(echo $txt| sed s/"\""/""/g)
        fi
      done
    fi
}

#
# First we try to read from dnsmasq, second inetd and third conf file
#

read_dnsmasq

if [ -z "$TFTPBOOT" ]; then
    # read from inetd
    read_inetd
fi

if [ -z "$TFTPBOOT" ]; then
    # try with conf files
    read_from_conf "/etc/default/atftpd"
fi


if [ -z "${TFTPBOOT}" ]; then
  TFTPBOOT=$TFTPBOOT_DEFAULT
  echo " * Using $TFTPBOOT_DEFAULT dir as TFTP root dir"
fi

if [ ! -d ${TFTPBOOT} ]; then
   # create dir
   mkdir -p "${TFTPBOOT}"
   echo " * Created $TFTPBOOT dir as TFTP root dir"
fi

if [ ! -L ${TFTPBOOT}/tcos ]; then
  rm -rf ${TFTPBOOT}/tcos
fi

# make symlink
if [ ! -e ${TFTPBOOT}/tcos ]; then
  ln -s /var/lib/tcos/tftp ${TFTPBOOT}/tcos
fi


[ ! -e /var/lib/tcos/tftp/conf ] && mkdir -p /var/lib/tcos/tftp/conf
chown -f -R root:tcos /var/lib/tcos/tftp/conf
chmod -f 775 /var/lib/tcos/tftp/conf
chmod -f -R 664 /var/lib/tcos/tftp/conf/*  2>/dev/null || true