summaryrefslogtreecommitdiff
path: root/prtcheck
blob: 4130f3b6e10db8ec1a8f3257de4eac075056680e (plain)
    1 #!/bin/bash
    2 #
    3 # $Id: prtcheck,v 1.1.1.1 2003/08/27 11:43:05 opel Exp $
    4 # (c) 2003, Martin Opel <mo@obbl-net.de>
    5 #
    6 # Utility to check a port for existence of .md5sum, .footprint and
    7 # the must-fields in Pkgfile. See "man 1 prtcheck" for details
    8 #
    9 # May be redistributed and modified under the terms of the GPL
   10 # only usable with CRUX Linux, version 1.0 or higher
   11 #
   12 # USE AT YOUR OWN RISK
   13 #
   14 
   15 
   16 msg() {
   17 	MSG="$1"
   18 	echo -n -e "====> $MSG"
   19 }
   20 
   21 warn() {
   22 	msg "WARNING: $1\n"
   23 }
   24 
   25 error() {
   26 	msg "ERROR: $1\n"
   27 	exit 1
   28 }
   29 
   30 ok() {
   31 	echo "OK."
   32 }
   33 
   34 #
   35 # read options
   36 #
   37 while [ $# -gt 0 ]; do
   38 	if [ "$1" = "--root" ]; then
   39 		convertfootprint="true"
   40 	else
   41 		error "unsupported option \"$1\""
   42 	fi
   43 	shift
   44 done
   45 
   46 #
   47 # Checking footprint
   48 #
   49 if [ ! -s .footprint ]; then
   50 	error "no footprint found or empty footprint!"
   51 fi
   52 if [ "$convertfootprint" = "true" ]; then
   53 	uid="`id -nu`"
   54 	gid="`id -ng`"
   55 	file=".footprint"
   56 	cat $file | sed -e "s,$uid/$gid,root/root," > $file.tmp
   57 	mv $file.tmp $file
   58 fi
   59 if [ `cat .footprint | grep -v "root/root" | wc -l` -gt 0 ]; then
   60 	warn "non-root users found!"
   61 	warn "  run \"`basename $0` --root\" to convert footprint"
   62 fi
   63 
   64 #
   65 # Checking Pkgfile
   66 #
   67 if [ ! -s Pkgfile ]; then
   68 	error "no Pkgfile found or Pkgfile empty!"
   69 fi
   70 desc="`cat Pkgfile | grep '^# Description:' | sed -e 's,# Description:,,'`"
   71 if [ "$desc" = "" ]; then
   72 	error "no Description in Pkgfile!"
   73 fi
   74 url="`cat Pkgfile | grep '^# URL:' | sed -e 's,# URL:,,'`"
   75 if [ "$url" = "" ]; then
   76 	error "no URL in Pkgfile!"
   77 fi
   78 packager="`cat Pkgfile | grep '^# Packager:' | sed -e 's,# Packager:,,'`"
   79 if [ "$packager" = "" ]; then
   80 	error "no Packager in Pkgfile!"
   81 fi
   82 depends="`cat Pkgfile | grep '^# Depends on:' | sed -e 's,# Depends:,,'`"
   83 if [ "$depends" = "" ]; then
   84 	warn "no dependencies, please check!"
   85 fi

Generated by cgit