LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-20-2009, 01:18 PM   #1
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
How to make/configure script to extract, ecit and compress initrd.gz ??


OK
hey gang, haven't been here lately
working hard on my Lenny&3/4 debian live fluxbox edition

Now, I have totally modified the fluxbox desktop, modified and made a new remastersys
script(s), and have done some innovative things with the fluxbox styles and gkrellm styles
Instead of having "styles" folders in both /home and /root, and instead of having the same thing for all the gkrellm themes in both /home and /root
I made symlinks that link both to /usr/share/

Now, everythings great and the remastersys gui will now make a syslinux folder as well

anyway, I need a part of the remastersys script to extract,edit, and re-compress the initrd.gz

heres where I'm at
in this line of the script
it copies the kernel and initrd.img- to the working dir and makes the initrd.img into a initrd.gz

Code:
# make a new initial ramdisk including the live scripts
update-initramfs -t -c -k $(uname -r)

echo "Copying your kernel and initrd for the livecd"
cp /boot/vmlinuz-$(uname -r) $WORKDIR/ISOTMP/503box/vmlinuz
cp /boot/initrd.img-$(uname -r) $WORKDIR/ISOTMP/503box/initrd.gz
now, here I need the script to extract the initrd.gz, edit it and then compress it
Code:
mkdir -p $WORKDIR/ISOTMP/503box/tree
cd $WORKDIR/ISOTMP/503box/tree
zcat ../initrd.gz | cpio -i -d
at this point the initrd.gz is extracted in the folder "tree"
I then need to edit the script "live" in /tree/scripts/
so it says the booting dir is "503box"
instead of "live"
and change the "live-rw" to "503box-rw"

after editing it will remake the initrd.gz

Code:
find . | cpio -o -H newc | gzip -9 ../initrd.gz
and thats it

I just need to know how to make the script auto-edit the initrd.gz for me??
thanks

oh, heres a screen shot
http://multidistro.com/deb/503box-guest.png

http://multidistro.com/deb/exotic-guest.png

http://multidistro.com/deb/exotic2.png

http://multidistro.com/deb/exotic3.png

http://multidistro.com/deb/light1.png

OH, it has ALOT of apps!
ready for download by maybe thursday

Last edited by linus72; 10-20-2009 at 01:24 PM.
 
Old 10-21-2009, 01:01 AM   #2
Tux-Slack
Member
 
Registered: Nov 2006
Location: Slovenia
Distribution: Slackware 13.37
Posts: 511

Rep: Reputation: 37
You could make a bash script for that, just paste in all the commands as you're writting them, and for the editing, in which file must you edit that?
Anyway, for the editing of files through bash scripting, better wait for someone else, I'm not good like that in 'em...yet.
 
Old 10-21-2009, 01:49 AM   #3
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
Couldn't you use "sed" to edit the script...? If its a string of text ... Or use "mv" if your renaming a file...?

Last edited by manwithaplan; 10-21-2009 at 01:51 AM.
 
Old 10-21-2009, 04:57 AM   #4
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
thankx for answering guys

well, see the only part I'm stuck on is how to word the script so nano or leafpad opens up and you can then input/edit thee extracted initrd.gz, before its recompressed.

so, how do I call up a text editor from the script?
 
Old 10-21-2009, 02:07 PM   #5
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
I would set the global var for the editor, I usually use a case statement & ask for user input. Though if you want it to automatically open nano or vi, then export the global EDITOR var.
Code:
export EDITOR=nano
nano /tree/script

or

cat << "END"
Which editor would you like to use

1- for nano
2- for vi
END
 read key
  case $key in
     1) export EDITOR=nano
            nano /tree/script ;;
     2) export EDITOR=vi
            vi /tree/script ;;
 esac
Many different ways to do it... Just export the global EDITOR var and your set.

Last edited by manwithaplan; 10-21-2009 at 02:18 PM.
 
Old 10-21-2009, 03:57 PM   #6
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Your the Man!
thats what I'm talking about
my bash is still rough

remastersys uses gtkdialog I believe
would that work?
I want to integrate all this into the remastersys app so
when you make your remastersys backup/iso
it will let you choose how it boots
either via default debian live
which searches for a folder named "live" and a persistency file named "live-rw"

or you can choose a custom name for each

see, this is the part of the script "live" found in any debian live initrd.gz/scripts/

Code:
mountpoint="/live/image"
LIVE_MEDIA_PATH="live"

root_persistence="live-rw"
home_persistence="home-rw"
root_snapshot_label="live-sn"
home_snapshot_label="home-sn"
now, you can change the parameter
LIVE_MEDIA_PATH="live"

to whatever, I named mine "503box", and "503box-rw", so then i can boot alongside any debian live/grml, without any problems.

thats what I want to happen, for the end user to be able to edit the extracted initrd.gz
before remastersys finishes
thus customizing the customization

anyway, gonna try your advice
be back soon
 
Old 10-21-2009, 04:28 PM   #7
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
I dont have much experience with gtkdialog, though I have written a Funtoo installer with basic dialog. My bash also is novice, and I happened to recently build a script for installing pacman into my CLFS, and wanted to add an editor, so I tried this exporting the var and it worked...

I have been learning, and have been using pygtk. I have written a couple basic pygtk programs to edit my system config files and shutdown, suspend apps...

