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