Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: yet another way to make dsl files, using apt-get, find, grep, and tar< Next Oldest | Next Newest >
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Aug. 11 2004,02:23 QUOTE

There are a lot of ways to make DSL files.  I'm a huge fan of deb2dsl, but I've noticed that a few deb files defy being made into dsl files by using that script.  I've been able to make some of these into DSLs by using the following method, although if deb2dsl works (and most of the time it works fine) I like to use it.

First I load the dsl-dpkg.dsl and gnu-utils.dsl using emelfm and the MyDSL button.  dsl-dpkg.dsl contains dpkg and apt-get, with which you get and install the deb files and dependencies from Debian, and gnu-utils contains the -cnewer switch for the find command which you need for this method.

Next, I become root with a sudo su command.

Now edit the /etc/apt/sources.list file with your favorite editor.  Change the word "stable" to "unstable" on the second line.  You need to do this because some of the other parts of the DSL installation are from the unstable packages, and this keeps you from un-installing and re-installing those packages to make things work.

apt-get update to get the latest file lists from the unstable packages.

Make a file to use as a time marker.  We want to keep files created after this point, and this file acts as a time stamp.  I like to use touch mymarker, which make a zero byte file.

Install your application with apt-get install mypackage (in my case I used apt-get install freecraft).

Once your installation is finished, with no errors, this would be the place to try using deb2dsl.  Your package did instally correctly right?  No errors?  In a perfect world, this is your last step.  But if deb2dsl worked, you wouldn't need the rest of this procedure, would you?  If you know it didn't work there isn't any need to try it now.

Now you need to make a list of all of the files that have been changed since you began the installation.  You do this with the find command.  I used:

find / -not -type 'd' -cnewer mymarker | sort > myfiles

find / looks for files in the / directory and it's subdirectories.  The -not -type 'd' switches select everything except directories.  In other words, it finds both files and links, but doesn't print out directories.  The -cnewer mymarker part looks at files modified after the mymarker file was created.  sort puts every line in alphabetical order so you can read it easier.

Now I used grep to remove lines from the /dev, /proc, and /KNOPPIX directories using the -v switch.

cat myfiles | grep -v "\/dev\/" | grep -v "\/proc\/" | grep -v "\/KNOPPIX\/" > mydslfiles

I opened the file up in an editor (scite) and removed the *.deb files and basically looked around for other things I could trim (like the dsl I made with deb2dsl in my home directory).  Then I wrapped the whole thing up with:

tar --numeric-owner -czvf freecraft.dsl -T mydslfiles

The -czvf switches are for creating a tar, with gzip compression, verbose output, using the following name for the archive.  The -T switch tells tar to read the files to include in the archive from the following file.

I saved my dsl somewhere permanent, and then re-booted my live CD, and dumped and extracted all of the files to a temporary directory:

mkdir temp
cp /mnt/hda1/optional/freecraft.dsl temp
cd temp
tar -xzvf freecraft.dsl


I put the etc directory under the ramdisk directory.  We don't want the /ramdisk directory, but we can get rif of it be clever re-tarring.   Create a ramdisk/var/tmp/mydsl.menu directory containing a file called freecraft with the line:
[exec] (freecraft) {freecraft}

Change the mode on this file to 644 with chmod 644 freecraft

I re-tarred the package while I was in the ~/temp/ramdisk directory using tar --numeric-owner -czvf freecraft.dsl *

It's not nearly as easy and convenient as deb2dsl, but sometimes this way works for me when the other way doesn't.  I know it's dangerous and cavalier, so it might not be good for those with a HD install.  Any improvements (and there must be) or comments (and you know you have one) are welcome.
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Aug. 11 2004,11:10 QUOTE

ke4nt1 pointed out to me I should have added the --no-recurion switch to my last tar statement, making it:

tar --no-recursion --numeric-owner -czvf freecraft.dsl *


I didn't think I needed it for the first tar, but the second tar does need it because the files were added from * and not from the file list.
Back to top
Profile PM 
clivesay Offline





Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: Aug. 11 2004,11:15 QUOTE

I am curious if this method would work for those packages that have debs with scripts since you are documenting what files are changed in the system after install? If that's the case, there wouldn't be much left that you couldn't include in a .dsl.

Chris
Back to top
Profile PM MSN YIM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Aug. 11 2004,13:26 QUOTE

Yes, I used this method for just that reason.

Take mySQL, for example.  Let's say you got it to work from the liveCD by replacing shadow files so that useradd and groupadd work, you added a user named uucp (because for some nutty reason one of the install scripts wants to see it), you replaced the /etc/mailname link with a copy of the file in KNOPPIX, and you run apt-get install cron and the apt-get install mysql-client mysql-server (the unstable packages).  It downloads packages, runs through it's setup scripts, and hey, look at that, it works.  deb2dsl doesn't work, but looking at changed files does.

The problem is, you get anything that changed, and that's not always a good thing.  Remember those password and group files?  Those files get added, in fact the dsl won't run without them because mysql adds a user and want to see it.  What happens when some stranger, a very nice stranger who happens to have a HD installed version of DSL, runs your new dsl file?  He looses any users and passwords he's added or changed.  Oh, and his mail is screwed up.

So it can do the difficult packages, but there are other reasons why some things like mySQL are such a bear.  Just because you can make a dsl for your own use in this fashion doesn't mean it's safe for general consumption.  You need to look closely at the file list and make sure it won't submarine anyone.
Back to top
Profile PM 
3 replies since Aug. 11 2004,02:23 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: yet another way to make dsl files

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code