Full source build for ARM/pi
This commit is contained in:
parent
a14916d106
commit
23aa3d0bd3
|
@ -9,6 +9,16 @@ ENIGMA_SOURCE=${ENIGMA_SOURCE:=https://github.com/NuSkooler/enigma-bbs.git}
|
|||
TIME_FORMAT=`date "+%Y-%m-%d %H:%M:%S"`
|
||||
WAIT_BEFORE_INSTALL=10
|
||||
|
||||
is_arch_arm()
|
||||
{
|
||||
local ARCH=`arch`
|
||||
if [[ $ARCH == "arm"* ]]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
enigma_header() {
|
||||
clear
|
||||
cat << EndOfMessage
|
||||
|
@ -31,18 +41,19 @@ EndOfMessage
|
|||
sleep ${WAIT_BEFORE_INSTALL}
|
||||
}
|
||||
|
||||
fatal_error() {
|
||||
printf "${TIME_FORMAT} \e[41mERROR:\033[0m %b\n" "$*" >&2;
|
||||
exit 1
|
||||
}
|
||||
|
||||
enigma_install_needs() {
|
||||
command -v $1 >/dev/null 2>&1 || { log_error "ENiGMA½ requires $1 but it's not installed. Please install it and restart the installer."; exit 1; }
|
||||
command -v $1 >/dev/null 2>&1 || { fatal_error "ENiGMA½ requires $1 but it's not installed. Please install it and restart the installer." }
|
||||
}
|
||||
|
||||
log() {
|
||||
printf "${TIME_FORMAT} %b\n" "$*";
|
||||
}
|
||||
|
||||
log_error() {
|
||||
printf "${TIME_FORMAT} \e[41mERROR:\033[0m %b\n" "$*" >&2;
|
||||
}
|
||||
|
||||
enigma_install_init() {
|
||||
log "Checking git installation"
|
||||
enigma_install_needs git
|
||||
|
@ -73,28 +84,35 @@ download_enigma_source() {
|
|||
if [ -d "$INSTALL_DIR/.git" ]; then
|
||||
log "ENiGMA½ is already installed in $INSTALL_DIR, trying to update using git"
|
||||
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch 2> /dev/null || {
|
||||
log_error "Failed to update ENiGMA½, run 'git fetch' in $INSTALL_DIR yourself."
|
||||
exit 1
|
||||
fatal_error "Failed to update ENiGMA½, run 'git fetch' in $INSTALL_DIR yourself."
|
||||
}
|
||||
else
|
||||
log "Downloading ENiGMA½ from git to '$INSTALL_DIR'"
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
command git clone ${ENIGMA_SOURCE} "$INSTALL_DIR" || {
|
||||
log_error "Failed to clone ENiGMA½ repo. Please report this!"
|
||||
exit 1
|
||||
fatal_error "Failed to clone ENiGMA½ repo. Please report this!"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
extra_npm_install_args()
|
||||
{
|
||||
if is_arch_arm; then
|
||||
echo "--build-from-source"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
install_node_packages() {
|
||||
log "Installing required Node packages"
|
||||
cd ${ENIGMA_INSTALL_DIR}
|
||||
git checkout ${ENIGMA_BRANCH} && npm install
|
||||
local EXTRA_NPM_ARGS=$(extra_npm_install_args)
|
||||
git checkout ${ENIGMA_BRANCH} && npm install ${EXTRA_NPM_ARGS}
|
||||
if [ $? -eq 0 ]; then
|
||||
log "npm package installation complete"
|
||||
else
|
||||
log_error "Failed to install ENiGMA½ npm packages. Please report this!"
|
||||
exit 1
|
||||
fatal_error "Failed to install ENiGMA½ npm packages. Please report this!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue