kernel: bump to 4.4.40
[openwrt/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
8 Config.in
9 LICENSE
10 Makefile
11 README
12 dl
13 feeds.conf.default
14 include
15 package
16 rules.mk
17 scripts
18 target
19 toolchain
20 tools"
21
22 OPTIONAL_FILES="
23 .git"
24
25 if [ -f feeds.conf ] ; then
26 FILES="$FILES feeds.conf"
27 fi
28
29 if [ -z "$1" ]; then
30 echo "Syntax: $0 <destination>" >&2
31 exit 1
32 fi
33
34 if [ -e "$1" ]; then
35 echo "Error: $1 already exists" >&2
36 exit 1
37 fi
38
39 set -e # fail if any commands fails
40 mkdir -p dl "$1"
41 for file in $FILES; do
42 [ -e "$PWD/$file" ] || {
43 echo "ERROR: $file does not exist in the current tree" >&2
44 exit 1
45 }
46 ln -s "$PWD/$file" "$1/"
47 done
48 for file in $OPTIONAL_FILES; do
49 [ -e "$PWD/$file" ] && ln -s "$PWD/$file" "$1/"
50 done
51 exit 0