summaryrefslogtreecommitdiffstats
path: root/release/scripts/mkpkghier
blob: 9f59512c2cdb40da772f9395e8dd4744a53db06f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh
#
# $FreeBSD$

usage()
{
	echo "$*" >&2
	echo "This script must be run from the top level package directory" >&2
	exit 1
}

[ $# -ge 1 ] && usage "usage: mkpkghier"
[ -f INDEX ] || usage "INDEX file not found"
[ -d All ] || usage "All directory not found"

old=$(ls | egrep -v "^INDEX$|^All$|^Latest$")

[ -n "$old" ] && { echo Removing old hierarchy; rm -fr $old; }

echo Creating new hierarchy
awk -F'|' '{ print $1 " " $7; }' INDEX | while read pkg dirs
do
	[ -f All/$pkg.tgz ] || {
		echo "All/$pkg.tgz: Non-existent" >&2
		continue
	}
	for dir in $dirs
	do
		mkdir -p $dir
		[ -e $dir/$pkg.tgz ] && continue
		ln -s ../All/$pkg.tgz $dir/$pkg.tgz
	done
done
OpenPOWER on IntegriCloud