#!/bin/bash # script : tools/create-links # author : willy tarreau # function: creates links in the 'numbered' directory using the series number # and the kernel version. # usage : $0 < CONTENTS # This script uses the BASEVER environment variable to select the # base kernel version. [ -z "$BASEVER" ] &&set -- $(grep -ih -m 1 "^++.*Based" CONTENTS) &&BASEVER=$5 SERIES=0 INC=1 rm -rf numbered 2>/dev/null mkdir -p numbered while read -a words; do case "${words[0]}" in [0-9]*) # "1) Security fixes" SERIES=${words[0]%)} INC=0 ;; +) # "+ patch-name-1 (author)" PATCH=${words[1]} INC=$[INC+1] # NAME=$(printf "%d%02d-%s-%s" $SERIES $INC $BASEVER $PATCH) NAME=$(printf "%d%02d-%s" $SERIES $INC $PATCH) ln -s ../pool/$PATCH numbered/$NAME ;; esac done