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