#!/usr/bin/env bash# Create a new openwrt tree with symlinks pointing at the current tree# Usage: ./scripts/symlink-tree.sh <destination>FILES=" BSDmakefile Config.in LICENSE Makefile README dl docs feeds.conf.default include package rules.mk scripts target toolchain tools"if[-ffeeds.conf];thenFILES="$FILES feeds.conf"fiif[-z"$1"];thenecho"Syntax: $0 <destination>"exit1fiif[-e"$1"];thenecho"Error: $1 already exists"exit1fiset-e# fail if any commands fails
mkdir-pdl"$1"forfilein$FILES;do[-e"$PWD/$file"]||{echo"ERROR: $file does not exist in the current tree"exit1}ln-s"$PWD/$file""$1/"doneexit0