#!/bin/sh # # Copyright (c) 2024 Tomoaki AOKI # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # Configurations BLOCKLISTS="japanese/libreoffice editors/libreoffice \ www/chromium www/firefox \ www/linux-widevine-cdm" PORTSDIR=/usr/ports LISTDIR=/poudriere LISTFILE=pkglist.all TMPDIR=/tmp TMPFILE=${LISTFILE}-`id -u`-`date "+%Y%m%d%H%M%S"` echo Output = ${LISTDIR}/${LISTFILE} echo Temporary = ${TMPDIR}/${TMPFILE} # Cleanup old lists if exists, and rotate list. if [ -f ${LISTDIR}/${LISTFILE}.old ] ; then rm ${LISTDIR}/${LISTFILE}.old ; fi if [ -f ${LISTDIR}/${LISTFILE} ] ; then mv ${LISTDIR}/${LISTFILE} ${LISTDIR}/${LISTFILE}.old ; fi if [ -f ${LISTDIR}/${LISTFILE}.old ] ; then chmod 666 ${LISTDIR}/${LISTFILE}.old ; fi # Regenerate list with newly installed ports. for PORT in `pkg query -a %n` ; do FLG=NO for NONEED in ${BLOCKLISTS} ; do if [ ${PORT} = ${NONEED} ] ; then FLG="YES" ; fi done fgrep "${PORT}\|\|" ${PORTSDIR}/MOVED > /dev/null RET=$? if [ 0 -eq $((RET)) ] ; then FLG="YES" ; fi if [ "NO" = ${FLG} ] ; then echo ${PORT} >> ${TMPDIR}/${TMPFILE} ; fi done sort ${TMPDIR}/${LISTFILE} | uniq > ${LISTDIR}/${LISTFILE} chmod 666 ${LISTDIR}/${LISTFILE} rm ${TMPDIR}/${TMPFILE}