Last active
May 1, 2018 03:32
-
-
Save WisdomWolf/69e48a0f1838e2cdaf00105d0de6ce25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LOG_FILE=pi_setup_$(date +%Y%m%d-%H%M).log | |
export ERR_FILE=pi_setup_errors_$(date +%Y%m%d-%H%M).out | |
exec > >(tee -ia $LOG_FILE) | |
exec 2> >(tee -ia $ERR_FILE) | |
[ "$UID" -eq 0 ] || exec sudo -E "$0" "$@" | |
echo "Setting Timezone" | |
cp /usr/share/zoneinfo/America/New_York /etc/localtime | |
if ! [ -x "$(command -v node)" ]; then | |
curl -sL https://deb.nodesource.com/setup_10.x | bash - | |
else | |
echo "skipping node install" | |
fi | |
apt update | |
apt install -y fish tmux vim curl wget git httpie jq sed nodejs neovim \ | |
python python3 python-dev python3-dev python-pip python3-pip make build-essential \ | |
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev \ | |
libncursesw5-dev xz-utils tk-dev dnsutils mosh | |
apt upgrade | |
pip3 install ipython pipenv xonsh | |
if ! [ -e $HOME/.pyenv/bin ]; then | |
echo "Downloading pyenv" | |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash | |
echo -e '\nexport PATH="~/.pyenv/bin:$PATH"\neval "$(pyenv init -)"\neval "$(pyenv virtualenv-init -)"\n"' >> $HOME/.bashrc | |
echo -e '\nset -gx fish_user_paths "${PYENV_ROOT}/bin\ \$fish_user_paths"\nstatus --is-interactive; and source (pyenv init -|psub)\nstatus --is-interactive; and source (pyenv virtualenv-init -|psub)' >> $HOME/.config/config.fish | |
fi | |
if ! [ -e $HOME/.config/fish/functions/fisher.fish ]; then | |
echo "Downloading fisher" | |
curl -Lo $HOME/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher | |
else | |
echo "skipping fisher install" | |
fi | |
if ! [ -x "$(command -v yadm)" ]; then | |
echo "Downloading yadm" | |
curl -fLo /usr/local/bin/yadm https://github.com/TheLocehiliosan/yadm/raw/master/yadm && chmod a+x /usr/local/bin/yadm | |
else | |
echo "skipping yadm install" | |
fi | |
if ! [ -x "$(command -v docker)" ]; then | |
echo "Downloading docker" | |
curl -sSL https://get.docker.com | sh | |
usermod -aG docker $SUDO_USER | |
else | |
echo "skipping docker install" | |
fi | |
chown -R $SUDO_USER:$SUDO_USER $HOME | |
raspi-config nonint do_boot_behaviour B2 | |
# set keyboard to US | |
sed -i "s/XKBLAYOUT=\"gb\"/XKBLAYOUT=\"us\"/" /etc/default/keyboard | |
if ! [ -e $HOME/.setup_completed ]; then | |
touch $HOME/.setup_completed | |
reboot now | |
else | |
echo "not rebooting because initial setup already completed. Remove $HOME/.setup_completed to force full setup" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment