3 # Copyright (C) Catalyst.Net Ltd 2019
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Manage dependencies and bootstrap environments for Samba.
21 CLI script to render bootstrap.sh/Dockerfile/Vagrantfile.
23 Author: Joe Guo <joeg@catalyst.net.nz>
30 from config
import DISTS
, VAGRANTFILE
, OUT
32 logging
.basicConfig(level
='INFO')
33 log
= logging
.getLogger(__file__
)
37 """Render files for all dists"""
38 for dist
, config
in dists
.items():
40 os
.makedirs(home
, exist_ok
=True)
41 for key
in ['packages.yml', 'bootstrap.sh', 'Dockerfile']:
42 path
= os
.path
.join(home
, key
)
43 log
.info('%s: render "%s" to %s', dist
, key
, path
)
44 with io
.open(path
, mode
='wt', encoding
='utf8') as fp
:
48 path
= os
.path
.join(OUT
, key
)
49 log
.info('%s: render "%s" to %s', dist
, key
, path
)
50 with io
.open(path
, mode
='wt', encoding
='utf8') as fp
:
55 parser
= argparse
.ArgumentParser(
56 formatter_class
=argparse
.ArgumentDefaultsHelpFormatter
,
57 description
=('Render templates with samba dependencies '
58 'to bootstrap multiple distributions.'))
61 '-r', '--render', action
='store_true', help='Render templates')
63 args
= parser
.parse_args()
71 if __name__
== '__main__':