forked from reynhout/chrx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrx
32 lines (24 loc) · 749 Bytes
/
chrx
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
#!/bin/sh
#
# chrx
#
# A wrapper for chrx-install
#
: ${CHRX_WEB_ROOT:="https://chrx.org"}
CHRX_CACHE0_DIR="/var/tmp/chrx"
CHRX_LOG_FILE="${CHRX_CACHE0_DIR}/chrx-install.log"
## silence sudo msg
sudo -v >/dev/null 2>&1
rm -rf ${CHRX_CACHE0_DIR}
mkdir -p ${CHRX_CACHE0_DIR}
cd ${CHRX_CACHE0_DIR}
echo "## $0 $@" > $CHRX_LOG_FILE
## need sudo -E to keep exported environment vars
(
export CHRX_WEB_ROOT CHRX_CACHE0_DIR
#curl -Os ${CHRX_WEB_ROOT}/chrx-install && sudo -E bash ./chrx-install "$@"
sudo -E /usr/local/bin/chrx-install "$@"
) 2>&1 | tee -a ${CHRX_LOG_FILE}
## logfile will be copied to chroot by install-chrx.
## can't copy here -- partition is unmounted when we get back.
## get stderr into tee: bash: `|& tee`; sh: `2>&1 | tee`