summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_install.subr
blob: fda38e5a04d832641c77dfe906697e61219d37f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# set -o errexit -o noglob are assumed.
#

pkg_install() {
	ex_rtl_fileop mkdir "${PKG_PREFIX}";
	find "${PKG_DESTDIR}"				\
		-type d -exec chmod 0700 {} \;;
	find "${PKG_DESTDIR}"				\
		\( -perm -0400 \) -and			\
		\( -not -perm /0100 \)			\
		-type f -exec chmod 0600 {} \;;
	find "${PKG_DESTDIR}"				\
		-perm /0100 -type f -exec chmod 0700 {} \;;
	tar -C "${PKG_DESTDIR}" -cpf - .		|\
		tar -C "${PKG_PREFIX}" --overwrite -xpf -;
	if [ "${ARG_PACKAGE:-0}" -eq 1 ]; then
		tar -C "${PKG_DESTDIR}" -cpf - .	|\
			gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz"
	fi;
};

# vim:filetype=sh