This file is indexed.

postinst is in nodm 0.13-1.3.

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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#! /bin/sh
# postinst script for nodm, partially based on gdm3.postinst

set -e

THIS_PACKAGE=nodm
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager

. /usr/share/debconf/confmodule

# debconf is not a registry, so we only fiddle with the default file if
# the configure script requested an update
if [ -e $DEFAULT_DISPLAY_MANAGER_FILE.debconf-update ]; then
  rm -f $DEFAULT_DISPLAY_MANAGER_FILE.debconf-update
  if db_get shared/default-x-display-manager; then
    # workaround debconf passthru bug (#379198)
    if [ -z "$RET" ]; then
      RET="$THIS_PACKAGE"
    fi
    if [ "$THIS_PACKAGE" != "$RET" ]; then
      echo "Please be sure to run \"dpkg --configure $RET\"." >&2
    fi
    if db_get "$RET"/daemon_name; then
      echo "$RET" > $DEFAULT_DISPLAY_MANAGER_FILE
    fi
  fi
fi

DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
# set default-display-manager systemd service link according to our config
if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
  if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
    SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
    if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = /dev/null ]; then
      echo "Display manager service is masked" >&2
    elif [ -e "$SERVICE" ]; then
      ln -sf "$SERVICE" "$DEFAULT_SERVICE"
    else
      echo "WARNING: $SERVICE is the selected default display manager but does not exist" >&2
      rm -f "$DEFAULT_SERVICE"
    fi
  else
    rm -f "$DEFAULT_SERVICE"
  fi
fi

if [ "$1" = "configure" ] ; then
	if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.2"; then
		# Before version 0.2, nodm was only used on the OpenMoko.  To
		# guarantee a smooth upgrade, we can safely override debconf here
		# using the openmoko parameters.
		db_set nodm/enabled true
		db_set nodm/first_vt "3"
		db_set nodm/x_options "-nolisten tcp"
	fi
	if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.5"; then
		# Add the NODM_FIRST_VT entry to the config file if it is missing
		if [ -s /etc/default/nodm ] && ! grep -q NODM_FIRST_VT /etc/default/nodm
		then
			cat <<EOF >> /etc/default/nodm

# First vt to try when looking for free VTs
NODM_FIRST_VT=7
EOF
		fi
	fi

	# Update /etc/default/nodm
	db_get nodm/enabled
	NODM_ENABLED="$RET"
	db_get nodm/user
	NODM_USER="$RET"
	db_get nodm/first_vt
	NODM_FIRST_VT="$RET"
	db_get nodm/x_options
	NODM_X_OPTIONS="$RET"
	db_get nodm/min_session_time
	NODM_MIN_SESSION_TIME="$RET"
	db_get nodm/xsession
	NODM_XSESSION="$RET"
	db_get nodm/x_timeout
	NODM_X_TIMEOUT="$RET"

	if [ -s /etc/default/nodm ] ; then
		sed -i -r -e "s,^NODM_ENABLED=.*,NODM_ENABLED=$NODM_ENABLED," \
			-e "s,^NODM_USER=.*,NODM_USER=$NODM_USER," \
			-e "s,^NODM_FIRST_VT=.*,NODM_FIRST_VT='$NODM_FIRST_VT'," \
			-e "s,^NODM_X_OPTIONS=.*,NODM_X_OPTIONS='$NODM_X_OPTIONS'," \
			-e "s,^NODM_MIN_SESSION_TIME=.*,NODM_MIN_SESSION_TIME=$NODM_MIN_SESSION_TIME," \
			-e "s,^NODM_XSESSION=.*,NODM_XSESSION=$NODM_XSESSION," \
			-e "s,^NODM_X_TIMEOUT=.*,NODM_X_TIMEOUT=$NODM_X_TIMEOUT," \
			/etc/default/nodm
	else
		cat <<EOF > /etc/default/nodm
# nodm configuration

# Set NODM_ENABLED to something different than 'false' to enable nodm
NODM_ENABLED=$NODM_ENABLED

# User to autologin for
NODM_USER=$NODM_USER

# First vt to try when looking for free VTs
NODM_FIRST_VT=$NODM_FIRST_VT

# X session
NODM_XSESSION=$NODM_XSESSION

# Options for nodm itself
NODM_OPTIONS=

# Options for the X server.
#
# Format: [/usr/bin/<Xserver>] [:<disp>] <Xserver-options>
#
# The Xserver executable and the display name can be omitted, but should
# be placed in front, if nodm's defaults shall be overridden.
NODM_X_OPTIONS='$NODM_X_OPTIONS'

# If an X session will run for less than this time in seconds, nodm will wait an
# increasing bit of time before restarting the session.
NODM_MIN_SESSION_TIME=$NODM_MIN_SESSION_TIME

# Timeout (in seconds) to wait for X to be ready to accept connections. If X is
# not ready before this timeout, it is killed and restarted.
NODM_X_TIMEOUT=$NODM_X_TIMEOUT
EOF
	fi
fi

# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
	if [ -x "/etc/init.d/nodm" ]; then
		update-rc.d nodm defaults >/dev/null
		invoke-rc.d nodm start || exit $?
	fi
fi
# End automatically added section


# tell debconf we are done. otherwise, it hangs waiting for the daemon.
db_stop;

exit 0