2019-12-31 02:19:29 +00:00
|
|
|
#!/bin/sh
|
2009-12-10 20:52:45 +00:00
|
|
|
# Create a new openwrt tree with symlinks pointing at the current tree
|
|
|
|
# Usage: ./scripts/symlink-tree.sh <destination>
|
|
|
|
|
|
|
|
FILES="
|
|
|
|
BSDmakefile
|
2016-05-02 02:40:09 +00:00
|
|
|
config
|
2009-12-10 20:52:45 +00:00
|
|
|
Config.in
|
|
|
|
LICENSE
|
|
|
|
Makefile
|
|
|
|
README
|
|
|
|
dl
|
|
|
|
feeds.conf.default
|
|
|
|
include
|
|
|
|
package
|
|
|
|
rules.mk
|
|
|
|
scripts
|
|
|
|
target
|
|
|
|
toolchain
|
|
|
|
tools"
|
|
|
|
|
2016-05-02 02:40:09 +00:00
|
|
|
OPTIONAL_FILES="
|
|
|
|
.git"
|
|
|
|
|
2009-12-10 20:52:45 +00:00
|
|
|
if [ -f feeds.conf ] ; then
|
|
|
|
FILES="$FILES feeds.conf"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2013-02-21 11:45:27 +00:00
|
|
|
echo "Syntax: $0 <destination>" >&2
|
2009-12-10 20:52:45 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e "$1" ]; then
|
2013-02-21 11:45:27 +00:00
|
|
|
echo "Error: $1 already exists" >&2
|
2009-12-10 20:52:45 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e # fail if any commands fails
|
|
|
|
mkdir -p dl "$1"
|
|
|
|
for file in $FILES; do
|
|
|
|
[ -e "$PWD/$file" ] || {
|
2013-02-21 11:45:27 +00:00
|
|
|
echo "ERROR: $file does not exist in the current tree" >&2
|
2009-12-10 20:52:45 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
ln -s "$PWD/$file" "$1/"
|
|
|
|
done
|
2016-05-02 02:40:09 +00:00
|
|
|
for file in $OPTIONAL_FILES; do
|
|
|
|
[ -e "$PWD/$file" ] && ln -s "$PWD/$file" "$1/"
|
|
|
|
done
|
2009-12-10 20:52:45 +00:00
|
|
|
exit 0
|