This file is indexed.

postinst is in nuauth 2.4.3-2.1build1.

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
#!/bin/sh
CONFIGFILE1=/etc/default/nuauth
CONFIGFILE2=/etc/nufw/nuauth.conf
set -e
. /usr/share/debconf/confmodule

grepconf () {
        w=" 	" # space tab
        sq=/etc/nufw/nuauth.conf
        # sed is cool.
        res=`sed -ne '
                s/^\s*'$1'\s*=\s*"\?\([^"]*\)\"$/\1/p;
                t end;
                d;
                :end q' < $sq`
        [ -n "$res" ] || res=$2
        echo "$res"
}

grepdefault () {
        w=" 	" # space tab
        sq=/etc/default/nuauth
        # sed is cool.
        res=`sed -ne '
                s/^\s*'$1'\s*=\s*"\?\([^"]*\)\"$/\1/p;
                t end;
                d;
                :end q' < $sq`
        [ -n "$res" ] || res=$2
        echo "$res"
}

replace_file () {
    newfile=$1
    oldfile=$2
    if [ ! -f ${oldfile} ] ; then
      mv ${newfile} ${oldfile}
    else
      ucf --three-way --debconf-ok ${newfile} ${oldfile}
    fi
}

# Installing the config
replace_file /usr/share/nuauth/nuauth.conf /etc/nufw/nuauth.conf
#ucf --three-way --debconf-ok /usr/share/nuauth/nuauth.conf /etc/nufw/nuauth.conf

for file in `find /usr/share/nuauth/nuauth.d -type f`; do
    shortname=`basename $file`
    replace_file /usr/share/nuauth/nuauth.d/$shortname /etc/nufw/nuauth.d/$shortname
    #ucf --three-way --debconf-ok /usr/share/nuauth/nuauth.d/$shortname /etc/nufw/nuauth.d/$shortname
done

NUAUTH_USER=`grepdefault NUAUTH_USER nobody`
nuauth_tls_key=`grepconf nuauth_tls_key /etc/nufw/certs/nuauth-key.pem`
nuauth_tls_cert=`grepconf nuauth_tls_cert /etc/nufw/certs/nuauth-cert.pem`
nuauth_tls_dh_params=`grepconf nuauth_tls_dh_params /etc/nufw/certs/nuauth-dh_params.pem`

if ! grep -q -e "^$NUAUTH_USER:" /etc/passwd
then
  echo "FATAL : User \"$NUAUTH_USER\" does not exist, but is supposed to run nuauth"
  exit -1
fi


# ssl certificate generation
if [ -x /usr/bin/openssl ]; then
  if [ ! -e $nuauth_tls_key ]; then

    make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/nufw/certs/nuauth.pem

    if [ -f /etc/nufw/certs/nuauth.pem ]; then
      # split key and certificate data
      openssl x509 -in /etc/nufw/certs/nuauth.pem -out $nuauth_tls_cert
      openssl rsa  -in /etc/nufw/certs/nuauth.pem -out $nuauth_tls_key
      chmod 0600 $nuauth_tls_key
      chown $NUAUTH_USER $nuauth_tls_key
      rm -f /etc/nufw/certs/nuauth.pem
      find /etc/nufw/certs -type l -maxdepth 1 -delete
    fi
  fi
  if [ ! -e $nuauth_tls_dh_params ]; then
      # generate DH parameters, defaults to 1024 bits
      openssl dhparam -out $nuauth_tls_dh_params 1024
      chown $NUAUTH_USER $nuauth_tls_dh_params
  fi
fi

db_stop

# Automatically added by dh_installinit
if [ -x "/etc/init.d/nuauth" ]; then
	if [ ! -e "/etc/init/nuauth.conf" ]; then
		update-rc.d nuauth start 40 2 3 4 5 . stop 89 0 1 6 . >/dev/null
	fi
	invoke-rc.d nuauth start || exit $?
fi
# End automatically added section


exit 0