Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | #Copyright (c) 2017 Sprint |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | #!/bin/sh |
| 16 | |
| 17 | usage () |
| 18 | { |
| 19 | echo "Scans the current directory and adds, as required, the " |
| 20 | echo "extensions to the specified config file intially disabled." |
| 21 | echo "Usage: $0 <config file>" |
| 22 | } |
| 23 | |
| 24 | if [ "$#" -ne 1 ]; then |
| 25 | usage |
| 26 | exit 0 |
| 27 | fi |
| 28 | |
| 29 | if [ -e $1 ]; then |
| 30 | echo "Updating $1" |
| 31 | for D in *; do |
| 32 | if [ -d "${D}" ]; then |
| 33 | INDIR=`grep -c "${D}.fdx" $1` |
| 34 | if [ "$INDIR" -eq 0 ]; then |
| 35 | echo "Adding ${D} to file" |
| 36 | sed -i '$ i#LoadExtension = \"/usr/local/lib/freeDiameter/'"${D}"'.fdx\";' $1 |
| 37 | fi |
| 38 | fi |
| 39 | done |
| 40 | else |
| 41 | echo "File $1 does not exist. Please provide valid config file\n" |
| 42 | fi |