#!/usr/bin/env -S python3 -Bu ################################################ ### Managed by someone's ansible provisioner ### ################################################ # Part of: https://git.somenet.org/root/pub/somesible.git # 2017-2024 by someone # # Prevent apt/dpkg from (re)starting services we manage. # ############## ### UNUSED ### ### DELME? ### ############## import datetime import os import re import sys os.umask(0o077) MANAGED_SERVICES = set("{{apt_ansible_managed_services | join(' ')}} {{apt_ansible_managed_services_extra | join(' ')}}".replace(".service","").split(" ")) SERVICE = re.sub(r"@.*", "", re.sub(r"\.service", "", sys.argv[1])) if SERVICE in MANAGED_SERVICES: with open("/tmp/policy-rc.d.log", "a") as fout: fout.write(datetime.datetime.now().isoformat(timespec='seconds')+" -- managed, exit 101: " +str(sys.argv)+"\n") sys.exit(101) with open("/tmp/policy-rc.d.log", "a") as fout: fout.write(datetime.datetime.now().isoformat(timespec='seconds')+" -- unmanaged, exit 0: " +str(sys.argv)+"\n") sys.exit(0)