Forum: 

di-live for first time config setup

Rudiger Wolf's picture

Ok I seem to have TKLPatch working. Now instead of using overlay with fixed config settings I would like to use di-live.

There seem to be two things I need to get sorted.

1 - di-live file

2 - system config applier file

DI-LIVE FILE

Drop this in /usr/lib/di-live.d
WHAT shuld I call the file? The TurnKey ISO file in this location seem to be pre-appended with numbers?       


#!/usr/bin/python
import sys
import common	

TARGET = "/target"

def main():
    if not common.target_mounted(TARGET):
        sys.exit(10) # return to menu

    db = common.Debconf()
    username = db.get_input('Enter value for Username', 'testuser')
    domain = db.get_input('Enter value for Domain', 'corp-domain')
    proxy = db.get_input('Enter value for Proxy', '10.1.1.1:8080')
    password = db.get_password('Enter password')
    chroot = common.Chroot(TARGET)
    chroot.system('cntlm-config %s %s %s %s' % (username, domain, proxy, password ))

if __name__ == "__main__":
    main()

 

SYSTEM CONFIG APPLIER FILE

place in .../overlay/usr/local/bin/cntlm-config


#!/bin/bash 
APT_CONF_FILE="/etc/cntlm.conf"
sed -e '/^Username/s/testuser/$1/g' $APT_CONF_FILE 
sed -e '/^Domain/s/corp-uk/$2/g' $APT_CONF_FILE 
sed -e '/^Password/s/password/$3/g' $APT_CONF_FILE 
sed -e '/^Proxy/s/10\.217\.112\.4.\:8080/$4/g' $APT_CONF_FILE 
sed -e '/^Listen/s/3128/9090/g' $APT_CONF_FILE

The above is untested, I will get to that shortly.

 

So is the approach OK?

What do I call the di-live.d file?

Liraz Siri's picture

Congratulations, it looks like you know what you're doing. For the things you are unsure about, a little experimentation should help to fill in the gaps quickly. That's pretty much what we do when we're trying to get things to work. Test, revise, test again, rinse repeat.

The filename for the di-live.d is basically arbitrary. Choose whatever you like. The numbers determine the execution order but if you don't care about that you can just leave that to chance.

Post new comment