<div dir="ltr"><div><div><div><div><br><br>On 28 November 2016 at 12:25, Antony Antony <<a href="mailto:antony@phenome.org">antony@phenome.org</a>> wrote:<br>> On Sun, Nov 27, 2016 at 10:48:37PM -0500, Andrew Cagney wrote:<br>>> On 27 November 2016 at 13:40, Antony Antony <<a href="mailto:antony@vault.libreswan.fi">antony@vault.libreswan.fi</a>> wrote:<br>>> > commit 749c8d5ea579fde2831cf553909c5062b41e5e74<br>>> > Author: Antony Antony <<a href="mailto:antony@phenome.org">antony@phenome.org</a>><br>>> > Date:   Sun Nov 27 18:57:03 2016 +0100<br>>> ><br>>> >     testing: <a href="http://kvm-targets.mk">kvm-targets.mk</a> support fedora 25 as a test host/vm<br>>> ><br>>> >     make install-kvm-test-domains is slow:) need improvements.<br>>><br>>> FYI, transmogrify really only needs to happen once and not on every<br>>> boot.  I've something similar to this in my queue - clone-example.sh<br>>> prototypes the idea.<br>><br>> What would improve if it is not running every time?<br>> save a systemctl restart network.service?<br><br>That would help for starters.<br><br>> transmogrify could be more efficient and not run this every time.<br>> Run it only if the relevant files changed. That sort of things could be a bit more easier in python.<br><br></div><div>So:<br><br>    if not "#alias" in open("/root/.bashrc", "r").read():<br>        output += "\n" + \<br>            subprocess.getoutput("sed -i 's/alias/# alias/g' /root/.bashrc")<br><br></div><div>is simpler than:<br><br>    # get rid of damn cp/mv/rm aliases for root<br>    sed -i 's/alias/# alias/g' /root/.bashrc<br><br></div>I'm not convinced.<br><div><br>> Running every time could be useful in some cases. Say to change hosts in a sepecific way.<br>> It has helped me in the past to push changes after test vms are built.<br>> Sometimes rebuilding vm is not ideal!<br><br>It contains redundant gibberish like:<br><br></div><div style="margin-left:40px"># and some custom ipsec* files, but not directories<br>if os.path.isdir("/etc/ipsec.d"):<br>    if not os.path.isdir("/etc/ipsec.d.stock"):<br>        os.rename("/etc/ipsec.d", "/etc/ipsec.d.stock")<br>    else:<br>        shutil.rmtree("/etc/ipsec.d")<br>shutil.copytree("/testing/baseconfigs/all/etc/ipsec.d", "/etc/ipsec.d",<br>                ignore=shutil.ignore_patterns("ipsec.conf.common"))<br><br></div>setting up /etc/ipsec.d <a href="http://et.al">et.al</a>., is the domain of swan-prep.  The first thing swan-prep does is undo swan-transmogrify's damage, vis:<br><br><div style="margin-left:40px"># wipe any old configs in /etc/ipsec.*<br>if os.path.isfile("/etc/ipsec.conf"):<br>    os.unlink("/etc/ipsec.conf")<br>if os.path.isfile("/etc/ipsec.secrets"):<br>    os.unlink("/etc/ipsec.secrets")<br>if os.path.isdir("/etc/ipsec.d"):<br>    shutil.rmtree("/etc/ipsec.d")<br>    os.mkdir("/etc/ipsec.d")<br></div><br></div>Andrew</div></div></div>