pkg-stage.sh revision 276827
1258307Sgjb#!/bin/sh 2258307Sgjb# 3258307Sgjb# $FreeBSD: head/release/scripts/pkg-stage.sh 276827 2015-01-08 15:42:10Z gjb $ 4258307Sgjb# 5258307Sgjb 6258307Sgjbset -e 7258307Sgjb 8266553Sgjbexport ASSUME_ALWAYS_YES="YES" 9260772Sgjbexport PKG_DBDIR="/tmp/pkg" 10260772Sgjbexport PERMISSIVE="YES" 11260772Sgjbexport REPO_AUTOUPDATE="NO" 12260772Sgjbexport PKGCMD="/usr/sbin/pkg -d" 13258307Sgjb 14276827Sgjb_DVD_PACKAGES="archivers/unzip 15260772Sgjbdevel/subversion 16260772Sgjbdevel/subversion-static 17260772Sgjbemulators/linux_base-f10 18260772Sgjbmisc/freebsd-doc-all 19260772Sgjbnet/mpd5 20260772Sgjbnet/rsync 21260772Sgjbports-mgmt/pkg 22260772Sgjbports-mgmt/portmaster 23260772Sgjbshells/bash 24260772Sgjbshells/zsh 25260772Sgjbsecurity/sudo 26260772Sgjbsysutils/screen 27260772Sgjbwww/firefox 28260772Sgjbwww/links 29260772Sgjbx11-drivers/xf86-video-vmware 30260772Sgjbx11/gnome2 31260772Sgjbx11/kde4 32260772Sgjbx11/xorg" 33258307Sgjb 34259246Sgjb# If NOPORTS is set for the release, do not attempt to build pkg(8). 35259246Sgjbif [ ! -f /usr/ports/Makefile ]; then 36276820Sgjb echo "*** /usr/ports is missing! ***" 37276820Sgjb echo "*** Skipping pkg-stage.sh ***" 38276820Sgjb echo "*** Unset NOPORTS to fix this ***" 39259246Sgjb exit 0 40259246Sgjbfi 41259246Sgjb 42258307Sgjbif [ ! -x /usr/local/sbin/pkg ]; then 43276822Sgjb /etc/rc.d/ldconfig restart 44258847Sgjb /usr/bin/make -C /usr/ports/ports-mgmt/pkg install clean 45258307Sgjbfi 46258307Sgjb 47276765Sgjbexport DVD_DIR="dvd/packages" 48271491Sgjbexport PKG_ABI=$(pkg config ABI) 49276765Sgjbexport PKG_ALTABI=$(pkg config ALTABI 2>/dev/null) 50276765Sgjbexport PKG_REPODIR="${DVD_DIR}/${PKG_ABI}" 51260772Sgjb 52271491Sgjb/bin/mkdir -p ${PKG_REPODIR} 53276765Sgjbif [ ! -z "${PKG_ALTABI}" ]; then 54276766Sgjb (cd ${DVD_DIR} && ln -s ${PKG_ABI} ${PKG_ALTABI}) 55276765Sgjbfi 56258307Sgjb 57276827Sgjb# Ensure the ports listed in _DVD_PACKAGES exist to sanitize the 58276827Sgjb# final list. 59276827Sgjbfor _P in ${_DVD_PACKAGES}; do 60276827Sgjb if [ -d "/usr/ports/${_P}" ]; then 61276827Sgjb DVD_PACKAGES="${DVD_PACKAGES} ${_P}" 62276827Sgjb else 63276827Sgjb echo "*** Skipping nonexistent port: ${_P}" 64276827Sgjb fi 65276827Sgjbdone 66276827Sgjb 67276827Sgjb# Make sure the package list is not empty. 68276827Sgjbif [ -z "${DVD_PACKAGES}" ]; then 69276827Sgjb echo "*** The package list is empty." 70276827Sgjb echo "*** Something is very wrong." 71276827Sgjb # Exit '0' so the rest of the build process continues 72276827Sgjb # so other issues (if any) can be addressed as well. 73276827Sgjb exit 0 74276827Sgjbfi 75276827Sgjb 76260772Sgjb# Print pkg(8) information to make debugging easier. 77260772Sgjb${PKGCMD} -vv 78258307Sgjb${PKGCMD} update -f 79271491Sgjb${PKGCMD} fetch -o ${PKG_REPODIR} -d ${DVD_PACKAGES} 80258307Sgjb 81271876Sgjb# Create the 'Latest/pkg.txz' symlink so 'pkg bootstrap' works 82271876Sgjb# using the on-disc packages. 83271876Sgjbmkdir -p ${PKG_REPODIR}/Latest 84271876Sgjb(cd ${PKG_REPODIR}/Latest && \ 85271876Sgjb ln -s ../All/$(${PKGCMD} rquery %n-%v pkg).txz pkg.txz) 86271876Sgjb 87271480Sgjb${PKGCMD} repo ${PKG_REPODIR} 88258307Sgjb 89258307Sgjb# Always exit '0', even if pkg(8) complains about conflicts. 90258307Sgjbexit 0 91