pkg-config: fix occasional install problem
[oweals/openwrt.git] / scripts / symlink-tree.sh
1 #!/usr/bin/env bash
2 # Create a new openwrt tree with symlinks pointing at the current tree
3 # Usage: ./scripts/symlink-tree.sh <destination>
4
5 FILES="
6         BSDmakefile
7         Config.in
8         LICENSE
9         Makefile
10         README
11         dl
12         docs
13         feeds.conf.default
14         include
15         package
16         rules.mk
17         scripts
18         target
19         toolchain
20         tools"
21
22 if [ -f feeds.conf ] ; then
23         FILES="$FILES feeds.conf"
24 fi
25
26 if [ -z "$1" ]; then
27         echo "Syntax: $0 <destination>" >&2
28         exit 1
29 fi
30
31 if [ -e "$1" ]; then
32         echo "Error: $1 already exists" >&2
33         exit 1
34 fi
35
36 set -e # fail if any commands fails
37 mkdir -p dl "$1"
38 for file in $FILES; do
39         [ -e "$PWD/$file" ] || {
40                 echo "ERROR: $file does not exist in the current tree" >&2
41                 exit 1
42         }
43         ln -s "$PWD/$file" "$1/"
44 done
45 exit 0