forked from phracker/MacOSX-SDKs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_tarballs.sh
executable file
·50 lines (43 loc) · 1.32 KB
/
make_tarballs.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
#!/bin/bash
# Make MacOSX-SDKs release tarballs
TARGET="$(pwd)";
LOGFILE="$(mktemp)";
SDKS="";
log() {
echo "$@" 2>&1 | tee "$LOGFILE";
}
log "Current Directory: $TARGET";
log "Log: $LOGFILE";
if [[ $# -eq 0 ]]; then
log "Building release tarballs.";
else
log "This script does not take arguments.";
exit;
fi
if [[ ! -d "$TARGET/release/" ]]; then
log "Making release directory at $TARGET/release/";
mkdir "$TARGET/release/";
else
echo -n "An old release directory was found. Would you like to delete it before proceeding? [Y/n]: ";
read DELETE_RELEASES;
echo "";
if [[ ! "$DELETE_RELEASES" -eq "n" ]]; then
log "Removing old release directory at $TARGET/release/";
rm -rf "$TARGET/release/";
log "Making release directory at $TARGET/release/";
mkdir "$TARGET/release/";
else
log "Moving old release directory to $TARGET/release_backup/";
mv "$TARGET/release/" "$TARGET/release_backup/";
log "Making release directory at $TARGET/release/";
mkdir "$TARGET/release/";
fi
fi
SDKS="";
for sdk_directory in *.sdk; do
log "Compressing $sdk_directory to $sdk_directory.tar.xz...";
tar -cpJf "release/$sdk_directory.tar.xz" "$sdk_directory";
SDKS="${SDKS} $sdk_directory"
done
log "Done. Contents of $TARGET/release/:";
du -h "$TARGET/release/"* | sed s/release\\\///g 2>&1 | tee "$LOGFILE";