#!/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 CURVERS=15 PORTSDIR=/usr/ports # End configurations section. # pkg version -o | cut -f 1 -w | while read PACKAGE # do # ARCH=`pkg query %q ${PACKAGE}` # if [ ${CURVERS} != `echo ${ARCH} | cut -f 2 -d :` ] # then # echo Port ${PACKAGE} : ${ARCH} # fi # done for PACKAGE in `pkg query -a %n` ; do PORT=`pkg query %o ${PACKAGE}` FLAVOR=`pkg info -A ${PACKAGE} | fgrep "flavor" | cut -f 4 -w` FLG="NO" # Check if release string in the package matches current release or not. if [ -z ${FLAVOR} ] ; then ARCH=`pkg query %q ${PORT}` else ARCH=`pkg query %q ${PORT}@${FLAVOR}` fi REL=`echo ${ARCH} | cut -f 2 -d :` if [ ${CURVERS} = ${REL} ] then continue fi # Check if the package is deleted on ports tree or not using MOVED. if [ -z ${FLAVOR} ] ; then fgrep "${PORT}\|\|" ${PORTSDIR}/MOVED > /dev/null RET=$? else fgrep "${PORT}@${FLAVOR}\|\|" ${PORTSDIR}/MOVED > /dev/null RET=$? fi if [ 0 -eq $((RET)) ] ; then FLG="YES" ; fi # Check if the package is locked or not. if [ -z ${FLAVOR} ] ; then LOCKED=`pkg info -k -q ${PORT}` else LOCKED=`pkg info -k -q ${PORT}@${FLAVOR}` fi if [ "NO" = ${FLG} ] ; then if [ -z ${FLAVOR} ] ; then if [ "no" = ${LOCKED} ] ; then echo ${PORT} ${ARCH} FREE EXISTS else echo ${PORT} ${ARCH} LOCKED EXISTS fi else if [ "no" = ${LOCKED} ] ; then echo ${PORT}@${FLAVOR} ${ARCH} FREE EXISTS else echo ${PORT}@${FLAVOR} ${ARCH} LOCKED EXISTS fi fi else if [ -z ${FLAVOR} ] ; then if [ "no" = ${LOCKED} ] ; then echo ${PORT} ${ARCH} FREE DELETED else echo ${PORT} ${ARCH} LOCKED DELETED fi else if [ "no" = ${LOCKED} ] ; then echo ${PORT}@${FLAVOR} ${ARCH} FREE DELETED else echo ${PORT}@${FLAVOR} ${ARCH} LOCKED DELETED fi fi fi done