File: slapd.postinst

package info (click to toggle)
openldap 2.4.11-1%2Blenny2.1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 23,116 kB
  • ctags: 18,785
  • sloc: ansic: 243,312; sh: 40,522; cpp: 5,726; makefile: 1,896; sql: 1,714; xml: 595; perl: 540; tcl: 45
file content (88 lines) | stat: -rw-r--r-- 2,095 bytes parent folder | download
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
#! /bin/sh 

set -e

. /usr/share/debconf/confmodule

# This will be replaced with debian/slapd.scripts-common which includes
# various helper functions and $OLD_VERSION and $SLAPD_CONF
#SCRIPTSCOMMON#

postinst_initial_configuration() {					# {{{
# Configure slapd for the first time (when first installed)
# Usage: postinst_initial_configuration

	if manual_configuration_wanted; then
		echo "  Omitting slapd configuration as requested." >&2
	else
		create_new_configuration
		configure_v2_protocol_support
	fi
}

# }}}
postinst_upgrade_configuration() {					# {{{
# Handle upgrading slapd from some older version
# Usage: postinst_upgrade_configuration

	# Better back up the config file in any case
	echo -n "  Backing up $SLAPD_CONF in `database_dumping_destdir`... " >&2
	backup_config_once
	echo done. >&2

	configure_v2_protocol_support

	if previous_version_older 2.4.7-4; then
		if ! migrate_checkpoint_and_slurpd; then
			db_input critical slapd/slurpd_obsolete || true
			db_go || true
		fi
		config_obsolete_schemacheck
	fi

	if previous_version_older 2.4.7-5; then
		if ! disable_openssl_cipher_suite; then
			db_input critical slapd/tlsciphersuite || true
			db_go || true
		fi
	fi

	if database_format_changed; then
		# During upgrading we have to load the old data
		move_incompatible_databases_away
		load_databases
	fi

	# Update permissions of all database directories and /var/run/slapd
	update_databases_permissions
	update_permissions /var/run/slapd

	# Versions prior to 2.4.7-1 could create a slapd.conf that wasn't
	# readable by the openldap user.
	update_slapd_conf_permissions
}

# }}}

# Create a new user.  Don't create the user, however, if the local
# administrator has already customized slapd to run as a different user.
if [ "$MODE" = "configure" ] || [ "$MODE" = "reconfigure" ] ; then
	if [ "openldap" = "$SLAPD_USER" ] ; then
		create_new_user
	fi
fi

# Configuration.
if is_initial_configuration "$@"; then
	postinst_initial_configuration
else
	postinst_upgrade_configuration
fi

db_stop || true

#DEBHELPER#

exit 0

# vim: set sw=8 foldmethod=marker: