#!/bin/bash # # $Id: prtcheck,v 1.1.1.1 2003/08/27 11:43:05 opel Exp $ # (c) 2003, Martin Opel # revised 2022 by John McQuah to address FS#1763 # # Utility to check a port for existence of .signature, .footprint and # the mandatory fields in Pkgfile. See "man 1 prtcheck" for details # # May be redistributed and modified under the terms of the GPL # only usable with CRUX Linux, version 1.0 or higher # # USE AT YOUR OWN RISK # msg() { echo -n -e "====> $1" } warn() { msg "WARNING: $1\n" excode=$(( excode+1 )) } error() { msg "ERROR: $1\n" exit -1 } ok() { msg "$(basename "$PWD") ok" } get_filename() { if [[ "$1" =~ ^(http|https|ftp|file)://.*/(.+) ]]; then echo "${BASH_REMATCH[2]}" else echo "$1" fi } # # read options # while [ $# -gt 0 ]; do if [ "$1" = "--root" ]; then convertfootprint="true" else error "unsupported option \"$1\"" fi shift done ((excode=0)) # # Checking footprint # if [ ! -s .footprint ]; then error "no footprint found or empty footprint!" fi if [ "$convertfootprint" = "true" ]; then uid="$(id -nu)" gid="$(id -ng)" file=".footprint" <$file sed -e "s,$uid/$gid,root/root," > $file.tmp mv $file.tmp $file fi if [ "$( <.footprint cut -f 2 | grep -c -v "root/root" )" -gt 0 ]; then warn "non-root users found!\nrun \"prtcheck --root\" to convert footprint" fi # # Checking Pkgfile # if [ ! -s Pkgfile ]; then error "no Pkgfile found or Pkgfile empty!" fi depends="$(