Next SIP extension
This commit is contained in:
parent
7100b577f8
commit
31316c3bf5
|
@ -35,35 +35,23 @@ extensions=()
|
||||||
|
|
||||||
# get the used extensions
|
# get the used extensions
|
||||||
IFS=''
|
IFS=''
|
||||||
while read line; do
|
for line in $(cat $CONFIG_FILE | grep "extension"); do
|
||||||
if [[ "$line" == *"<extension>"* ]]; then
|
extnum=$(echo "$line" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}')
|
||||||
ext=$(echo "$line" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}')
|
extensions+=($extnum)
|
||||||
extensions+=($ext)
|
done
|
||||||
fi
|
|
||||||
if [[ "$line" == *'</provision>' ]]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done < $CONFIG_FILE
|
|
||||||
|
|
||||||
#echo "used extensions:"
|
# find the max extension number
|
||||||
#echo $extensions
|
maxnum=201
|
||||||
#echo " "
|
for i in ${extensions[@]}; do
|
||||||
|
if [ $i -gt $maxnum ]; then
|
||||||
# which is the first available unused extension ?
|
maxnum=$i
|
||||||
for ext in $(seq 201 299);
|
|
||||||
do
|
|
||||||
is_used=
|
|
||||||
for i in "${extensions[@]}"
|
|
||||||
do
|
|
||||||
if [[ "$i" == "$ext" ]]; then
|
|
||||||
is_used=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ ! $is_used ]; then
|
|
||||||
echo $ext;
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ $maxnum -gt 299 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $(($maxnum + 1))
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue