My previous message has been rejected (due to attachements)

Here it is again with inlining of scripts

--
Christian Grenoble




----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 22, 2004 4:49 AM
Subject: [leaf-user] editing lrp files in windows




I am running Bering uClibc 2.1.3 and am going to upgrade to 2.2.
Since I am happy with most of my settings in my current 2.1.3 I wanted to
copy and paste a lot of my settings from the old to the new.  I only have
windows OS machines so I was hoping there might be some text editor that
runs in windows xp to copy text from my .lrp files and paste them to the
new release.
If not, then I will write all my settings down by hand and then retype it
in the new release. ..... What a beating!!!

Thanks,
Andrew

Andrew,

Why not use one of your current Bering machines as the editor tool?

I don't remember if a similar process has already been described, but if
that can help you, here is is how I proceed.

*  Tools:

  - sshd and sftp (recommended over telnet and ftp) on your Bering machine.
  - the 'unzippackage' and 'redopackage' scripts I've written for this
    purpose (see below)
  - PuTTY and PSFTP on your Windows machine (as sshd and sftp clients)
  - WinRAR on your Windows machine if you don't want to burn a CD with
     the 'Bering-uClibc_2.2_iso_bering-uclibc.iso' file else burn a CD :-)
     WinRAR is really capable in browsing .lrp packages.

*  Steps

