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/git 17emulators/linux_base-c7 18graphics/drm-legacy-kmod 19graphics/drm-stable-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/xorg" 36 37# If NOPORTS is set for the release, do not attempt to build pkg(8). 38if [ ! -f ${PORTSDIR}/Makefile ]; then 39 echo "*** ${PORTSDIR} is missing! ***" 40 echo "*** Skipping pkg-stage.sh ***" 41 echo "*** Unset NOPORTS to fix this ***" 42 exit 0 43fi 44 45if [ ! -x /usr/local/sbin/pkg ]; then 46 /etc/rc.d/ldconfig restart 47 /usr/bin/make -C ${PORTSDIR}/ports-mgmt/pkg install clean 48fi 49 50export DVD_DIR="dvd/packages" 51export PKG_ABI=$(pkg config ABI) 52export PKG_ALTABI=$(pkg config ALTABI 2>/dev/null) 53export PKG_REPODIR="${DVD_DIR}/${PKG_ABI}" 54 55/bin/mkdir -p ${PKG_REPODIR} 56if [ ! -z "${PKG_ALTABI}" ]; then 57 (cd ${DVD_DIR} && ln -s ${PKG_ABI} ${PKG_ALTABI}) 58fi 59 60# Ensure the ports listed in _DVD_PACKAGES exist to sanitize the 61# final list. 62for _P in ${_DVD_PACKAGES}; do 63 if [ -d "${PORTSDIR}/${_P}" ]; then 64 DVD_PACKAGES="${DVD_PACKAGES} ${_P}" 65 else 66 echo "*** Skipping nonexistent port: ${_P}" 67 fi 68done 69 70# Make sure the package list is not empty. 71if [ -z "${DVD_PACKAGES}" ]; then 72 echo "*** The package list is empty." 73 echo "*** Something is very wrong." 74 # Exit '0' so the rest of the build process continues 75 # so other issues (if any) can be addressed as well. 76 exit 0 77fi 78 79# Print pkg(8) information to make debugging easier. 80${PKGCMD} -vv 81${PKGCMD} update -f 82${PKGCMD} fetch -o ${PKG_REPODIR} -d ${DVD_PACKAGES} 83 84# Create the 'Latest/pkg.txz' symlink so 'pkg bootstrap' works 85# using the on-disc packages. 86mkdir -p ${PKG_REPODIR}/Latest 87(cd ${PKG_REPODIR}/Latest && \ 88 ln -s ../All/$(${PKGCMD} rquery %n-%v pkg).pkg pkg.pkg) 89(cd ${PKG_REPODIR}/Latest && \ 90 rm -f pkg.txz && ln -s pkg.pkg pkg.txz) 91 92${PKGCMD} repo ${PKG_REPODIR} 93 94# Always exit '0', even if pkg(8) complains about conflicts. 95exit 0 96