forked from mammo0/qnap-ip6tables_nat-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0_prepare.sh
executable file
·40 lines (32 loc) · 964 Bytes
/
0_prepare.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
#!/usr/bin/env bash
TMP_BASE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ENV_FILE="$TMP_BASE_DIR/.env"
# remove any existing .env file
if [ -f "$ENV_FILE" ]; then
echo "" > "$ENV_FILE"
fi
# create .env that contains all globally needed environment variables
build_environment=$'
BASE_DIR="$TMP_BASE_DIR"
SRC_DIR="$BASE_DIR/src"
CONFIG_DIR="$BASE_DIR/config"
PATCH_DIR="$BASE_DIR/patches"
OUT_DIR="$BASE_DIR/out"
QNAP_DEVICE="TS-X53D"
QNAP_VER="4.5.4-20210802"
QNAP_DIR="$SRC_DIR/GPL_QTS"
KERNEL_VER="4.14"
KERNEL_DIR="$QNAP_DIR/src/linux-$KERNEL_VER"
QNAP_KERNEL_CONFIG_FILE="$QNAP_DIR/kernel_cfg/$QNAP_DEVICE/linux-$KERNEL_VER-x86_64.config"'
# evaluate the above string (e.g. resolve paths)
while IFS='=' read -r key temp || [ -n "$key" ]; do
# ignore "empty" lines
case "$key" in
'')
continue
;;
esac
value=$(eval echo "$temp")
eval export "$key='$value'"
echo "$key=$value" >> .env
done <<< "$build_environment"