#!/bin/sh # an installation script for pf_freebsd copied from Wnn6 check_pw() { if which -s pw; then : else cat <> ${FILE} rm ${FILE}.bak else echo "Please add '$name $number/$type' into ${FILE}, and try again." return 1 fi fi return 0 } check_group() { local name id name=$1 id=$2 #check # We need a command 'pw(8)' check_pw if pw groupshow $name -q ; then return 0 fi if pw groupadd -g $id -n $name -N -q ; then echo "" echo "You need a group '$name' whose ID number is $id" if yesno "Would you like to create it automatically?" y; then pw groupadd -g $id -n $name return 0 fi fi echo "" echo "I was not able to add group 'proxy:*:62:' as pw reported:" pw groupadd -g $id -n $name -N echo "Please correct this and try again!" echo "" return 1 } check_user() { local name id group name=$1 id=$2 group=$3 # check id_id=`id -u $id 2> /dev/null` id_name=`id -u $name 2> /dev/null` if [ X"$id_name" = X$id ];then return 0 elif [ X"$id_id" != X ]; then cat <> /etc/inetd.conf fi if ! check_group proxy 62 ; then exit 1 fi groupid=`pw groupshow proxy | awk \ '{ split ($1,var,":"); print var[3] }' ` if ! check_user proxy 62 $groupid; then exit 1 fi ;; esac