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