2016-12-01 14:19:53 +00:00
|
|
|
#!/bin/bash
|
2016-10-04 02:55:11 +00:00
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
|
|
|
# get current stuff
|
2016-12-08 14:38:05 +00:00
|
|
|
git clone https://github.com/ansible/ansible.git ansible_unified
|
2016-10-04 02:55:11 +00:00
|
|
|
cd ansible_unified/
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
2016-12-08 14:38:05 +00:00
|
|
|
git remote add upstream git@github.com:ansible/ansible.git
|
2016-10-04 02:55:11 +00:00
|
|
|
|
|
|
|
# add submodules as remotes
|
2016-12-08 14:38:05 +00:00
|
|
|
git remote add core_modules https://github.com/ansible/ansible-modules-core.git
|
|
|
|
git remote add extras_modules https://github.com/ansible/ansible-modules-extras.git
|
2016-10-04 02:55:11 +00:00
|
|
|
git fetch --all
|
|
|
|
|
|
|
|
# remove submodules
|
|
|
|
echo "" > .gitmodules
|
|
|
|
git add .gitmodules
|
|
|
|
git rm --cached lib/ansible/modules/core/
|
|
|
|
git rm --cached lib/ansible/modules/extras/
|
|
|
|
git commit -am "removed core and extras submodules"
|
|
|
|
rm -rf lib/ansible/modules/core
|
|
|
|
rm -rf lib/ansible/modules/extras
|
|
|
|
|
|
|
|
# merge remotes into old submodule dirs
|
|
|
|
## core
|
|
|
|
git merge -s ours --allow-unrelated-histories --no-commit core_modules/devel
|
|
|
|
git read-tree --prefix=lib/ansible/modules/core -u core_modules/devel
|
|
|
|
git commit -am 'core modules back to main repo'
|
|
|
|
## extras
|
|
|
|
git merge -s ours --allow-unrelated-histories --no-commit extras_modules/devel
|
|
|
|
git read-tree --prefix=lib/ansible/modules/extras -u extras_modules/devel
|
|
|
|
git commit -am 'extras modules back to main repo'
|
2016-12-01 03:18:16 +00:00
|
|
|
|
|
|
|
for subdir in core extras
|
|
|
|
do
|
|
|
|
# unify directories
|
|
|
|
for mydir in $(find lib/ansible/modules/${subdir} -type d)
|
|
|
|
do
|
|
|
|
mkdir -p ${mydir/$subdir\//}
|
|
|
|
done
|
|
|
|
|
|
|
|
# move plugins
|
2016-12-01 03:21:29 +00:00
|
|
|
for myfile in $(find lib/ansible/modules/${subdir} -type f)
|
2016-12-01 03:18:16 +00:00
|
|
|
do
|
|
|
|
if [ -e ${myfile/$subdir\///} ]; then #mostly to avoid __init__.py clobering
|
|
|
|
echo "skipping ${myfile} as it already exists in destination"
|
|
|
|
else
|
|
|
|
git mv ${myfile} ${myfile/$subdir\//}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2016-12-08 14:38:05 +00:00
|
|
|
rm -rf lib/ansible/modules/${subdir}
|
2016-12-01 03:18:16 +00:00
|
|
|
done
|