#!/bin/bash function print_usage_exit() { echo "Usage $0 -i|--install|-u|--update" echo " -i or --install Install the submodules mentioned in the submodules.list" echo " -u or --update Update the submodules mentioned in the submodules.list" echo " " exit 1 } function read_submodules() { if [ -e ./submodules.list ]; then source ./submodules.list fi } function add_submodules() { for SUB_MODULE in ${SUB_MODULES} do git submodule add -f git@gitlab.osdev.nl:OpenSystemsDevelopment/${SUB_MODULE} ${SUB_MODULE} git config submodule.${SUB_MODULE}.url git@gitlab.osdev.nl:OpenSystemsDevelopment/${SUB_MODULE} done } function get_submodules() { git submodule update --init --recursive } function update_submodules() { git submodule update --recursive } # ============================================================================= # == T H E M A I N E N T R Y O F T H I S S C R I P T == # ============================================================================= read_submodules case "$1" in -i*|--install*) echo "Installing submodules for this repository ( ${PWD} )" add_submodules get_submodules ;; -u*|--update*) echo "Update submodules : ${SUB_MODULES}" update_submodules ;; *) echo "No parameters found..." print_usage_exit ;; esac