In gtkdialog, I bet you could open the file in a gtk window to edit... All gui like. I prefer pygtk, because I can import gtk, tk and bash and other gtk apps.

Or, you can declare the "LIVE_MEDIA_PATH=" variable at the beginning of the script, and ask for the user input. That way you can transparently rename the "LIVE_MEDIA_PATH=" using a sed.

Last edited by manwithaplan; 10-21-2009 at 04:30 PM.
 
Old 10-21-2009, 05:04 PM   #8
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
When are you going to update your multidistro toolkit..? I'm impressed with those screenshots. Even though I do use a separate drive for backups, I could use a separate toolkit distro on a disc. If you added clonezilla to the mix, that would be nice.
 
Old 10-21-2009, 07:20 PM   #9
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
well, I've been working on my 503box "pocketwriter" linux
trying either ubuntu-9.04 and debian lenny&3/4

I got lenny done, thats the screenshots above^

and, what toolkit?
ThorsHammer?

I know, I need to update it

its got pmagic, which has clonezilla

you want a special cut of what?
what distros you want?

I'm gonna upload my alpha of lenny&3/4 fluxbox tonite
you want link in morning?
it install to usb with unetbootin easy
and to hd via remastersys-install
goodstuff
 
Old 10-21-2009, 07:46 PM   #10
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
Ya, I was referring to Thor's hammer (your right about partclone)... My usb thumb drive stopped working recently, so I can only do a hd install.

I wouldn't mind checking out what you've done with lenny, those screenshots look really nice. Have you thought of using the Debian (Sid) testing branch..?

I see that you use gkrellm, what about conky ...? Post a link to your alpha build, and I'll give it a try.
 
Old 10-21-2009, 08:46 PM   #11
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
you can "install" thorshammer to hd by just copying iso contents to hdd and installing grub to that partition.

uh, squeeze and sid both ahave issues regarding squashfs-modules, which is essential for either
live-magic or remastersys
I actually have added some squeeze stuff, like flash,etc manually
thats why I call it Lenny&3/4

heres pkg list for 503box aka Lenny&3/4

http://multidistro.com/deb/packages.txt

its got iceweasel, opera
remastersys, live-magic
unetbootin
k3b
pcmanfm
lots of stuff

you can install start conky with fluxbox
via the startup script in /home/.fluxbox & /root/.fluxbox

heres part at startup

Code:
# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.
printinfotext "Running startup apps..." &
#yeahconsole --perl-lib ${HOME}/.urxvt-perl/ -pe tabbed &
systray-volume-control &
xset r rate 250 40 &
# xflux -z 22942
 yakuake &
fbpanel &
gkrellm &
# conky -d &
so, just uncomment conky and comment gkrellm
I didnt setup conky though
its got like 30 gkrellm themes
and alot of fluxbox styles too

xflux is very cool
just use -z for zipcode
or -l for latitude
it adjusts the color temp of your monitor
very cool and easy on the eyes

Code:
--------
Welcome to xflux (f.lux for X)
This will only work if you're running X on console.

Usage: xflux [-z zipcode | -l latitude] [-k colortemp (default 3400)]
protip: Say where you are (use -z or -l).
anyway, gotta upload this stuff

Last edited by linus72; 10-21-2009 at 08:47 PM.
 
Old 10-22-2009, 04:47 AM   #12
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
OK
here's the alpaha build 503box-Live iso
download Link:

http://multidistro.com/deb/503live.tar.bz2

thats a folder, compressed
inside is the iso, md5sum.txt, sme docs, an a readme

if you wanna run it from cd/usb/hd as persistent frugal
make a "503box-rw" file or partition

to make 503box-rw, using dd

Code:
dd if=/dev/zero of=503box-rw bs=1024M seek=1
that'll make a 1GB peristent file

this will make a persistent partition

Code:
mkfs.ext3 -L 503box-rw /dev/hdxx
and, if you wanna install to hdd, or a vm
logout and log back in as root
as the root apps seem to work best

so, hopefully you'll like it
 
Old 10-22-2009, 03:19 PM   #13
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
hey gang
so Manwithaplan
did you try it out?
anyone try it?

I need constructive criticism
Just note that the menus,etc are still a work in progress
 
Old 10-22-2009, 04:46 PM   #14
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
Just got to it ... going to try it tonight. I'll make a 1G file and and make rw, and give it a try. This could be handy for the netbook users that need a persistent OS, without all the bloat. I'll post feedback later tonight.
 
Old 10-22-2009, 06:31 PM   #15
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
OH
I forgot you gotta format the 503box-rw after making it

Code:
mkfs.ext2 -F 503box-rw
make sure you cd into the partition when you make and format it

and the 503box-rw Must be on a seperate partition from the 503box-Live system

just choose the persistent option at boot menu

I've already made some improvemebts today
and will upload a new one by tomorrow
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot make InitRd smeezekitty Linux - Newbie 3 10-07-2009 02:49 PM
[SOLVED] geexbox: cant extract files from initrd.gz schneidz Linux - General 5 06-28-2009 06:10 PM
cannot extract initrd.gz B-Boy Linux - Newbie 6 01-19-2009 07:05 AM
script needed to compress files kingkhankk Linux - General 2 03-04-2008 11:20 AM
Is it necessary to make the initrd? jacobselvin Linux - Kernel 3 08-19-2006 08:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration