TurnKey Linux Virtual Appliance Library

Trying to understand how to tklpatch

dear all
I'm trying to know how to play with tklpatch
based on : http://www.turnkeylinux.org/docs/tklpatch/development , and
example of drupal5 patch


1. the skleton
mkdir mypatch
mkdir mypatch/debs
mkdir mypatch/overlay
touch mypatch/conf; chmod +x mypatch/conf

CMIIW :
mypatch
++ this is the developmen directory root

mypatch/debs
++ this is where we have to put all needed deb files
In example
while in "normal" condition I want to install mc :

bino@fileserver:/usr/share/tklpatch/examples$ sudo apt-get install mc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgpmg1
Suggested packages:
  gpm arj links w3m lynx
The following NEW packages will be installed:
  libgpmg1 mc

It'll means that if I want to create a patch that add mc to tkl-core, i'll have to put deb files :

  • libgpmg1_1.19.6-25ubuntu1_i386.deb
  • mc_1%3a4.6.1-8ubuntu1_i386.deb

into this directory

 

mypatch/overlay
++ this is where we have to put files that we want it to be copied after the installation process. the subdirectory tree is folowing ubuntu directory tree mode/schema.

So , every files inside /mypatch/overlay/etc  will be copied to /etc of finished product

touch mypatch/conf; chmod +x mypatch/conf
++this is the script that will be called by TKL core for installing packages

a cut from drupal5 patch
# install drupal5
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y \
    -o DPkg::Options::=--force-confdef \
    -o DPkg::Options::=--force-confold \
    install drupal5

It means that I want to add mc, it'll look like
 

# install mc
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y \
    -o DPkg::Options::=--force-confdef \
    -o DPkg::Options::=--force-confold \
    install mc

Kindly please give me your correction

Sincerely
-bino-
 

Liraz Siri's picture

No just use apt-get

If you want to install mc, you should be able to just add this to your tklpatch configuration script:
apt-get update
apt-get install mc
It seems this isn't simple enough so I think we'll extend tklpatch so it supports a file with a list of packages to install.
Liraz Siri's picture

New version of tklpatch improves usability

See this comment for details. Hope this helps you get started!

Just a humble Idea

Hi Liraz ...

I really appreciate your enlightment ...

 

What if TKLPatch also enabling user to add needed deb files to Iso ?

This way ... the end user have no need to work online while doing installation

 

Sincerely

-bino-


How to handle files in /debs

Dear Liraz.

I'm working on making a patch for OpenERP.

The installation will need a bunch of files , and I want to include the files in tklpatch

1. ubuntu packages (mostly about python)

a. using "apt-get -s install" in my development box, I can get the list of depencies an also the installation sequence.

b. I can copy files from step#a to tklpatch's /debs

question : Will it just copied to /debs in target engine ? or will it automaticaly installed (autorun dpkg -i)

If I have to write the dpkg sequence in configuration file .. what directory I have to use as path-to-deb ? is it "/debs" ---> dpkg -i /debs/package_name.deb

 

2. OpenErp source files :

I need to place some source files. Where I have to put it ?

3. the "overlay" .. is it copied "after" the configuration run ? or is it "before"

 

Sincerely

-bino-

 


Alon Swartz's picture

Some answers

Q: Will it just copied to /debs in target engine ? or will it automaticaly installed
A: All packages in debs/ will be automatically installed. See bin/tklpatch-apply-debs for details.

Q: I need to place some source files. Where I have to put it ?
A: What do you mean by source files? I'll assume you mean you need to compile some sourcecode, in which case overlay/usr/local/src/ might be what you're looking for.

Q: the "overlay" .. is it copied "after" the configuration run ? or is it "before"
A: The overlay is applied before the configuration script is executed.

Quoting from the tklpatch documentation, the order the patch is applied:
debs/       # custom debian packages (installed with dpkg -i *.deb)
overlay/    # overlay applied to root filesystem
conf        # configuration script to execute in chroot (rootfs)
Comment
I would recommend installing packages via the conf script with apt-get instead of including them (and their dependencies) in debs/. The debs/ functionality is mainly provided for packages that are not available in an upstream repository.

On the otherhand, I can see the usefulness when working offline or just for efficiency, something to think about...

tklpatch-apply to LAPP

Dear Alon and Liraz.

With your enlightment , now I have a patch that will install openerp on LAPP. I mean adding Openerp in LAPP iso.

Currently , I assume that we need to stop Postgress service before applying this patch, since I'm not sure where pgsql will write it's data while sql request is issued by the patch's configuration script.

So .. for this mess .. is there any way of patching the configuration menu of LAPP to add an option for configuring OpenERP ? basicaly it'll just asking 2 thing :

1. Username that will use by open erp

2. Password for that user

With this .. it'll have to  :

1. Create system user with that name

2. Create PGSQL user with that name

3. Do some adjustment of openerp-server.conf

I can write whiptail script to ask for all variable and run proceeding procedures .. but I don't know how to make TKL's configuration dialog call my script.

 

I'm also thinking of webmin module .... but currently it's "too much" for my damn stupid brain

Sincerely

-bino-


Alon Swartz's picture

Different direction?

Instead of thinking in the direction of patching a running LAPP system, it would be beneficial to think in the direction of patching the LAPP iso. This would focus your efforts on creating a simpler patch, and at the same time make the evolution of the tklpatch into a tkl appliance easier.

This is no way would inhibit the ability to install the tklpatch on a running system, it would just require a little extra bit of code to support that use case.

Keeping this in mind, instead of adding to the confconsole, you would rather want to add to the installer (di-live). Take a look at this thread for some info. OTOH, for sake of simplicity, a simple shell script would suffice for the tklpatch, and the core team could write the di-live component at a later stage.

Looking forward to seeing what you have come up with!

I'm sorry for my bad english

Dear Alon.

I think my bad english miss lead you.

I'm not patching running lapp, but lapp iso

 

Ok here is my report based on current result :

0. Name : mypatch3 (still need renaming to nicer one)

1. Format : tklpatch

2. Target TKL : LAPP Appliance ISO

3. Purpose : To make OpenErp appliance based on TKL LAPP Appliance ISO

3. Size : +/- 90 MB

4. What included :

a. deb files of needed debian package by OpenErp

b. Openerp-server and openerp-web sources (from bazaar)

c. Pre compiled (egg format) of some python module needed by openerp

5. credential :

a. openerp system and pgsql user = openerp

b. openerp pgsql password = openerp

6. what I don't like : "openerp" pgsql user will be the owner of all db created by openerp-server, so it's not a good idea to hardcode it's password.

dirty workaround : I'll write bash script to help user to set new username and password.

7. Release plan, I will release two kind of this patch:

a. Full bloated patch with all needed files (aprox 90 mb)

b. without needed files, but i'll not pre-tes it since my internet connection will needed days on downloading openerp files via bazaar.

 

Sincerely

-bino-


Liraz Siri's picture

Perfect scenario for Amazon EC2

With Amazon EC2 you can rent a small instance for $0.086 (under ten cents!) an hour. The network connection to the Amazon cloud is much better than anything you could ever get at home - up to 10 MB/sec so you'll be downloading dependencies in seconds.

You could use Amazon EC2 to test build your tklpatch appliance online and it will cost you next to nothing. Also, I think someone like you would have a fantastic time exploring Amazon EC2. It is very powerful.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)