forked from britannic/ubnt-bcast-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·35 lines (30 loc) · 960 Bytes
/
build
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
#!/usr/bin/env bash
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
export COPYFILE_DISABLE=true
VERSION=$(cat ./version)
NAME='ubnt_bcast_relay'
BCAST="${NAME}.${VERSION}."
INSTALL="install_${NAME}.v${VERSION}"
PAYLOAD='payload'
if [[ -e "${0##*/}" ]]; then
OUTPUT_DIR="$(pwd)/output"
mkdir -p "$OUTPUT_DIR"
[[ -f "$OUTPUT_DIR/${BCAST}setup.tgz" ]] && rm "$OUTPUT_DIR/${BCAST}setup.tgz"
cd ${PAYLOAD}
echo ${VERSION} > version
tar zcf "$OUTPUT_DIR/${PAYLOAD}.tgz" --exclude='._*' --exclude='.svn' --exclude='.DS_Store' --exclude='*.bak' --exclude='*~' ./*
cd ..
if [[ -e "$OUTPUT_DIR/${PAYLOAD}.tgz" ]]; then
cat decompress "$OUTPUT_DIR/${PAYLOAD}.tgz" > "$OUTPUT_DIR/${INSTALL}"
else
echo "$OUTPUT_DIR/${PAYLOAD}.tgz does not exist"
exit 1
fi
cd "$OUTPUT_DIR"
chmod 0755 ${INSTALL}
tar zcf ${INSTALL}.tgz ${INSTALL}
echo "${INSTALL} created"
else
echo "$(basename $0) must be run in the directory where it is located."
fi
exit 0