xref: /freebsd/release/scripts/pkg-stage.sh (revision f5147e312f43a9050468de539aeafa072caa1a60)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6set -e
7
8export ASSUME_ALWAYS_YES="YES"
9export PKG_DBDIR="/tmp/pkg"
10export PERMISSIVE="YES"
11export REPO_AUTOUPDATE="NO"
12export PKGCMD="/usr/sbin/pkg -d"
13export PORTSDIR="${PORTSDIR:-/usr/ports}"
14
15_DVD_PACKAGES="archivers/unzip
16devel/subversion
17devel/subversion-static
18emulators/linux_base-c6
19misc/freebsd-doc-all
20net/mpd5
21net/rsync
22ports-mgmt/pkg
23ports-mgmt/portmaster
24shells/bash
25shells/zsh
26security/sudo
27sysutils/screen
28sysutils/tmux
29www/firefox
30www/links
31x11-drivers/xf86-video-vmware
32x11/gnome3
33x11/kde4
34x11/xorg"
35
36# If NOPORTS is set for the release, do not attempt to build pkg(8).
37if [ ! -f ${PORTSDIR}/Makefile ]; then
38	echo "*** ${PORTSDIR} is missing!    ***"
39	echo "*** Skipping pkg-stage.sh     ***"
40	echo "*** Unset NOPORTS to fix this ***"
41	exit 0
42fi
43
44if [ ! -x /usr/local/sbin/pkg ]; then
45	/etc/rc.d/ldconfig restart
46	/usr/bin/make -C ${PORTSDIR}/ports-mgmt/pkg install clean
47fi
48
49export DVD_DIR="dvd/packages"
50export PKG_ABI=$(pkg config ABI)
51export PKG_ALTABI=$(pkg config ALTABI 2>/dev/null)
52export PKG_REPODIR="${DVD_DIR}/${PKG_ABI}"
53
54/bin/mkdir -p ${PKG_REPODIR}
55if [ ! -z "${PKG_ALTABI}" ]; then
56	(cd ${DVD_DIR} && ln -s ${PKG_ABI} ${PKG_ALTABI})
57fi
58
59# Ensure the ports listed in _DVD_PACKAGES exist to sanitize the
60# final list.
61for _P in ${_DVD_PACKAGES}; do
62	if [ -d "${PORTSDIR}/${_P}" ]; then
63		DVD_PACKAGES="${DVD_PACKAGES} ${_P}"
64	else
65		echo "*** Skipping nonexistent port: ${_P}"
66	fi
67done
68
69# Make sure the package list is not empty.
70if [ -z "${DVD_PACKAGES}" ]; then
71	echo "*** The package list is empty."
72	echo "*** Something is very wrong."
73	# Exit '0' so the rest of the build process continues
74	# so other issues (if any) can be addressed as well.
75	exit 0
76fi
77
78# Print pkg(8) information to make debugging easier.
79${PKGCMD} -vv
80${PKGCMD} update -f
81${PKGCMD} fetch -o ${PKG_REPODIR} -d ${DVD_PACKAGES}
82
83# Create the 'Latest/pkg.txz' symlink so 'pkg bootstrap' works
84# using the on-disc packages.
85mkdir -p ${PKG_REPODIR}/Latest
86(cd ${PKG_REPODIR}/Latest && \
87	ln -s ../All/$(${PKGCMD} rquery %n-%v pkg).txz pkg.txz)
88
89${PKGCMD} repo ${PKG_REPODIR}
90
91# Always exit '0', even if pkg(8) complains about conflicts.
92exit 0
93