SFS-TCZ_Linker-2.2.pet

Miscellaneous tools
Message
Author
User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#46 Post by WarMocK »

You're welcome, man. ;-)
This means that now I can fully implement your script into K-9 Linux and embed my SFS management framework into the ISO.
Oh, and I just realized there's still one little issue with the unlinking process: if there's a petget running while you try to unlink a module, it might occur that the unlinker takes a snapshot of the required libs BEFORE petget managed to add the installing dotpet's *.files to the package directory. Needless to say, that would be pretty bad if this dotpet would contain files that overwrite some of the symlinks.
A simple solution would be an Xdialog window telling the user that they need to make sure there are no other installations running while the SFS is unlinked. Add a yes-no option to the mix ("yes" starts unlinking, "no" cancels the process), and the prob would be solved as well. Of course, you could also use ps to check the system for running installation processes and either pause your own script or tell linux to pause the petgets and block any new instances of petget right away.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#47 Post by technosaurus »

jrb wrote:technosaurus,
This is the code that I used to create the symlinks from /mnt/SFSpackage to /

Code: Select all

cp -rs /mnt/"$SFSNAME"/* /
It doesn't overwrite other existing files or symlinks.
Wouldn't that generate an error message for files that exist that you could capture?
Something like

Code: Select all

cp -rs /mnt/"$SFSNAME"/* 2>>/tmp/DONOTUNLINK
then add a grep of /tmp/DONOTUNLINK in the unlink script (you may also need to use cut or something to remove the rest of the error message)

If the other way works though - that's great, just that sometimes find can be really slow
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#48 Post by WarMocK »

Damn, I knew there was something fishy about the whole thing with the modification.
@jrb: I think that diff is not the best way to check out what files are already there. I made a new attempt using "sort" and "uniq", which removes duplicate lines from the filedump before comparing it to a second dump with the sfs list included. These two dumps are then compared with sort AND uniq, sending only the unique files of the SFS to the standard output. Several checks with my .packages folder were successful, and it worked DAMN fast!:D

The code is:

Code: Select all

cat $HOME/.packages/*.files | sort -u > /tmp/dump0
mv $HOME/.packages/$SFSFILE $HOME
cat $HOME/.packages/*.files | sort -u > /tmp/dump1
sort /tmp/dump0 /tmp/dump1 | uniq -u > /tmp/difference
mv $HOME/$SFSFILE $HOME/.packages
Add this one to both the linker AND the unlinker, and use the generated difference list for adding symlinks or removing them (after you verified that it is a symlink at all). Please keep in mind that this check only works with the FULL list of the SFS content, otherwise you might accidently skip files that were added or removed after the sfs file was linked.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#49 Post by technosaurus »

@Warmock - sort |uniq is a nice useful combo especially with the latest busybox (use #! /bin/ash vs. #! /bin/sh)

this should give you the duplicates list in case you want an option for user override

Code: Select all

mv $HOME/.packages/$SFSFILE $HOME/$SFSFILE
cat $HOME/.packages/*.files | sort -u > /tmp/dump0
mv $HOME/$SFSFILE $HOME/.packages/$SFSFILE
cat $HOME/.packages/$SFSFILE /tmp/dump0 |sort |uniq -d > /tmp/duplicates #don't unlink automatically
#next line is optional depending on how you implement unlinking
cat $HOME/.packages/$SFSFILE /tmp/duplicates |sort |uniq -u > /tmp/difference #safe to unlink
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#50 Post by seaside »

I have alot of files that are not registered and probably others do as well.

This method of technosaurus's -

Code: Select all

cp -rs /mnt/"$SFSNAME"/* / 2>>DONOTUNLINK
would protect against removing files that should be kept and are not registered.

Another approach afterwards, might be something like this -

Copy SFSPACKAGE file to /tmp/SAFE-TO-UNLINK and then:

Code: Select all

for NAME in $(cat DONOTUNLINK)
do
  sed -ie "\|^$NAME\$|d" /tmp/SAFE-TO-UNLINK
done
This would match the linking errors (those files that couldn't be linked because they already existed) to the presumed installed SFSPACKAGE list and output a SAFE-TO-UNLINK list.

(Might even be faster - not sure, though.... :D :D )

s

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#51 Post by jrb »

OK guys,
Here it is. I used Technosaurus idea to generate an error list of files that already exist and then added that to the list of files contained in the sfs. Then I used WarMocks idea to sort and uniq the file list resulting in a list of files unique to the sfs and not already existing in the files system. This becomes the list of files that will be uninstalled. Seems to work very well.

I also took the precaution of putting in an abort if someone tries to install the same .sfs twice, without uninstalling. Not a problem before but now it would have resulted in an empty file list and no removals.

I used .pets and sfs's which contained some but not all of the same files. The only way I see to get in trouble is to install a .pet after installing a .sfs. I'm sure somebody will but what can you do?

Here's the new sfs_linker. Extract it, set it executable and place it in /usr/local/bin. If it works okay I"ll repackage the .pet and post it.

Bye for now, J
Attachments
sfs_linker-1.4.gz
For testing - extract, set executable and place in /usr/local/bin
(1.93 KiB) Downloaded 520 times

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

SFS-TCZ_Linker-1.4

#52 Post by jrb »

I have just uploaded SFS-TCZ_Linker-1.4.pet and sfs_linker_default_apps431-0.1.pet

SFS-TCZ_Linker-1.4 has some new safeguards against removing common files that were installed before the SFS that you are removing. I have also modified it to be Upup compatible.

Rather than have two versions of SFS-TCZ_Linker, one with modified /usr/local/bin/defaults and one without, I have made those into a seperate .pet for Puppy431. If you like them use this .pet. If there is a demand I will make .pets for other pups as well.

Enjoy, J

http://puppylinux.ca/members/choicepup/ ... et-md5.txt
http://puppylinux.ca/members/choicepup/ ... et-md5.txt

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#53 Post by WarMocK »

Hey jrb,
a dotpet installed after the sfs was linked shouldn't pose a problem if you both compare the original filelist of the sfs to the list of installed files (which also should have the *.files of the installed dotpet in it) and make sure the file you're about to delete is a dead symlink. All you need to do is to make sure there are no alterations to the filelist after you took a snapshpt of the .packages directory and sorted out the files that were not listed in the other *.files

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#54 Post by jrb »

WarMock wrote:a dotpet installed after the sfs was linked shouldn't pose a problem
I think I have workable solution. I"ve built a little script for sfs_unlinker:

Code: Select all

	#jrb - compare SFS filelist with other installed filelists.  
	#Duplicates should not be uninstalled
	mv /root/.packages/$SFSNAME.files /tmp/$SFSNAME.files 
	cat /root/.packages/*.files > /tmp/installedpackages.files
	cat /tmp/$SFSNAME.files >> /tmp/installedpackages.files
	sort /tmp/installedpackages.files | uniq -d >> /tmp/$SFSNAME.files
	#jrb - send twice to make them duplicates
	sort /tmp/installedpackages.files | uniq -d >> /tmp/$SFSNAME.files  
	sort /tmp/$SFSNAME.files | uniq -u > /root/.packages/$SFSNAME.files
As you can see it moves the SFSNAME.files to /tmp from /root/.packages then creates a new list of all the other installed files and then compares the SFSNAME.files to that, creating a new /root/.packages/SFSNAME.files with only files unique to the SFS listed.

Haven't much time to test right now but will work on it this weekend.

Thanks for the inspiration, J

OldYogi
Posts: 27
Joined: Sun 13 Jan 2008, 01:08

#55 Post by OldYogi »

Jrb,

this looks excellent. I have two dumb questions:
first -- I'm running the alpha version of Puppy 4.4 (i.e. Pupply 4.31-2) which has SFS Linker installed. Somehow I deleted the sfs_mnt_home folder in ~/my_links on the desktop. How do I restore it?

second: will this handle tcz files without modification? There is a link in the menu to the Tiny Core repository, but it isn't clear whether those are sfs3 or sfs4. I know they can be converted -- but will that happen automatically?

thanks.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#56 Post by jrb »

OldYogi wrote:Somehow I deleted the sfs_mnt_home folder in ~/my_links on the desktop. How do I restore it?
I'm a little puzzled. If the SFS_TCZ_LInker script in Puppy4.4 is the same as mine it should make a new /root/my_links/sfs_mnt_home folder automatically after rebooting.

Have you tried opening that folder and making one manually? Rt-click in the folder, choose "New" - "Directory" and name it "sfs_mnt_home". Try that and let me know if it disappears.
will this handle tcz files without modification?
Yes. The .tcz files listed in that website are all SFS4's. Older tinycore .tcz's are SFS3's but they are in a different directory at ibiblio.

Keep me posted, J

reckrhodes
Posts: 116
Joined: Wed 30 May 2007, 08:15

#57 Post by reckrhodes »

Hello jrb!

This linker to sfs is a very useful one. Thank you so much for this. The improvements are so good. Hope that this contribution of yours will be included in all official or community pupplets.

I tried using the lucid puppy and it works so fine. Just converting the pet to tar.gz(pet2tgz) and copying tar.gz contents to a directory and converting directory to sfs(dir2sfs) is enough to load using your sfs linker.

Thanks also to sir BK and the Puppy Linux community.


Have a great day! :D :D

Eric
Cebu, Philippines

OldYogi
Posts: 27
Joined: Sun 13 Jan 2008, 01:08

#58 Post by OldYogi »

Jrb,

Yes, I did recreate the sfs_mnt_home directory -- but on reboot it doesn't pick up the Opera.tcz file.

I'm booting off of a usb, and as I have two versions of Puppy there, each in its own subdirectory, I put the .tcz file both in the top layer of the usb (mnt/home) and in the subdirectory (mnt/home/Puppy4312). But either way it doesn't display in sfs_mnt_home, which I assume it should do. When I click on it directly to install with sfs linker it turns up in the next folder in /my_links, suggesting it is loaded, an icon appears in the System menu, but it won't run.

I'm puzzled.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#59 Post by WarMocK »

@OldYogi,
did you run it from a terminal (like rxvt) as well? If you haven't done this yet, you should give it a try and see what error messages it gives you. In case it DOES give you some error messages, redirect the error output into a text file and post it here so we can see what's going on:

Code: Select all

$nameofprogram > /tmp/erroroutput

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#60 Post by jrb »

OldYogi wrote:I put the .tcz file both in the top layer of the usb (mnt/home) and in the subdirectory (mnt/home/Puppy4312). But either way it doesn't display in sfs_mnt_home, which I assume it should do.
It should, but it doesn't. The version of SFS Linker (1.2) in Puppy4.4 doesn't link .tcz's from /mnt/home to /sfs_mnt_home. An oversight on my part. Install the latest version (1.4) and it wil.
but it won't run
TinyCore breaks everything down into the smallest possible .tcz units. This is the list of dependencies from opera10.tcz.dep:

Code: Select all

qt-4.5-base.tcz
expat2.tcz
fontconfig.tcz
In actual fact puppy already has the last two. You only neet to install qt-4.5-base.tcz.
WarMock wrote:did you run it from a terminal (like rxvt) as well?
WarMock is exactly right. If you open a terminal and type

Code: Select all

opera
it will tell you any deps that are missing. You then have to track them down and install.

OldYogi
Posts: 27
Joined: Sun 13 Jan 2008, 01:08

#61 Post by OldYogi »

Thanks,

I'll try it when I get home this evening and report back.

home now, 10:30, and I am writing this from inside Opera 10.10. Everything works exactly as you said, and as it should Thank you.
Running Opera from rxvt, I get the message that libjvm.so and libawt.so from LD_PRELOAD cannot be preloaded. Opera works fine, so I won't worry about it.

Thanks for the help

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#62 Post by technosaurus »

The one remaining irritant is the linking of symlinks when the file that it links to is not on the sfs.

(the .so files in the DEVx.sfs for example, where the files are expected to be on the existing file system instead)

solution would be to check if each file is a symlink and if so, just copy it
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#63 Post by technosaurus »

http://distro.ibiblio.org/pub/linux/dis ... ymlinker.c
hmmm.... I may compile this tonight just for grins since tcz=sfs(4)[/img]
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Dingo
Posts: 1437
Joined: Tue 11 Dec 2007, 17:48
Location: somewhere at the end of rainbow...
Contact:

#64 Post by Dingo »

Dear Technosaurus

some time ago I announced to be happy since I found sfs-linker makes possible mount ands use a devx sfs from LIVE CD

Now I investigated better and more in deep

see image attached, it represents /usr/lib/ after devx mount (with sfslinker latest version)

several symlinks seem broken, the strange is that are pointing to files supposed in devx. Maybe this is a union/aufs limit? devx can't be used fully without frugal install at least and a reboot?

Image
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#65 Post by technosaurus »

the links are pointing to the symlink in the sfs which is in turn pointing to a library that doesn't exist in the sfs (it is actually in the main sfs)
- this means that to function properly symlinks need to be copied NOT symlinked

something like this: (oversimplified for clarity and laziness)

Code: Select all

if [ -h $FILE ]
then
 cp $FILE $DEST
else
 ln -s -f $FILE $DEST
fi
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply