Return to Snippet

Revision: 65114
at October 25, 2013 19:29 by Makistos


Initial Code
#/bin/sh
for CHANGEFILE in *.changes;
 do
   str=`echo $CHANGEFILE | grep -v "source.changes"`
   if [ -z "$str" ]; then
     continue
   fi
   found="0"
   while read line
   do
     if [ "$found" = "0" ] ; then
       if [ "$line" != "Files:" ]; then
         continue
       else
         found="1"
         continue
       fi
     fi

     file=`echo $line | cut -d " " -f 5`
     cp $file $INCOMING_DIR
   done < $CHANGEFILE
   cp $CHANGEFILE $INCOMING_DIR
done

Initial URL

                                

Initial Description
This script goes through .change files in the current directory and copies all the files listed to a different directory. It skips the _sources.change files as well. 

This is really written in plain bourne shell, but Smipple doesn't seem to support it directly.

The obvious use is to copy the files so we can use "reprepro processincoming" to save packages to a repository.

There are probably smarter ways to do this, but this is pretty portable as it only requires grep and cut, and very minimal functionality from them as well. And even grep is not needed if you want to copy everything.

Initial Title
Parsing .change files

Initial Tags
Bash

Initial Language
Bash