1.. Installing tools

   1.a
     Install 'sshd' and 'sftp' on your Bering machine (if not already
    done).
     Refer to these packages on Leaf site for help.
    You'll need 'sshkey.lrp' for initial installation (keys generation)

   1.b
     Install and configure PuTTY and PSFTP applications on your Windows
     machine.
     (available on http://www.chiark.greenend.org.uk/~sgtatham/putty/)
     Install WinRAR on your Windows machine
     (available as demo on http://www.rarlab.com/)

   1.c
     Install my 'local.lrp' package on your Bering machine:
          - copy local.lrp to a msdos floppy,
          - mount the floppy on the Bering machine
              ("mount -tmsdos /dev/fd0 /mnt")
          - install the package: "lrpkg -i /mnt/local"
          - umount the floppy


2. Getting initial set of Bering 2.2 software

   2.a
     . Create a 'C:\Bering' directory on your Windows machine
       Get 'Bering-uClibc_2.2_iso_bering-uclibc.iso' and
       'Bering-uClibc_2.2_img_bering-uclibc-1680.exe' files
       on leaf.sourceforge.net and put them in this directory.

   2.b
       Create a 'C:\Bering\Image_Floppy' directory; then execute
       'Bering-uClibc_2.2_img_bering-uclibc-1680.exe'
       application selecting File extraction only.
       Designate 'C:\Bering\Image_Floppy' as the destination
       directory.
       After execution the content of the floppy is available in this
       directory

2.c
Create a 'C:\Bering\All_Packages`directory and either using WinRAR
or having burnt a CD, transfer the content of
'Bering-uClibc_2.2_iso_bering-uclibc.iso' image file in this directory.


   2.d
      Get last versions of Bering 2.2 packages (those updated after the
      official release - see Package changelog)
      and update your directories' content accordingly.

   2.e
      Create a 'C:\Bering\Target' to receive (as a reference/backup
       repository) the final .lrp's

   2.f
      I create also a 'C:\Bering\Xfer' directory to receive temporary files
      for PSFTP (put and get)


3. Build the new release

   3.1
      Open an SFTP session between your Windows machine and Bering
      Change remote (Bering machine) directory to '/tmp'   ( "cd /tmp")
      Change local (Windows machine) directory to 'C:\Bering\Xfer'  (lcd
      command)
      Open a PuTTY session as root, and change your current directory to
      '/tmp'.

   3.2
      First, copy all files/packages which do not need modifications from
      'C:\Bering\Image_Floppy' to 'C:\Bering\Target'.
      I'm thinking of  'readme', 'log.lrp', 'config.lrp', 'syslinux.dpy'
      Same for additional packages from 'C:\Bering\All_Packages'

   3.3
      Now, select the first package which needs modification (e.g.
      'shorwall.lrp') and put a fresh copy in 'C:\Bering\Xfer'
      Using PSFTP, put this package on your Bering machine.
      Then via PuTTY session, issue the commands:

      "firewall#   cd /tmp"
      "firewall#   unzippackage shorwall"

      ("firewall# " being the current shell prompt).

This command will create a directory named 'shorwall' under '/tmp'
and unpack/explode the shorewall.lrp package.
Under '/tmp/shorwall' directory you will then find the usual
directory tree (etc, usr, var, ...) with all files pertaining to
shorwall package.
You can then edit configuration files (rules, params, interfaces)
either by copying current configuration files of your running
machine, or by editing them with the native editor (e3).
Do not use 'lrcfg' to perform this task because
this tool acts upon your current configuration, not the one in '/tmp/shorwall'.


      Once done, change your current directory to '/tmp' and issue the
      commands:

      "firewall#  cd /tmp"
      "firewall#  redopackage"

      'redopackage' will first rename the previous 'shorwall.lrp' to
      'shorwall.lrp.old' and then create a new 'shorwall.lrp' package
      using the /tmp/shorwall directory tree as its source.

     Finally, using PSFTP, get the freshly modified 'shorwall.lrp' package
     in 'C:\Bering\Xfer'

     Then copy/move it to 'C:\Bering\Target'

     You can use the command "cleanpackage.sh shorwall" to clean up your
      /tmp directory.


3.4
Repeat the same process for each package you wan,t to modify and put
in your new configuration.
'unzippackage' and 'redopackage' handle the special case of
'initrd.lrp' as well as with regular LRP packages.
While you're updating 'initrd', don't forget to eliminate
unused driver modules as well as integrate the ones you need
(network driver, pcmcia, ...) by tranferring via PSFTP the appropriate
modules (see C:\Bering\All_Packages\lib\modules\2.4.26\.......)


  3.5
     Finally, put (and later get) the 'leaf.cfg' and 'syslinux.cfg - or -
     isolinux.cfg' files to allow them being edited using the native
     Bering editor (no CR LF problem).


4 Build the final image

Depending on your configuration (booting from floppy, HDD, CD-ROM),
follow the usual process to build the final image using 'C:\Bering\Target'
as your reference.



That's all!

------ unzippackage
#! /bin/ash
#
# Unpack package in /tmp directory
#
if [ $# -lt 1 ]; then
  echo "Usage: `basename $0` <package> [<package>...]"
  exit 1
fi
#
PFX=var/lib/lrpkg
#
while [ $# -gt 0 ]
do
  f=`basename $1 .lrp`
  shift
  cd /tmp
  if [ ! -r $f.lrp ]; then
     echo "Package '$f' not found"
     continue
  fi
  [ ! -d $f ] && mkdir $f
  ( cd $f && rm -rf * )
  if [ $f = "initrd" ]; then
     PLIST=$PFX/$f.list
     ELIST=$PFX/$f.exclude.list
     TELIST=""
     zcat $f.lrp | dd of=/dev/ram bs=1k count=1500
     mount -t minix /dev/ram /$f
     cd /$f
     [ -f $ELIST ] && TELIST="-X $ELIST"
     tar cf - $TELIST `cat $PLIST` | tar xvf - -C /tmp/$f
     cd /tmp
     umount /$f
     freeramdisk /dev/ram
  else
     cd $f
     gunzip -c ../$f.lrp | tar -x
  fi
  echo "Package '$f' done"
done
#
exit 0

--------------------

------ redopackage
#! /bin/ash
#
#  Rebuild package.lrp from package directory
# in /tmp directory
#######################
#
PFX=var/lib/lrpkg
BCKINIT=/usr/sbin/lrcfg.back.initrd
#
cd /tmp
#
ErrEcho=echo
#
if [ $# -lt 1 ]; then
  set -- `ls *.lrp`
  ErrEcho=":"
fi
#
if [ $# -lt 1 ]; then
  $ErrEcho "Usage: `basename $0` <package> [<package>...]"
  exit 1
fi
#
while [ $# -gt 0 ]
do
  f=`basename $1 .lrp`
  shift
  if [ ! -d $f ]; then
     $ErrEcho "Package '$f' not found"
     continue
  fi
  echo "Package '$f' ..."
  PLIST=$PFX/$f.list
  ELIST=$PFX/$f.exclude.list
  if [ ! -f $f/$PLIST ]; then
     $ErrEcho "Directory '$f' is not a package repository - no list"
     continue
  fi
  TELIST=""
  [ -f $f/$ELIST ] && TELIST="-X $ELIST"
  [ -f $f.lrp ] && mv $f.lrp $f.lrp.old
  cd $f
  tar c -f - $TELIST `cat $PLIST` | gzip - >/tmp/$f.lrp
  [ $f = "initrd" ] && $BCKINIT /tmp initrd >/dev/null 2>&1
  echo "Package '$f' done"
  cd /tmp
done
#
exit 0
--------------------

Hope this will help

--
Christian - Grenoble






-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to