LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Tagfiles - did someone do the hard work already? (https://www.linuxquestions.org/questions/slackware-14/tagfiles-did-someone-do-the-hard-work-already-493159/)

TL_CLD 10-17-2006 08:47 AM

Tagfiles - did someone do the hard work already?
 
Hey all,

I've ventured into the realm of tagfile editing, because I would like to speed up the time it takes me to select what I want and what I don't want, but before I start messing around with the entire thing, I thought I would ask if someone here had already done all the hard work?

What I want is tagfiles for a barebones server. Network, SSH and the different developer tools for future compiling of software. And that's it.

Anybody who've already done such a bunch of tagfiles, and if so, would you be willing to share? :)

Regards,
Thomas

danieldk 10-18-2006 04:14 AM

This may be useful:
http://www.slackbasics.org/html/pkgm...gmgmt-tagfiles

This chapter also has a script that can build tagfiles based on the installed system. I used that in the past to make my initial tagfiles.

Alien Bob 10-18-2006 04:26 AM

There is also "tagger" which creates a set of tagfiles by inspecting an already installed system.
Look here: http://www.bilbos-stekkie.com/tagger/

Eric

TL_CLD 10-18-2006 04:27 AM

Exceptionally cool! Thanks a lot guys.

:)
Thomas

danieldk 10-18-2006 08:45 AM

Quote:

Originally Posted by Alien Bob
There is also "tagger" which creates a set of tagfiles by inspecting an already installed system.
Look here: http://www.bilbos-stekkie.com/tagger/

Eric: the tagger in the Slack Basics book is based on the idea of Peter's (Bilbo) tagger. Though it is slightly cleaner.

danieldk 10-18-2006 08:50 AM

Ah, mind-f*ckup from my side. The new tagger was in the development version of the Slack Basics book. Since the book is pretty much in maintenance mode it was not added to the 10.2 book. So, here it is from the snapshot:

Tagfile copy:
Code:

#!/bin/sh

if [ ! $# -eq 1 ] ; then
  echo "Syntax: $0 [directory]"
  exit
fi

for tagfile in $1/*/tagfile; do
  setdir=`echo ${tagfile} | egrep -o '\w+/tagfile$' | xargs dirname`
  mkdir ${setdir}
  cp ${tagfile} ${setdir}/tagfile.org
  cp ${tagfile} ${setdir}
done

The tagger:
Code:

#!/bin/sh

if [ ! $# -eq 1 ] ; then
  echo "Syntax: $0 [directory]"
  exit
fi

for tforg in $1/*/tagfile.org ; do
  tf=${tforg%.org}
  rm -f ${tf}
  for package in $(grep -v '^#' ${tforg} | cut -d ':' -f 1) ; do
    if ls /var/log/packages/${package}-[0-9]* &> /dev/null ; then
      echo "${package}: ADD" >> ${tf}
    else
      echo "${package}: SKP" >> ${tf}
    fi
  done
done

Subscript (from the book):

"With a simple script, it is also possible to build tagfiles based
on the packages that are installed on the current system. I owe
thanks to Peter Kaagman for coming up with this nifty idea!"

I'll put it online somewhere.

Alien Bob 10-18-2006 10:26 AM

Hi Daniel

I took your code and added commandline switches and some sanity checks to it, and uploaded the resulting script as tagfile_generator.sh
Free for all.

Cheers, Eric

danieldk 10-18-2006 10:42 AM

Great work Eric!

pkn 10-18-2006 06:02 PM

Funny to see these things pop up now and than, never realized that those little scripts would ever be of interest of anyone but myself..... wrote them - in my own clumsy style - to get a better grasp of the whole tagfile idea. And now someone with a real understanding of scripting makes something nice out of them....

IvanPro 10-19-2006 02:54 PM

Hello Alien Bob

tried your script but it gives this error

Slackware source '/home/ftp/pub/Linux/Slackware/slackware-11.0/slackware' does not exist!

I've had a look to it in a text editor and noticed the line

SRCDIR=${SRCDIR:-~ftp/pub/Linux/Slackware/slackware-11.0/slackware}

what is the correct way to edit the line for my install (pretty much a standard slack11 install)? sorry if the question is st00pid, but I don't understand much about scripts and how they work (and besides, I'm a n00b... ;->)

regards.

ivanpro.

Bruce Hill 10-20-2006 06:10 PM

IvanPro,

In Eric's script
Code:

SRCDIR=${SRCDIR:-~ftp/pub/Linux/Slackware/slackware-11.0/slackware}
is the location of your Slackware source directory (SRCDIR).

So if you don't have the sources on your computer you will
probably need to change that path to reflect a CD/DVD, or
copy the contents of the CD/DVD to a directory on your comp,
then change that line appropriately. I.e., my source is at:
Code:

SRCDIR=${SRCDIR:-/server2/ftp/pub/Linux/Slackware/slackware-current/slackware}
Nice script Peter, Daniel, and Eric. :D

pkn 10-21-2006 03:31 AM

For the origional script it was true you had to change it to point to the right source.... Eric made it a bit more sophisticated

Code:

# Parse the commandline options:
while getopts "hs:d:" Option
do
  case $Option in
    s ) SRCDIR=${OPTARG}
        ;;
    d ) DSTDIR=${OPTARG}
        ;;
    h|* ) echo "Parameters are:"
        echo "  -h              This help."
        echo "  -s <slackdir>  The slackware root directory, below which"
        echo "                  you find the package directories a,ap,....y"
        echo "  -d <destdir>    Destination directory for generating tagfiles"
        exit
        ;;  # DEFAULT
  esac
done

Did not run the script.... yet... but it seems logical that the source dir is given in with the -s option.

What I am wondering about is this:
I made 2 separate scripts because there are 2 CDs.... the first script had to run 2 times to get all the origional tagfiles from the CDs. After that the second script would make the new tagfiles based on /var/log/packages.

But that is no biggy... I wil just try it out... and learn some more bash... thanks Eric \o/


All times are GMT -5. The time now is 01:10 AM.