Skip to content
Snippets Groups Projects
Commit aedb2ed8 authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Add/remove submodules

parent 4c654e4e
No related branches found
No related tags found
No related merge requests found
......@@ -194,15 +194,49 @@ function manage_plugins() {
clear
mkdir -p Plugins
cd Plugins
echo "Adding plugins..."
echo "Adding/updating plugins..."
for i in ${!plugins[@]}
do
# Check if plugin is already present
repo_name_with_extension=${plugin_repositories[$i]##*/}
repo_name=${repo_name_with_extension%*.git}
path=$(git config -f .gitmodules --get "submodule.Plugins/${repo_name}.path")
if [ $? -ne 0 ]
then
plugin_present=true
else
plugin_present=false
fi
if [ -n "${plugin_branches[$i]}" ]
then
echo "${plugins[$i]}"
if [ "$plugin_present" == false ]
then
# Plugin was not yet added, call git submodule add
echo "Add new plugin: ${plugins[$i]}"
git submodule add -b ${plugin_branches[$i]} ${plugin_repositories[$i]}
else
# Updating existing plugin
echo "Update plugin: ${plugins[$i]}"
cd $repo_name
git fetch
git checkout ${plugin_branches[$i]}
git pull
cd ..
fi
else
if [ "$plugin_present" == true ]
then
# Remove plugin!
git submodule deinit -f "$repo_name"
git rm -f "$repo_name"
git config -f ../.gitmodules --remove-section "submodule.Plugins/${repo_name}"
if [ -z "$(cat ../.gitmodules)" ]; then
git rm -f ../.gitmodules
fi
fi
fi
done
cd ..
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment