-
Notifications
You must be signed in to change notification settings - Fork 75
/
unify.sh
executable file
·56 lines (50 loc) · 1.38 KB
/
unify.sh
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
50
51
52
53
54
55
56
create_unified_vm_macOS() {
local MISMATCHINGNIBS=
local MISMATCHINGPLISTS=
readonly O="$1"
readonly A="$2"
readonly B="$3"
if [ ! -d "$A" ]; then
echo "$A does not exist; aborting"
exit 44
fi
if [ ! -d "$B" ]; then
echo "$B does not exist; aborting"
exit 45
fi
echo "merging $A \& $B into $O..."
mkdir -p $O
for f in `cd $A >/dev/null; find . | sed 's|^\.\/||'`; do
if [ -d "$A/$f" ]; then
mkdir -p $O/$f
# elif [ -L "$A/$f" ]; then
# echo ln -s `readlink "$A/$f"` "$O/$f"
elif [ ! -f "$A/$f" ]; then
echo "$A/$f does not exist; how come?"
elif [ ! -f "$B/$f" ]; then
echo "$B/$f does not exist; how come?"
else
case `file -b "$A/$f"` in
Mach-O*)
lipo -create -output "$O/$f" "$A/$f" "$B/$f";;
*)
if cmp -s "$A/$f" "$B/$f"; then
cp "$A/$f" "$O/$f"
else
echo "EXCLUDING $f because it differs"
case "$f" in
*.plist)
MISMATCHINGPLISTS="$MISMATCHINGPLISTS $f"
;;
*.nib)
MISMATCHINGNIBS="$MISMATCHINGNIBS $f"
echo "using $B version"
cp "$B/$f" "$O/$f"
;;
esac
fi
esac
fi
done
}
create_unified_vm_macOS ./Unified ./ARM ./Intel