LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 06-13-2012, 05:49 PM   #1
CincinnatiKid
Member
 
Registered: Jul 2010
Posts: 454

Rep: Reputation: 47
Package Management Hints


I have looked through a lot of the hints on this page: http://www.linuxfromscratch.org/hints/list.html

What do the majority of LFS users use, is there something that is more common in this community?

What I am doing currently is keeping all of the source in ~/Packages. This is starting to take up a lot of disk space, and all I have his Base LFS/X/Fluxbox/Web Browser/File Browser.

I did not keep all of the source from the beginning, for example, for most of X, I deleted the source, but after X, starting with Fluxbox install, I started keeping the source.

Do you have any suggestions.
 
Old 06-13-2012, 07:24 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
When I was using (C)LFS, I never kept the source once I installed a package. If I needed the source again, I just downloaded it from the internet. If you gotta keep the source, I would at least limit that to the tarballs, not the uncompressed source.
 
Old 06-13-2012, 08:52 PM   #3
CincinnatiKid
Member
 
Registered: Jul 2010
Posts: 454

Original Poster
Rep: Reputation: 47
So, if you needed to uninstall an application (and didn't know everything that it installed so that you could do it manually), would you just do a make uninstall on the source that you re-downloaded from the internet? If that is what you did, did it seem to work fairly well as far as a system for package management? Thanks.
 
Old 06-13-2012, 08:54 PM   #4
CincinnatiKid
Member
 
Registered: Jul 2010
Posts: 454

Original Poster
Rep: Reputation: 47
I figured another advantage to keeping all of the packages would be that I could do a "ls ~/Packages" to see everything that is installed. In addition I could cd into the directory and uninstall the package if it had that feature.
 
Old 06-13-2012, 10:09 PM   #5
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
For the make uninstall to work (assuming the package has an uninstall target in the Makefile), you would need to ./configure and make it first. Obviously, you would need to ./configure it with all the same options as the first time.

I didn't uninstall packages because I didn't install things system-wide that I didn't KNOW I needed. If I wanted to try something, I installed in a temporary directory in my $HOME (I use $HOME/MySystem for example). That's what I do on my Slackware boxes too. After I test and evaluate the package in $HOME/MySystem for awhile, I would install it system-wide. If I found the package to be buggy or it failed to meet my requirements, it's pretty easy to rm -fr $HOME/MySystem.

For those packages that DID get installed system-wide, I always did an echo package_name.package_version >> installed_packages.log. A simple text file takes up a lot less room than all that source code.

In the interest of complete disclosure, I also futzed around with RPM on one of my CLFS boxes. It works and isn't too hard to do, but writing all those spec files is a PITA; especially when you're only supporting a half dozen machines.

Additionally, I hacked Arch's package manager to work on my CLFS box. A little harder to do and I don't think I ever got it working exactly correctly. It was still easier to simply rebuild the entire system every few years.

Last edited by weibullguy; 06-13-2012 at 10:14 PM.
 
Old 06-14-2012, 05:22 PM   #6
CincinnatiKid
Member
 
Registered: Jul 2010
Posts: 454

Original Poster
Rep: Reputation: 47
I took the route of the installed_packages.log idea and deleted all of my source packages. I will do what you did, and test packages carefully in $HOME before I install system wide. Thanks.
 
Old 06-14-2012, 11:02 PM   #7
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Good luck.

Another point I should make is this...if the package is in (C)BLFS, I generally wouldn't hesitate to install system-wide without jamming it into $HOME first.
 
Old 07-17-2012, 08:17 AM   #8
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
First I should start by saying I don't use LFS but I do have a tendency to occasionally install stuff outside of whatever is the local package manager of the distro I am working on at the time (even those with big repositories are always missing something). There are some nice tools to help you keep track of stuff you install this way (e.g. paco) but to be honest I usually just knock up a short shell script that runs a couple of find commands and diffs the difference to create a log of newly installed files, like so:

Code:
#!/bin/sh
BEFORE=$(mktemp -t before.XXXXXX)
AFTER=$(mktemp -t after.XXXXXX)
INSTALL_LOG=$(basename $(pwd))_install.log
find /bin /etc /lib* /opt /sbin /usr ! -type d -print > $BEFORE
$@
find /bin /etc /lib* /opt /sbin /usr ! -type d -print > $AFTER
diff $BEFORE $AFTER | sed -n 's/^> //p' > $INSTALL_LOG
echo "Created: $INSTALL_LOG"
I save the above with an appropriate name (e.g. loginstall) somewhere in my $PATH and make it executable. Then I can just just preface it to any install command I wish to track, e.g.:

Code:
loginstall make install
or perhaps:

Code:
loginstall ./VirtualBox-4.1.18-78361-Linux_x86.run
When the install is done a suitably name log file will be created, listing all the files that were installed. After I install software move the log into /var/log/footprints, so that I can reference it later.

These logs can be used to remove files or create a backup of the software using tar or cpio. For example, to to create a backup of the installed files using cpio:

Code:
cat logfilename | cpio -ovHnewc | xz > packagename_backup.cpio.xz
Or with tar:

Code:
cat logfilename | tar cvJPf packagename_backup.tar.xz -T-
Note: It is also possible to recreate the logfile by doing a file listing on one of these backup packages.

To remove files I can switch to root and issue:

Code:
cat logfilename | xargs -d'\n' -n1 rm -v
You will note that I only log files that are created, not directories. This is trick I picked up from paco and is done for several reasons. It keeps the logs less bloated (smaller), it allows for simple "one liner" uninstall commands like the one above and finally most directories end up being shared among many packages, making it trickier to work out which to remove. For the most part empty directories have little effect on your system and are safe to ignore. If it ever bothers you you can always construct a find command using the "-empty" option to track down old empty directories that you might want to remove.

P.S. Here is a demo video of how this works http://shelr.tv/records/500549a696608020cc0000ce
 
Old 07-18-2012, 12:28 AM   #9
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
Just one more tip, if you add a reference to the log itself as its last entry, the uninstall command will also remove the log, e.g. say you have a log called /var/log/footprints/example-1.0 that looks like this:

Code:
/usr/local/bin/example
/usr/local/share/man/man1/example.1.gz
Add a reference to the end like so:

Code:
# echo /var/log/footprints/example-1.0 >> /var/log/footprints/example-1.0
Now the uninstall command removes everything, including the log.

Code:
# cat /var/log/footprints/example-1.0 | xargs -d'\n' -n1 rm -v
removed `/usr/local/bin/example'
removed `/usr/local/share/man/man1/example.1.gz'
removed `/var/log/footprints/example-1.0'
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Slackware 13 over 12 - HP nx7400 - driver / package management hints? upperlink Slackware 2 09-21-2009 03:10 AM
LXer: Simple Package management with Synaptic Package Manager LXer Syndicated Linux News 0 12-05-2006 06:33 PM
Hints about log management software: IPTABLES and SQUID Thakowbbery Linux - Networking 1 05-13-2006 02:17 AM
Using Package Archive style package management mugwump84 Linux From Scratch 3 08-25-2005 05:19 PM
Package management? darkRoom Linux From Scratch 9 06-04-2004 10:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 08:35 PM.

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