#!/bin/sh # # The contents of this file are subject to the Initial # Developer's Public License Version 1.0 (the "License"); # you may not use this file except in compliance with the # License. You may obtain a copy of the License at # http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. # # Software distributed under the License is distributed AS IS, # WITHOUT WARRANTY OF ANY KIND, either express or implied. # See the License for the specific language governing rights # and limitations under the License. # # The Original Code was created by Paul Beach # based on the original Posix script created by Alex Peshkov # for the Firebird Open Source RDBMS project. # # Copyright (c) 2017 Paul Beach # Alex Peshkov # and all contributors signed below. # # All Rights Reserved. # Contributor(s): ______________________________________. # FB_FW=/Library/Frameworks/Firebird.framework DAEMONLOC=/Library/LaunchDaemons #------------------------------------------------------------------------ # add a line in the (usually) /etc/services or /etc/inetd.conf file # Here there are three cases, not found => add # found & different => replace # found & same => do nothing # replaceLineInFile() { FileName="$1" echo $Filename newLine="$2" oldLine=`grep "$3" $FileName` if [ -z "$oldLine" ] then echo "$newLine" >> "$FileName" elif [ "$oldLine" != "$newLine" ] then MakeTemp grep -v "$oldLine" "$FileName" > "$TmpFile" echo "$newLine" >> $TmpFile cp $TmpFile $FileName rm -f $TmpFile echo "Updated $1" fi } MakeTemp() { TmpFile=`mktemp -q /tmp/firebird_tmp.XXXXXX` if [ $? -ne 0 ] then for n in `seq 1000` do TmpFile=/tmp/firebird_tmp.$n if [ ! -e $TmpFile ] then touch $TmpFile return fi done fi } cat <