Using Perl in %post

Aaron Lippold lippold at gmail.com
Sun Jul 1 12:39:16 UTC 2007


Hello,

I am building a kickstart that is fairly simple but has many
repetitive actions based on a large set of files.

I have the file sets listed in a simple text file and wrote a perl
script to simple open the file, read the line, parse the filename and
output the needed command with the right chunks of the full filename
in the right places.

I did it in perl and not bash because I am not sure how to do it well
in bash or sh etc.

I would like to just run this script and or fuction right in mz .spec
file. I cannot seem to find any data on if I can do this. Or can
someone show me a quick bash code snip for doing something like :

MYFILE
  CODE/SET1/File.txt
  ...

install()
  open file MYFILE
  while (file)
  # a = CODE, b = SET1, c = File d = txt
    (a,b,c,d) = parse(line)
    instcmd -n ="b" -f = "c.d"
  end while

# in the postun section
cleandb()
  open file MYFILE
  while(file)
    (a,b,c,d) = parse(line)
    rmcmd -n = c
  end while

This way I could just define the right fileset for each subpackage and
I won't have to maintain a list of 100 or more identical opperations,
just dump an ls into a file for setx-file-list.txt when I need to
rebuild the rpms for an updated set of file.

Thanks for any help, thoughts and education.

Aaron




More information about the Kickstart-list mailing list