-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcreatelinks
executable file
·49 lines (43 loc) · 1.05 KB
/
createlinks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
installd() {
local DESTDIR="$2/$1"
if [ ! -e "$DESTDIR" ]; then
echo "Creating directory: $DESTDIR"
mkdir -p "$DESTDIR"
return
fi
if [ ! -d "$DESTDIR" ]; then
echo error: $DESTDIR exists, but not a directory.
exit 1
fi
}
installf() {
local DESTFILE="$3/$1"
if [ -e "$DESTFILE" ] || [ -h "$DESTFILE" ]; then
rm -f "$DESTFILE"
fi
ln -s "$2/$1" "$DESTFILE"
}
lndir() {
local SRCROOT="$1"
local DESROOT="$2"
(cd "$SRCROOT"; find *) | while read LINE
do
if [ -d "$SRCROOT/$LINE" ]; then
installd "$LINE" "$DESROOT"
else
echo "Overwriting $LINE"
installf "$LINE" "$SRCROOT" "$DESROOT"
fi
done
}
. ./Build.defs
if [ -z "$1" ] || [ "$1" = all ] || [ "$1" = im ]; then
if [ ! -e "$IMAGEBUILDER/repositories.conf" ]; then
echo "fail to verify $IMAGEBUILDER"
exit 1
fi
echo "Processing ImageBuilder ..."
lndir "$PWD/openwrt/ImageBuilder" "$IMAGEBUILDER"
fi
echo Done.