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="devel/git@lite 16graphics/drm-kmod 17graphics/drm-510-kmod 18graphics/drm-515-kmod 19misc/freebsd-doc-all 20net/mpd5 21net/rsync 22ports-mgmt/pkg 23shells/bash 24shells/zsh 25security/sudo 26sysutils/screen 27sysutils/seatd 28sysutils/tmux 29www/firefox 30www/links 31x11/gnome 32x11/kde5 33x11/sddm 34x11/xorg 35x11-wm/sway" 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 PKG_ABI=$(pkg --rootdir ${ROOTDIR} config ABI) 51export PKG_ALTABI=$(pkg --rootdir ${ROOTDIR} config ALTABI 2>/dev/null) 52export PKG_REPODIR="packages/${PKG_ABI}" 53 54/bin/mkdir -p ${ROOTDIR}/${PKG_REPODIR} 55if [ ! -z "${PKG_ALTABI}" ]; then 56 ln -s ${PKG_ABI} ${ROOTDIR}/packages/${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. 85export LATEST_DIR="${ROOTDIR}/${PKG_REPODIR}/Latest" 86mkdir -p ${LATEST_DIR} 87ln -s ../All/$(${PKGCMD} rquery %n-%v pkg).pkg ${LATEST_DIR}/pkg.pkg 88ln -sf pkg.pkg ${LATEST_DIR}/pkg.txz 89 90${PKGCMD} repo ${PKG_REPODIR} 91 92# Always exit '0', even if pkg(8) complains about conflicts. 93exit 0 94