summaryrefslogtreecommitdiff
path: root/mk/pkginstall/install
blob: 45c79319db4c214bb71663d1336740655b2d20b5 (plain)
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
# $NetBSD: install,v 1.2 2007/07/18 18:01:03 jlam Exp $

case ${STAGE} in
PRE-INSTALL)
	#
	# Unpack the helper scriptlets.
	#
	${SH} ${SELF} ${PKGNAME} UNPACK
	#
	# Require that necessary users and groups exist or else fail the
	# installation of the package.
	#
	${TEST} ! -x ./+USERGROUP ||
		{ ./+USERGROUP ADD ${PKG_METADATA_DIR}
		  if ./+USERGROUP CHECK-ADD ${PKG_METADATA_DIR}; then
			:
		  else
			exit 1
		  fi; }
	#
	# Create package directories at pre-install time.
	#
	if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a			\
	     "${_PKG_CONFIG}" = "yes" -a -n "${CONF_DEPENDS}" ]; then
		pkg=`${PKG_ADMIN} -b -d ${DEPOTBASE} -s "" lsbest "${CONF_DEPENDS}"`
		sysconfdir=`${PKG_INFO} -B -K ${DEPOTBASE} $pkg |	\
			${AWK} '/^PKG_SYSCONFDIR=/ {			\
				gsub("^PKG_SYSCONFDIR=[ 	]*", ""); \
				print;					\
			}'						\
		`
		if [ -d $sysconfdir -a ! -d ${PKG_SYSCONFDIR} ]; then
			${MKDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}`
			${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
		fi
	fi
	${TEST} ! -x ./+DIRS ||
		./+DIRS ADD ${PKG_METADATA_DIR}
	${TEST} ! -x ./+DIRS ||
		./+DIRS PERMS ${PKG_METADATA_DIR}
        ;;

POST-INSTALL)
	#
	# Rebuild the system run-time library search path database.
	#
	${TEST} ! -x ./+SHLIBS ||
		./+SHLIBS ADD ${PKG_METADATA_DIR}
	#
	# Copy configuration/support files into place.
	#
        ${TEST} ! -x ./+FILES ||
		./+FILES ADD ${PKG_METADATA_DIR}
        ${TEST} ! -x ./+FILES ||
		./+FILES PERMS ${PKG_METADATA_DIR}
	#
	# Set special permissions on any files/directories that need them.
	#
	${TEST} ! -x ./+PERMS ||
		./+PERMS ${PKG_METADATA_DIR}
	#
	# Update any fonts databases.
	#
	${TEST} ! -x ./+FONTS ||
		./+FONTS ${PKG_METADATA_DIR}

	# Check for any missing bits after we're finished installing.
	#
	${TEST} ! -x ./+DIRS ||
		./+DIRS CHECK-ADD ${PKG_METADATA_DIR}
	${TEST} ! -x ./+DIRS ||
		./+DIRS CHECK-PERMS ${PKG_METADATA_DIR}
	${TEST} ! -x ./+FILES ||
		./+FILES CHECK-ADD ${PKG_METADATA_DIR}
	${TEST} ! -x ./+FILES ||
		./+FILES CHECK-PERMS ${PKG_METADATA_DIR}
	;;

VIEW-INSTALL)
	#
	# Register shells in /etc/shells.
	#
	${TEST} ! -x ./+SHELL ||
		./+SHELL ADD ${PKG_METADATA_DIR}
	${TEST} ! -x ./+SHELL ||
		./+SHELL CHECK-ADD ${PKG_METADATA_DIR}
	#
	# Register info files.
	#
	${TEST} ! -x ./+INFO_FILES ||
		./+INFO_FILES ADD ${PKG_METADATA_DIR}

	# If ${PKG_SYSCONFBASE} points outside of ${PREFIX}, then add the
	# package config files to the proper view.
	#
	if [ "${_PKG_CONFIG}" = "yes" -a -n "${PKG_SYSCONFDEPOTBASE}" ]; then
		${SETENV} PLIST_IGNORE_FILES="${CONF_IGNORE_FILES}" \
			${LINKFARM} -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
	fi
	;;
esac