LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Any way to save package selections for future install?? (https://www.linuxquestions.org/questions/slackware-14/any-way-to-save-package-selections-for-future-install-4175452843/)

slacker2012 03-05-2013 04:14 PM

Any way to save package selections for future install??
 
Is there a way to save the package install information for a future install? I install Slack on a BUNCH of different PCs around the office and I would like to have a way of automatically selecting the packages I need. I dont need things like aspell, cd burning, odd libraries etc for my simple web servers.

Any ideas?

Kustom42 03-05-2013 04:50 PM

Have you considered something like Puppet or Chef?

slacker2012 03-05-2013 04:52 PM

Never heard of them until now. :) Do you have any more info on this?

Kustom42 03-05-2013 04:58 PM

I love puppet, its a very intuitive and easy to use language. You basically just set your profile that says it requires this package and this version and then puppet does a run on the systems,(by default every 30 minutes) and will verify that the packages are the correct version. There is no if, else statements you have to write to check for versions all you do is say:

Code:

    package { 'openssh-server':
      ensure => 4.3p2-29.el5,
          }

It will make sure that your openssh-server package is 4.3p2-29.el5 and if its not will automatically resolve dependencies and install the correct version. You arent limited to just packages you can put a base config in for basically anything on the system.

Check out https://downloads.puppetlabs.com/doc...ningpuppet.pdf

They have a prebuilt VM that you can download and try out that already has the software installed and configured a little.

Mike_M 03-05-2013 05:07 PM

You can use tagfiles for this. They are briefly discussed here:

http://docs.slackware.com/playground...install_option

I find the tagilfe format to be quite self explanatory. Once you've created your set (or sets) of tagfiles, it is a cinch to do repeated, automated installs.

Woodsman 03-05-2013 06:38 PM

See whether this script will help:

http://www.linuxquestions.org/questi...ckages-642787/

I've been using a slightly personalized version for several years. I always have a copy in /var/log of all non stock packages I installed. I run the script as part of my daily cron jobs. :)

T3slider 03-05-2013 09:25 PM

Quote:

Originally Posted by Woodsman (Post 4905510)
See whether this script will help:

http://www.linuxquestions.org/questi...ckages-642787/

I've been using a slightly personalized version for several years. I always have a copy in /var/log of all non stock packages I installed. I run the script as part of my daily cron jobs. :)

All instances of ".tgz" would have to be changed to ".t[gx]z" or ".t.z" for those scripts to still work properly. If you use slackpkg then this script is nicer:
Code:

#!/bin/sh

(
cd /var/log/packages
THIRDPARTYPKGS=$(
    for i in *
    do
        if ! grep "^PACKAGE NAME:  ${i}.t[gx]z$" /var/lib/slackpkg/PACKAGES.TXT >/dev/null 2>&1; then
            echo "$i"
        fi
    done
)
echo "$THIRDPARTYPKGS"
)

To list all first-party packages instead of third-party packages (which seems to be what the OP wants), the slackpkg-dependent script should be
Code:

#!/bin/sh

(
cd /var/log/packages
FIRSTPARTYPKGS=$(
    for i in *
    do
        if grep "^PACKAGE NAME:  ${i}.t[gx]z$" /var/lib/slackpkg/PACKAGES.TXT >/dev/null 2>&1; then
            echo "$i"
        fi
    done
)
echo "$FIRSTPARTYPKGS"
)

By slackpkg-dependent I mean it depends on having run `slackpkg update` at least once. If you don't use slackpkg then you may adjust one of the scripts Woodsman linked to (the script in reply #9 has an option to list first-party packages, but since I no longer use the script I can't guarantee it still works -- though it should if you replace .tgz with .t[xg]z).

I just rigged up a quick script that produces tagfiles from the installed packages (using official packages only). This is also slackpkg-dependent.
Code:

#!/bin/bash

PACKAGES=/var/lib/slackpkg/PACKAGES.TXT
OUTPUTDIR=${OUTPUTDIR:-`pwd`}

(
cd /var/log/packages
PKGLIST=$(paste -d/ <(grep "^PACKAGE LOCATION:" $PACKAGES | sed 's/^PACKAGE LOCATION:  //') <(grep "^PACKAGE NAME:" $PACKAGES | sed 's/^PACKAGE NAME:  //'))
while read line
do
    if [ -e "$(basename $line)" ]; then
        mkdir -p "$OUTPUTDIR/$(dirname $line)"
        echo "$(echo "$(basename $line)" | rev | cut -d- -f4- | rev):ADD" >> "$OUTPUTDIR/$(dirname $line)/tagfile"
    else
        mkdir -p "$OUTPUTDIR/$(dirname $line)"
        echo "$(echo "$(basename $line)" | rev | cut -d- -f4- | rev):SKP" >> "$OUTPUTDIR/$(dirname $line)/tagfile"
    fi
done < <(echo "$PKGLIST" | sed 's/[.]t[gx]z$//')
)

