-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkpfsensible
executable file
·28 lines (23 loc) · 1.64 KB
/
mkpfsensible
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
[ ! -d ansible-pfsense ] && echo "No such directory ansible-pfsense" && exit 1
[ ! -d pfsensible/core ] && echo "No such directory pfsensible/core" && exit 1
rm -rf pfsensible/core/{examples,misc,plugins,tests/units/modules,*.tar.gz}
mkdir -p pfsensible/core/{examples,misc,plugins/modules,tests/units/modules}
cp -a ansible-pfsense/{.gitignore,LICENSE} pfsensible/core/
cp -a ansible-pfsense/{group_vars,pfsense.yml,pfsense_setup.yml,roles} pfsensible/core/examples/
cp -a ansible-pfsense/lookup_plugins pfsensible/core/plugins/lookup
cp -a ansible-pfsense/module_utils/network/pfsense pfsensible/core/plugins/module_utils
cp -a ansible-pfsense/test/units/modules/network/pfsense/* pfsensible/core/tests/units/modules/
for path in ansible-pfsense/library/*.py
do
filename=${path##*/}
cp -a $path pfsensible/core/plugins/modules/${filename/pfsense_/}
done
sed -i -e 's/pfsense_/pfsensible.core./g' -e s,opoplawski/ansible-pfsense,pfsensible/core, pfsensible/core/README.md
sed -i -e 's/pfsense_\(.*:\)/pfsensible.core.\1/g' $(find pfsensible/core/examples -name \*.yml)
sed -i -e '/import\|module:\|^ *pfsense_[a-z_0-9]*:$\|descr *= *.ansible pfsense_/s/pfsense_/pfsensible.core./' $(find pfsensible/core/plugins/modules -name \*.py)
sed -i -e '/self.name = /s/pfsense_/pfsensible.core./' $(find pfsensible/core -name \*.py)
sed -i -e s/ansible.module_utils.network.pfsense/ansible_collections.pfsensible.core.plugins.module_utils/ $(find pfsensible -name \*.py)
sed -i -e 's/ansible.modules.network.pfsense import pfsense_/ansible_collections.pfsensible.core import /' $(find pfsensible/core/tests -name \*.py)
cd pfsensible/core
ansible-galaxy collection build