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 ROOTDIR="$PWD/dvd" 12export PKGCMD="/usr/sbin/pkg -d --rootdir ${ROOTDIR}" 13export PORTSDIR="${PORTSDIR:-/usr/ports}" 14 15_DVD_PACKAGES="archivers/unzip 16devel/git 17emulators/linux_base-c7 18graphics/drm-kmod 19graphics/drm-510-kmod 20graphics/drm-515-kmod 21misc/freebsd-doc-all 22net/mpd5 23net/rsync 24ports-mgmt/pkg 25ports-mgmt/portmaster 26shells/bash 27shells/zsh 28security/sudo 29sysutils/screen 30sysutils/tmux 31www/firefox 32www/links 33x11-drivers/xf86-video-vmware 34x11/gnome 35x11/kde5 36x11/sddm 37x11/xorg" 38 39# If NOPORTS is set for the release, do not attempt to build pkg(8). 40if [ ! -f ${PORTSDIR}/Makefile ]; then 41 echo "*** ${PORTSDIR} is missing! ***" 42 echo "*** Skipping pkg-stage.sh ***" 43 echo "*** Unset NOPORTS to fix this ***" 44 exit 0 45fi 46 47if [ ! -x /usr/local/sbin/pkg ]; then 48 /etc/rc.d/ldconfig restart 49 /usr/bin/make -C ${PORTSDIR}/ports-mgmt/pkg install clean 50fi 51 52export PKG_ABI=$(pkg --rootdir ${ROOTDIR} config ABI) 53export PKG_ALTABI=$(pkg --rootdir ${ROOTDIR} config ALTABI 2>/dev/null) 54export PKG_REPODIR="packages/${PKG_ABI}" 55 56/bin/mkdir -p ${ROOTDIR}/${PKG_REPODIR} 57if [ ! -z "${PKG_ALTABI}" ]; then 58 ln -s ${PKG_ABI} ${ROOTDIR}/packages/${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. 87export LATEST_DIR="${ROOTDIR}/${PKG_REPODIR}/Latest" 88mkdir -p ${LATEST_DIR} 89ln -s ../All/$(${PKGCMD} rquery %n-%v pkg).pkg ${LATEST_DIR}/pkg.pkg 90ln -sf pkg.pkg ${LATEST_DIR}/pkg.txz 91 92${PKGCMD} repo ${PKG_REPODIR} 93 94# Always exit '0', even if pkg(8) complains about conflicts. 95exit 0 96