This file is indexed.

postinst is in sks 1.1.4-2.1ubuntu1.

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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/sh -e

# checking debian-sks account

uid=`getent passwd debian-sks | cut -d ":" -f 3`
home=`getent passwd debian-sks | cut -d ":" -f 6`

# if there is the uid the account is there and we can do
# the sanit(ar)y checks otherwise we can safely create it.

if [ "$uid" ]; then
    # guess??? the checks!!!
    if [ $uid -ge 100 ] && [ $uid -le 999 ]; then
    	echo "debian-sks uid check: ok"
    else
    	echo "ERROR: debian-sks account has a non-system uid!"
	echo "Please check /usr/share/doc/sks/README.Debian on how to"
	echo "correct this problem"
	exit 1
    fi
    if [ "$home" = "/var/lib/sks" ]; then
        echo "debian-sks homedir check: ok"
    else
	echo "ERROR: debian-sks account has an invalid home directory!"
	echo "Please check /usr/share/doc/sks/README.Debian on how to"
	echo "correct this problem"
	exit 1
    fi
else
    # what this might mean?? oh creating a system l^Huser!
    adduser --quiet \
            --system \
            --disabled-password \
            --home /var/lib/sks \
	    --no-create-home \
	    --shell /bin/bash \
	    --group \
    debian-sks
fi

if [ "$2" = "" ]; then
    # ch{owning,moding} things around
    # note that sks creates files/dirs with 600/700
    # permissions as default. so let's stick with it for the
    # installation. We will do nothing across upgrades.
    for i in lib log spool; do
	chown -R debian-sks:debian-sks /var/$i/sks
	chmod -R 700 /var/$i/sks
	find /var/$i/sks -type f -exec chmod 600 '{}' ';'
    done
    chgrp -R adm /var/log/sks
    chmod -R g+rX /var/log/sks
    chmod    g+s  /var/log/sks
else
    if [ "$1" = "configure" ]; then
	# fix permissions of logs after 1.0.9-0.1
	if dpkg --compare-versions "$2" lt "1.0.9-0.2" ; then
	    chgrp -R adm /var/log/sks
	    chmod -R g+rX /var/log/sks
	    chmod    g+s  /var/log/sks
	fi
	# 1.0.10 renamed log files from /var/log/sks/sks.foo.log to /var/log/sks/foo.log,
	# so be nice and rename things for the admin.
	if dpkg --compare-versions "$2" lt "1.0.10" ; then
	    for i in `ls -1 /var/log/sks/`; do
		if echo "$i" | grep -q '^sks\.'; then
		    mv /var/log/sks/"$i" /var/log/sks/`echo "$i" | sed -e 's/^sks.//'`
		fi
	    done
	fi

	# Read the active Berkeley DB version, fall back to 4.7 if not found
	if [ -r /var/lib/sks/berkeley_db.active ]; then
	    OLD_BDB=$(cat /var/lib/sks/berkeley_db.active)
	else
	    if (type dpkg-vendor >/dev/null && dpkg-vendor --derives-from Ubuntu) || \
			[ -e /etc/dpkg/origins/ubuntu ]; then
		if dpkg --compare-versions "$2" lt "1.1.1+dpkgv3-6.1"; then
		    OLD_BDB=4.7
		else
		    OLD_BDB=5.1
		fi
	    else # Debian
		if dpkg --compare-versions "$2" lt "1.1.1+dpkgv3-1"; then
		    OLD_BDB=4.6
		elif dpkg --compare-versions "$2" lt "1.1.1+dpkgv3-6.1"; then
		    OLD_BDB=4.7
		else
		    OLD_BDB=4.7
		fi
	    fi
	fi

	# Read the compiled-in Berkeley DB version
	NEW_BDB=$(cat /usr/lib/sks/berkeley_db.txt)

	if [ "$OLD_BDB" != "$NEW_BDB" ]; then

	# Upgrade Berkeley DB in place
	BACKUP_DIR=/var/backup/sks/$(date +%Y%m%d-%H%M%S)
	SKS_DIR=/var/lib/sks
	mkdir -p $BACKUP_DIR
	chown debian-sks:debian-sks ${BACKUP_DIR}

	for DBHOME in DB PTree; do

	    # Don't run if the database directory doesn't exist
	    [ ! -d ${SKS_DIR}/${DBHOME} ] && continue

	    # Create backup directory
	    mkdir -p ${BACKUP_DIR}/${DBHOME}
	    chown debian-sks:debian-sks ${BACKUP_DIR}/${DBHOME}

	    # Make sure we own the files
	    chown debian-sks:debian-sks -R ${SKS_DIR}/${DBHOME}

	    if [ -x /usr/bin/db${OLD_BDB}_recover ]; then
	        # Run recover with old tools
		su debian-sks -c "db${OLD_BDB}_recover -h ${SKS_DIR}/${DBHOME}"
	        # Backup needed log files
		LOG_FILES=$(su debian-sks -c "db${OLD_BDB}_archive -h ${SKS_DIR}/${DBHOME} -l")
	    else
		# If we don't have the Berkeley DB tools then backup all log files
		LOG_FILES=$(cd ${SKS_DIR}/${DBHOME}; ls -1 | grep -E "^log\.")
	    fi

	    # Backup log files
	    for log_file in ${LOG_FILES}; do
		cp -a ${SKS_DIR}/${DBHOME}/$log_file ${BACKUP_DIR}/${DBHOME}/
	    done

            if [ -e "${SKS_DIR}/${DBHOME}/DB_CONFIG" ]; then
                cp -a ${SKS_DIR}/${DBHOME}/DB_CONFIG ${BACKUP_DIR}/${DBHOME}/
            fi

	    # Backup & upgrade database files
	    for db in $(cd ${SKS_DIR}/${DBHOME}; ls -1 | grep -Ev "^(__|log\.|DB_CONFIG$)"); do
		# Backup database file
		su debian-sks -c "cp ${SKS_DIR}/${DBHOME}/${db} ${BACKUP_DIR}/${DBHOME}/"
		# Upgrade database file
    		su debian-sks -c "db${NEW_BDB}_upgrade -h ${SKS_DIR}/${DBHOME} ${SKS_DIR}/${DBHOME}/$db";
	    done
    
	    # Set checkpoint and delete old logfiles
	    su debian-sks -c "db${NEW_BDB}_checkpoint -h ${SKS_DIR}/${DBHOME} -1"
	    su debian-sks -c "db${NEW_BDB}_archive -h ${SKS_DIR}/${DBHOME} -d"
	done

	# Note the active Berkeley DB version
	cp -f /usr/lib/sks/berkeley_db.txt /var/lib/sks/berkeley_db.active

	elif [ ! -e /var/lib/sks/berkeley_db.active ]; then
	    cp -f /usr/lib/sks/berkeley_db.txt /var/lib/sks/berkeley_db.active
	fi
    fi
fi

# Automatically added by dh_installinit
if [ -x "/etc/init.d/sks" ] || [ -e "/etc/init/sks.conf" ]; then
	if [ ! -e "/etc/init/sks.conf" ]; then
		update-rc.d sks defaults >/dev/null
	fi
	invoke-rc.d sks start || exit $?
fi
# End automatically added section


exit 0