status-react/scripts/setup

70 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
########################################################################
# This install script will setup your development dependencies on OS X
# or Ubuntu. Ubuntu 16.04 is the only tested version.
#
# Usage: scripts/setup
########################################################################
YELLOW='\033[1;33m'
NC='\033[0m'
_current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
source "$_current_dir/lib/setup/path-support.sh"
source_lib "output.sh"
source_lib "packages.sh"
source_lib "platform.sh"
source_lib "installers.sh"
exit_unless_os_supported
####
setup_header "Checking prerequisites..."
if program_exists nix; then
if [ -z "$IN_NIX_SHELL" ]; then
if is_nixos; then
cecho "@b@yellow[[All's good, you can run 'make shell' now]]"
exit 0
else
cecho "@b@red[[Please run 'make shell' first]]"
exit 1
fi
fi
fi
if ! program_exists "curl"; then
cecho "@b@yellow[[Please install curl before running setup.]]"
exit 1
fi
if is_linux && [ -z "$CI_ENVIRONMENT" ]; then
watches=$(cat /proc/sys/fs/inotify/max_user_watches)
required_watches=524288
if [ $watches -lt $required_watches ]; then
cecho "@b@cyan[[fs.inotify.max_user_watches limit is too low ($watches), increasing it]]"
echo fs.inotify.max_user_watches=$required_watches | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
fi
if [ -f "/etc/arch-release" ]; then
# Arch Linux
userns=$(sysctl -n kernel.unprivileged_userns_clone)
if [ "$userns" != '1' ]; then
sudo sysctl kernel.unprivileged_userns_clone=1
fi
fi
fi
####
setup_header "Installing requirements..."
install_nix && \
install_android_sdk || \
exit $?
####
setup_complete