Update script to generate spec per branch
[oom/utils.git] / external-schema-repo-generator / generator / utils.sh
1 #!/bin/sh
2
3 # ============LICENSE_START=======================================================
4 # OOM
5 # ================================================================================
6 # Copyright (C) 2021 Nokia. All rights reserved.
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18
19 # Variables
20 starting_directory="$PWD"
21
22 # Constants
23 EXPECTED_1_ARG=1
24 EXPECTED_2_ARGS=2
25 EXPECTED_4_ARGS=4
26 EXPECTED_9_ARGS=9
27
28
29 # Checks whether number of arguments is valid
30 # $1 is actual number of arguments
31 # $2 is expected number of arguments
32 check_arguments() {
33   if [ "$1" -ne "$2" ]; then
34     echo "Incorrect number of arguments"
35     exit 1
36   fi
37 }
38
39 # Go back to directory from which script was called
40 move_to_starting_directory() {
41   echo "Moving back to: $starting_directory"
42   cd $starting_directory
43 }