Listing Non Stock Slackware Packages
I seem to recall reading this somewhere. I want to create a list of all non stock Slackware packages I have compiled and installed.
I don't use slackpkg or anything like that. I'm guessing these tools do what I am asking, but I prefer to stay away from those tools. I'm just looking for a simple script or two. Thanks to anybody who can point me to some links for some simple scripts, if they exist. |
slackpkg will do what you want, but I understand not wanting to install it just for that (I don't use slackpkg either). I don't know of any existing scripts, but I was interested enough to write a simple script myself. You should be aware that my scripting skills suck (and the form definitely isn't perfect), but it seems to work for me. If anyone notices glaring errors, feel free to correct them. I browsed the output of the script on my box and it looked like everything was there, and nothing was extra -- but again, my scripting skills suck. :)
[EDIT]Note that version 2 of my script is in post number 7, and I think it's a big improvement. If you want simplicity in design, choose this (V1) of the script. If you want simplicity in use (it now has command-line parameters), and better filtering (it now includes extra/ in addition to patches/), choose V2 of the script. This one's fine, it's just not as feature-complete. Do what you want though. :)[/EDIT] [EDIT2]OK, version 3 (probably the last version) is in post number 9. It fixes a parsing dilemma from version 2 when trying to list all official Slackware packages that are NOT installed, EXCLUDING any upgrades by the packages in the patches/ directory. I would recommend either using version 1 or version 3 -- version 2 can safely be left by the wayside. Version 1 is still a nice SIMPLE script that does what it was designed to do and nothing more -- it detects non-Slackware packages on your system (but it doesn't distinguish extra/ packages from actual non-Slackware packages). Version 3 does a little more, as you can see by reading post number 9.[/EDIT2] Code:
#!/bin/sh |
Do you build your own, or install pkgs built by others?
|
Code:
cd /var/log/packages |
Quote:
Shame I chose package_name-version-arch-revision as my naming scheme for my home built packages where revision==numeric. Bummer !! Should have researched this more before deciding on a naming scheme... Nice simple little regex though. Thanks.. |
T3slider, I used your basic script, revised to my taste, and the script works great. Tip of the hat to you!
I maintain the recent version and current trees on my hard drive, therefore I did not need to use wget. I added the following to the script: VERSION="`cat /etc/slackware-version | awk '{print $2}' | sed -e 's/.0//'`" I then added a quick error check: ROOTPATH="/home/public/slackware/$VERSION" if [ ! -e "$ROOTPATH" ]; then echo "The directory $ROOTPATH does not exist. Exiting." exit 1 fi I converted all the various txt file names to variables. From long ago I obtained three pkg information scripts from here at LQ. To help me remember the name of this new script and maintain consistency with the names of those excellent scripts, I named this new script diffpkg. I then added the following at the beginning of the script: # original script written by T3slider at # https://www.linuxquestions.org/quest...ckages-642787/ Good job! Quote:
Quote:
These days I search fervently for a build script and roll my own package. I am in the process of gradually replacing downloaded packages with my own. Hence, this thread, which I now hopes helps others too. Quote:
Thanks again everybody! |
Looks like my commenting was messed up (or I got lazy and forgot to add the comment for the last `diff` command -- also, the commenting for parsing the FILE_LIST file is messy and incomplete). I've decided to update my script (it's now more complex but easier to use. In addition, it no longer requires downloading the FILE_LIST file since the FILELIST.TXT file also includes the patches directory).
Quote:
Woodsman, good to hear it works. Using variables etc. is a way better idea (and I know how to use variables too, I was just lazy). It's probably also a good idea to set the filename variables to an absolute location (so you won't get messy files all over the place if you run the script from a different folder). My new script takes care of this as long as you set the FILEDIR variable properly. Quote:
Quote:
Here is my version 2.0 of the script. It now contains variables for just about everything you would want to change (and a few of them, like ROOTPATH and FILEDIR, can be passed on the command-line. This is important -- if FILEDIR and ROOTPATH are not set to an absolute location, files will be downloaded and/or created in your current directory. You can override this by either adding absolute locations to ROOTHPATH and FILEDIR [which point to the same place by default] or by specifying a directory on the command-line when you execute the script). In addition, I've added parameters that allow nice, easy output to the screen. The parameters are shown if you run the script with the --help option, but basically you can see what patches you have installed, what patches you do NOT have installed/are out of date, the packages in extra/ you have/don't have installed, the core slackware packages you have/don't have installed*, and the non-Slackware packages you have installed. *Make sure to read the help for this -- an interesting parsing problem is preventing me from excluding patched packages from the not-installed-Slackware-packages list without too much effort. That is a design-flaw in my script, so as of right now you'd have to compare your -sN output with your -p output to see which not-installed Slackware packages are ACTUALLY not installed instead of just upgraded. If no one uses/wants this script, it's really OK -- this is helpful for keeping track of my system (and the script should work for much time to come). Without further ado, here it is. Code:
#!/bin/sh |
Quote:
Quote:
And the great reg ex example above will help me know which packages were long ago installed but not built by me locally. All in all, a great thread everybody. Thanks! My reason for wanting to know all the non stock packages installed is I am slowly building a bare metal recovery punch list. I have a decent backup plan (a how-to eventually will appear at my web site), but I wanted to know which packages I would need to rebuild and install too. Every little piece of information helps. :) There ought to be a place (web site) for storing useful Slackware scripts like these! |
OK, I fixed the parsing problem, so I am releasing version 3 (my final version unless I feel like adding features or unless one of my loyal zero users request a feature). The ONLY things you will have to change are the variables at the start of the script -- no more commenting of the wget line is required if you use a ROOTPATH (it tests for it). I also added an option to delete the files that were created when running the script (in case you have other .txt files in there and forget which ones were created by the script, I guess). Now, the -sN option outputs only the official Slackware packages (in the slackware/ directory) that are NOT installed. Any packages that were UPGRADED by the packages from the patches/ directory will NOT be listed, as it should be -- ONLY the packages that are truly not installed on your system are listed. I "borrowed" part of upgradepkg's parsing code, so the license had to be included (and therefore the script is enlarged because of all of the commented code).
This little script has really grown to be a nice utility that can be used to see what's on your system. It can tell you if your system is not up-to-date (ie if there are packages in the patches/ directory that you don't have -- not important for -current users, obviously, but useful for people that stick to a stable version), can help you remember what you installed from the extra/ directory, and tell you what you did and didn't install from the slackware/ directory -- and, of course, which extra, non-Slackware packages you have added to your system. Every option outputs the desired package list to standard output, so you can redirect it into a file or something if you wish (although several files are created, only one of them contains actual useful output -- $DIFFPKGS). I can't really think of anything else that needs to be added to the script, so this'll probably be it. I'm sure it won't receive much use, but that's OK with me -- at least I have a nice utility that I can use. The script is posted below, along with the --help menu, in case anyone still doesn't know what the script does. Code:
Usage: ./diffpkg.sh [options] Code:
#!/bin/sh [edit2]After testing the -sN option with an improper name format in $SLACKPTCHS (which shouldn't happen since Pat controls that -- but it creates a potentially infinite loop if the package name is in the wrong format), I fixed the parsing formula (I added a small check to ensure there is at least one '-' in the package name). Without the modification, a package name like "aaabase" or something, without any '-' characters (which was used a LONG time ago) would cause an infinite loop, rendering the -sN option useless as long as that filename is in $SLACKPTCHS. I think everything's fixed now, so I probably won't be adding/modifying the script further (unless of course my loyal zero users request a feature or I feel like expanding the script). On a side note, I really like the `whichpkg` script that gnashley posted (it's better than using the Slackware package browser) and the `pkginfo` script. I modified the `lspkg` script to utter simplicity since the wild-cards were actually making it less useful in my opinion (`lspkg *fusion*` wouldn't find compiz-fusion-blahblahblah, for example), but the modified version (6 lines including error-checking) is very helpful. :)[/edit2] |
Great thread with some interesting discussion and scripts.
Quote:
See my HowTo: Upgrade Slackware 12.0 to 12.1 for some examples of using slackpkg. |
Slackpkg can also be used quickly and easily to list the non-Slackware
packages in your system, without using it to update or install anything. |
Quote:
|
Since th geekster's 'whichpkg' got mentined here, I'll throw in another. In 2001, Cameron Kerr wrote a script called 'whichpkg' which searches through a MANIFEST file for your search string. I updated the script to work with MANIFEST.bz2 files. I find this program more useful than the geekster's. Usually, when I need to find out what package a file belongs to, it is because the file is 'missing'. Using this script then tells me whether the file is available in an official Slackware package, by searching all the packages available listed in the MANIFEST.
Code:
#!/bin/sh |
Quote:
Code:
#!/bin/sh @ShadowSnipes: Figured I may as well put "my" fancy script here. ;) (thanks) @all This is one good reason to install slackpkg if for no other reason then to quickly list non-standard packs. |
Quote:
|
Quote:
One task, one tool. Your script fits the bill. I'm still using your original script along with my minor modifications. I run the script hourly through cron and save the diff file to two different physical locations --- on my primary drive and my secondary drive. Both diff files get backed up daily and weekly. Should I ever have to rebuild bare metal (gulp!) I should have access to a list of non stock packages --- somewhere. :) Eric's rsync scripts, which I modified slightly to my needs, also satisfies the idea of one task, one tool. I run the scripts daily through cron and maintain my patches and current trees. Simple and straightforward. We live in a big world where there is almost always more than one way to solve a problem. Simple one-task scripts work for some, more complicated scripts like slackpkg work for others. To me that is one of the advantages of free/libre software and Slackware --- very little is shoved down our throats. We each get to choose our path and comfort zone. :) Thanks again for your efforts on this thread. |
Good thread!
It seems to me that the best thing is to install all non-stock packages in /usr/local. Apparently installpkg and removepkg allow this if you add -root /usr/local to the command line - I haven't yet tried it though. |
Quote:
If a package was compiled to use /usr instead of /usr/local then there is no way you can install it to /usr/local and expect it to work. The only option is to recompile it using a prefix of /usr/local instead of /usr . Eric |
Quote:
If I compile a SlackBuild package I cannot change the configure options since they relate to the location of where the package is to be created - by default /tmp. Either installpkg or SlackBuild etc. should provide an option to specify a different target directory area. I've started only recently using SB and the other packages - before I would always compile myself - to /usr/local of course. That's messy because it's difficult keeping track of the programs and their related components. Now, I am now regretting having installed packages to the stock core system - especially because of the problems when installing a new system or updating the old system - as this thread has revealed. If a package is not part of the distro - it should be installed to /usr/local. I suppose I'll have to hack my own version of SlackBuild. |
Quote:
Code:
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp And: this location has nothing to do with the software's "configure" command parameters. The "configure --prefix=/usr" just means that the resulting software (not the Slackware package) is going to use /usr and the directories below that (bin, share, man, ...). Please do not confuse the two. Quote:
And exactly for that reason, I would advise to create only packages that install themselves into "prefix=/usr". It does make the compilation of other software that depends on it, easier afterwards. And any software that you manually compile and install (./configure && make && make install) will by default install itself with a "prefix=/usr/local" which is good because it enables you to quickly wipe anything you ever compiled - by going onto /usr/local and deleting the stuff you find there. You will be certain that there is no proper Slackware package (official or 3rd party) that installed itself to /usr/local . You keep packages and locally-compiled software nicely apart this way. Eric |
I just ran installpkg -root $HOME/local as a non-root user.
It couldn't update /var/log etc. nor could it run ldconfig, of course, because of the permissons, but it did install correctly to my home directory. Running it as root, it installed the package, but still had problems writing to /var - this time without complaining - because there is not record of the installation there. Hence removepkg failed since there was no record of the installation. This is just for info, to see what happens if one uses the "root" option as I though it could be used. |
I would like to add that Eric (Alien Bob) has created Alien's SlackBuild Toolkit,
an online SlackBuild script generator that you can use as a template for making your own Slackpacks. It is serving me very well. Thanks, Eric! |
Quote:
Quote:
Up until now all software I had installed myself (/usr/local) would simply be remounted after a clean install. In /usr, I would have to re-install all the packages again. Even if I changed the configure options within the SB script - the install log would be in /var - not in /usr/local/var - and hence be missing in a clean install. I would like install/removepkg to respect the /usr/local prefix and open a separate /var/log under /usr/local thus providing a clean separation between the stock system and the local additions, since the local subdirectories persist after a clean installation. The two parts should be kept separate since their origins and fate are separate. So at the moment, by changing the SB script I could install to /usr/local - but would lose all records of it and the ability to use removepkg after a clean install. Thanks again for clearing up the misunderstandings that crept into my head, Eric - I was working late last night - I must have been more tired than I realised :) |
Quote:
|
Quote:
No. Because they're registered to the package manager which you've since wiped along with the rest of the "core" install. If you register something with the package manager you're saying "This package? It's now core to me. Look after it for me." If you don't want it managed that way then do it the old fashioned way: ./configure --prefix=/usr/local && make && make install You cannot have a core system with tools and expect those tools to exist anywhere outside of that system (slackware + pkgtool). It doesn't matter how you slice it, a clean install will (as far as the package manager is concerned) remove records of anything the system considers core, and since you've told the system these new packages are also core ... poof. What you can do is look at it another way: the only thing that is required for the pkgtool to understand about a package is the log in /var/log/packages/<packagename>. So if you can ensure a package that you build does not encroach on territory outside of /usr/local (/etc for example), you can mirror your 3rd party (non-core/unmanaged/etc) install logs elsewhere. On a clean install, copy the log back and magically pkgtool remembers how to remove that package and is therefore managing it again! What you may wish to look into are things called tagfiles, with which you can build your own installable catergories, so reinstalling previously built packages doesn't become a burden. This is a much better solution than the above, imo. 30 seconds on google brought me this: http://www.bilbos-stekkie.com/tagger/tagfiles.html I daresay you'll discover a whole stack more information with a bit of patience and the right key words. Finally, here are some ideas for you to chew on that should help future posts. Crucially, the only difference between a "slackbuild package" and an "installpkg package" is that slackbuild is a 3rd party site so the available packages there are not part of core slack release, unlike the latter. slackbuild: script that generates a (Slackware) package from given source code and associated patches package: gzipped tar containing (usually) binary files and an install script pkgtools: collection of (Slackware) package management tools including: - installpkg - removepkg - makepkg Best regards, - Piete. |
Quote:
Quote:
This is why I was quite excited by the "root" option of install/removepkg since I thought that with that option, it would understand that it was relocating itself from the root directory to the /usr/local with /usr/local being the prefix for all locations that it used (except ld.conf etc.). By clean install, I mean, of course, a clean of install of the same distro (as opposed to an update) - hence I can expect the package tools to "re-appear" in the new installation. A migration to another distro is another matter. But your suggestions regarding the tag files are a possible alternative - nevertheless, the idea of /usr/local being self sufficient regarding the components included in the package together with the installation logs is, imho, the best and cleanest way. Clearly, it's best to stick to updates. Unfortunately if you skip a release or two - as I and others did going from 10.1 to 12.1 - one is forced to do a clean install. |
Quote:
But I have a separate /home partition and a /home/build directory where I put kernel sources and all extra softwares sources with the corresponding packages and slackbuild scripts. This way I can always do a clean install and reinstall the extra softwares I added to Slackware system, either with the tgz packages or I rebuild them with the slackbuild scripts |
Quote:
|
Quote:
People who regularly get their hands dirty with their system easily can modify the build scripts to /usr/local. For myself, I prefer to maintain my separate /usr/local partition and file system. I consider third-party packages from slackbuilds.org and slacky.eu to be system (core) software rather than personal software. Therefore I prefer to have those packages installed in /usr. Quote:
|
Quote:
reading some posts after this one correctly. But this is very important, IMO, and should be considered. Unless you don't plan on compiling any other packages -- such as Woodsman's 64 non-stock packages. |
If you put something in the core system and it doesn't function, then you are facing greater problems than if you had put it into /usr/local.
/usr/local, as a separate partition, can be simply dismounted. As for compiling - well I have /usr/local prioritised both in my paths as well as in ld.conf. Hence if you have the old standard program in the core sytem and the new program in /usr/local, when you run the program the newer version will run. Problems? Unmount /usr/local, try again and if it works, you know where the problem is - and, more importantly, you can carry on working. The other aspect is creep - at what point do you have a slackware distribution and at what point do you have a system based in Slackware? Ad absurdum - one would end up having an lfs system since you have given up the idea of keeping the core system strictly separate from any changes/additions you make. If yours were a business - a bank say - an IT auditor would have grave considerations about tampering with the core system. S/he would want all changes/additions to be kept separately so that they could be given special consideration. Surely the same would apply to us when debugging a problem? We could focus on where changes had been made much easier if they were kept separately. Anyway that's my attitude. If I were to continue putting changes/addtions into the core system, I would really consider moving onto LFS - after all, I would be be half way there. Slackware would then be a useful source of packages for when I was to lazy to compile myself and a reference system. I wouldn't have /usr/local because the whole system was "local". |
And /opt directory has not been discussed yet :)
|
/opt seems to be just for packages - as opposed to individual programs.
Quote:
Quote:
|
YOu have to take into account common practices -which means that most users/admins will install any *packaged* software with, usuallly, a prefix of /usr. /usr/local is most often used for software that is installed without packaging it and for a place to put single-file installations -that is short scripts which don't have any ancillary files.
/opt was originally designed to be used for any software which doesn't conform to normal pratices of spreading files out in different places. that is, some programs look for all their files under a single directory. /opt provides a place for htese programs -anything in /opt can follow whatever conevntion they want. usually progs there are installed into a single directory. The one rule about /usr/local that most distros do folow is that it should be emptied as the distro is delivered. In summary, if you want to do like everyone else is doing, only put stuff in /usr/local which is installed manually or by using 'make install, or an install.sh script. If you create packages for installation , they should nearly lawys be in prefix /usr, although there are exceptions. Some exceptions are really 'illegal', -products which create their own subdirectory in /usr. These should usually be installed, instead in a subdirectory under /usr/lib (no capitals in the name). Then links or wrappers to the binaries are placed in the normal path /usr/bin. While true that pkgtool will manage packages installed under /usr/local and that some third-party packages may thus overwrite files from the official packages, this is still the most common practice across almost all distros. The biggest 'violators' have historically been several large open-source cross-platform programs, like X11, KDE, Mozilla and others. If you create a package using prefix /usr/local, installing it with installpkg will still keep the database info under /var/log/packages. If you had a separate partition mounted on /usr/local you could use root=/usr/local installpkg pkgname to install the program there, but that is not correct -pkgtool rightly will ignore the database files which get installed to /usr/local/var/log/packages. The 'root' option to installpkg is used when you are creating a complete installation under a certain subdirectory, which will be mounted as the main / partition afterwards(or if you want to copy the whole thing to some device). As soon as you finish installing Slackware, it becomes yours -very few installations are left exactly like the installer created. It doesn't mean you should just go ahead and use LFS, just because you change the hostname or add a package or two(hundred) which are not part of the official release. Slackware users rarely rely 100% on official packages. If you find anyone else distributing binary packages for Slackware which are installed under /usr/local, you should consider that a bug -no reputable packages is going to do that, and if someone does that, it screams that they don't know what they are doing -even though it may be 'legal', it is just simply not the accepted practice. |
All times are GMT -5. The time now is 10:56 AM. |