This will create a few directories in the path specified by OUTPUTDIR (by default the current directory). It should create extra/, patches/, slackware/ (or slackware64/) and testing/ directories (some of which have their own sub-directories), but the only important one is slackware{,64}. It should be noted that this will not handle a patched Slackware installation properly -- any upgraded packages will be listed as "SKP" in the relevant tagfile instead of "ADD". Thus, after running the script you should look at patches/packages/tagfile and modify the appropriate tagfiles under slackware{,64}/ to change the upgraded packages to ADD instead of SKP. There isn't really an easy way to do this in the script since some packages may have ambiguous roots (xf86-video-nouveau, for example, could be the one from x/, testing/, or the blacklist package from extra/, and hypothetically, if a patch was released, the script would not be able to tell which package the patch represented...). I think it is best to leave this for manual work. The following script, which must be run from the directory specified as $OUTPUTDIR from the last script (after running it), will try to adjust for the patches problem automatically, but no guarantees:
Code:

#!/bin/bash

PATCHES=$(grep ":ADD$" patches/packages/tagfile | cut -d: -f1)
while read line
do
    PKG=$(grep -R "^${line}:SKP$" slackware{,64}/ 2>/dev/null | cut -d: -f1)
    sed -i "s/^${line}:SKP$/${line}:ADD/" $PKG
done < <(echo "$PATCHES")

For a simpler script see here, which uses a CD image/mirror (but will not omit official packages that you have replaced with unofficial packages -- it just checks to see if any package of the given name is installed regardless of whether or not it is official).

To use the tagfiles generated by my script, you would pass the name of the slackware{,64} directory to the installer and not $OUTPUTDIR (I believe the installer looks for tagfiles in a/, ap/, etc. directories under the mount point).

Richard Cranium 03-05-2013 09:51 PM

Quote:

Originally Posted by Kustom42 (Post 4905440)
Have you considered something like Puppet or Chef?

Have you considered that Slackware is not a supported platform for Puppet? You do know that Slackware isn't like RedHat, don't you?

Didier Spaier 03-06-2013 12:36 AM

1 Attachment(s)
In a Slackware tree, in every directory under /slackware storing a package series (e.g. a, ap, d, e, f ... y) you'll find three files: tagfile, maketag and maketag.ez.

You can use the 'maketag' scripts in two ways:
(1) Directly running "sh maketag" as root. The program will allow you to select/unselect every package in that series and output a customized tagfile called /var/log/setup/tmp/SeTnewtag that you can rename for instance as tagfile.pat (well, that's how Pat used to call them :-) and copy back in the packages' series directory. Then you make an ISO of the Slackware tree including the customized tagfiles and choose the option to use that during installations.
(2) During installation, run the SeTmaketag program to somehow automatize the process.
You may run that as soon as you have logged in as (fake) root, before running setup.

For the records, once upon a time 'maketag' allowed to choice among groups of packages whilst with 'maketag.ez' was intended to make you select/unselect packages individually (so called "expert" mode) but in Slackware.14 there is no packages grouping and both files' content is identical.

FYI I attach a copy of the SeTmaketag script found in the installer for Slackware-14.0., renamed to allow its uploading on LQ.

You can run it any time (as root) to prepare your customized tagfiles, provided you have a local mirror. Editing the script to ask for the mirror's path only once for all packages' series is left to the reader as an exercise ;)

PS wondering why SeTmaketag is in the installer, not as another Slackware script in /sbin (or /usr/sbin)? I'd guess that's because when it was first shipped Slackware installation media were floppy disks and the script allowed to write the custom tagfiles on the first floppy of each packages series, that way the floppies could then be used to make as many custom installations as needed.

PS2 nothing actually new here. As stated in SeTmaketag "The maketag script was introduced in Slackware 1.1.2" :cool:

Kustom42 03-06-2013 04:40 PM

Sorry for the incorrect info here, I didnt realize I got onto the slackware threads. Yes slackware is much different and puppet will not work.


All times are GMT -5. The time now is 06:20 AM.