This file is indexed.

postinst is in dpm-server-postgres 1.8.7-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
#!/bin/sh

set -e

updatedpm () {
    [ -r /etc/default/dpm ] && . /etc/default/dpm
    [ -z "$DPMCONFIGFILE" ] && DPMCONFIGFILE=/etc/DPMCONFIG
    [ -r $DPMCONFIGFILE ] || return 0

    dpmcfg=$(cat $DPMCONFIGFILE)

    cfg1=$(echo $dpmcfg | cut -f1 -d@)
    cfg2=$(echo $dpmcfg | cut -f2 -d@ -s)

    user=$(echo $cfg1 | cut -f1 -d/)
    passwd=$(echo $cfg1 | cut -f2 -d/ -s)
    host=$(echo $cfg2 | cut -f1 -d/)
    db=$(echo $cfg2 | cut -f2 -d/ -s)

    [ -z "$user" ] && return 0
    [ -z "$passwd" ] && return 0
    [ -z "$host" ] && return 0
    [ -z "$db" ] && db=dpm_db

    export PGPASSWORD=$passwd
    psql="psql -t -q -U $user $db"

    vmajor=$($psql -c "select major from schema_version_dpm" 2>/dev/null)
    vminor=$($psql -c "select minor from schema_version_dpm" 2>/dev/null)
    vpatch=$($psql -c "select patch from schema_version_dpm" 2>/dev/null)

    if [ -z "$vmajor" -o -z "$vminor" -o -z "$vpatch" ] ; then
	return 0
    fi

    if [ $vmajor -eq 3 -a $vminor -eq 2 -a $vpatch -eq 0 ] ; then
	$psql <<-EOF
	ALTER TABLE dpm_fs ADD weight INTEGER;
	UPDATE dpm_fs SET weight = 1;
	UPDATE schema_version_dpm SET major = 3, minor = 3, patch = 0;
	EOF
    fi

    return 0
}

getent group dpmmgr > /dev/null || \
    addgroup --quiet --system dpmmgr

getent passwd dpmmgr > /dev/null || \
    adduser --quiet --system --home /var/lib/dpm --shell /bin/sh \
    --ingroup dpmmgr --disabled-password --disabled-login \
    --gecos "DPM manager" dpmmgr

chown dpmmgr:dpmmgr /var/lib/dpm

chown dpmmgr:dpmmgr /var/log/dpm

updatedpm

update-alternatives --install /usr/sbin/dpm dpm \
          /usr/lib/dpm-postgres/dpm 10 \
  --slave /usr/share/man/man8/dpm.8.gz dpm.8.gz \
          /usr/lib/dpm-postgres/dpm.8.gz \
  --slave /usr/share/lcgdm/DPMCONFIG.templ DPMCONFIG.templ \
          /usr/lib/dpm-postgres/DPMCONFIG.templ \
  --slave /etc/init.d/dpm dpm.init \
          /etc/dpm-postgres/dpm.init \
  --slave /etc/default/dpm dpm.conf \
          /etc/dpm-postgres/dpm.conf \
  --slave /etc/logrotate.d/dpm dpm.logrotate \
          /etc/dpm-postgres/dpm.logrotate \
  --slave /usr/sbin/dpm-shutdown dpm-shutdown \
          /usr/lib/dpm-postgres/dpm-shutdown \
  --slave /usr/share/man/man8/dpm-shutdown.8.gz dpm-shutdown.8.gz \
          /usr/lib/dpm-postgres/dpm-shutdown.8.gz \
  --slave /usr/sbin/dpm-buildfsv dpm-buildfsv \
          /usr/lib/dpm-postgres/dpm-buildfsv \
  --slave /usr/share/man/man8/dpm-buildfsv.8.gz dpm-buildfsv.8.gz \
          /usr/lib/dpm-postgres/dpm-buildfsv.8.gz

if [ -x "/etc/init.d/dpm" ]; then
	update-rc.d dpm defaults >/dev/null
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d dpm start || exit $?
	else
		/etc/init.d/dpm start || exit $?
	fi
fi