Remove chmod

Signed-off-by: René Jochum <rene@jochum.dev>
master
René Jochum 4 years ago
parent 2ad90c6417
commit ee493b09c2

@ -8,8 +8,6 @@ import glob
import jinja2
import pathlib
original_umask = os.umask(0)
def jinja_render_file(in_path, data, out_path):
render_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(in_path)))
output = render_environment.get_template(os.path.basename(in_path)).render(**data)
@ -33,23 +31,21 @@ for postfix_file in glob.glob("/conf/**/**.cf", recursive=True):
p = p.relative_to(*p.parts[:2])
p = p.joinpath('/etc/postfix', *p.parts)
if not p.parent.is_dir():
p.parent.mkdir(0o700)
p.parent.mkdir()
destination = str(p)
shutil.copyfile(postfix_file, destination)
os.chmod(destination, 600)
for postfix_file in glob.glob("/conf/**/**.cf.jinja", recursive=True):
p = pathlib.Path(postfix_file)
p = p.relative_to(*p.parts[:2])
p = p.joinpath('/etc/postfix', *p.parts)
if not p.parent.is_dir():
p.parent.mkdir(0o700)
p.parent.mkdir()
destination = str(p)
destination = destination[0:-6] # Remove .jinja from the output path
jinja_render_file(postfix_file, os.environ, destination)
os.chmod(destination, 600)
if os.path.exists("/overrides/postfix.cf"):
for line in open("/overrides/postfix.cf").read().strip().split("\n"):
@ -65,7 +61,4 @@ os.system("/usr/lib/postfix/sbin/post-install meta_directory=/etc/postfix create
# Before starting postfix, we need to check permissions on /queue
# in the event that postfix,postdrop id have changed
os.system("postfix set-permissions")
os.umask(original_umask)
os.system("postfix start-fg")

Loading…
Cancel
Save