wordpress-dev/dev/dev-env-setup.sh

79 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
_home_dir="/var/www"
_config_dir="$_home_dir/.config"
mkdir -p "$_config_dir"
chown "$_user_www": "$_config_dir"
apt-get update && apt-get -y install curl gnupg2 zsh tmux ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip tig fzf
echo "installing lf ..."
_download_url="https://github.com/gokcehan/lf/releases/download/$_lf_version/lf-linux-amd64.tar.gz"
wget "$_download_url" -O /tmp/lf.tar.gz
tar -xzvf /tmp/lf.tar.gz -C /usr/local/bin/
git clone 'https://git.rayelliott.dev/dots/lf.git' "$_config_dir/lf"
cd /tmp
rm -Rf /tmp/*
wget https://nodejs.org/dist/"$_node_version"/node-"$_node_version"-"$_node_distro".tar.xz
mkdir -p /usr/local/lib/nodejs
tar -xJvf node-"$_node_version"-"$_node_distro".tar.xz -C /usr/local/lib/nodejs
echo "PATH=/usr/local/lib/nodejs/node-$_node_version-$_node_distro/bin:$PATH" > "$_home_dir"/.profile
. "$_home_dir"/.profile
# yarn not installing due to public key unavailable error - install npm
# temporqarily
# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
# echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list
# apt-get update && apt-get -y install yarn
curl -L https://www.npmjs.com/install.sh | sh
git clone https://github.com/neovim/neovim
cd neovim
make CMAKE_BUILD_TYPE=Release
mkdir -p /usr/local/share/nvim
mv /tmp/neovim/runtime /usr/local/share/nvim/runtime
mv /tmp/neovim/build/bin/nvim /usr/local/bin/nvim
cd "$_home_dir"
su "$_user_www" -c "git clone https://git.rayelliott.dev/dots/nvim.git $_config_dir/nvim"
# su "$_user_www" --login -c 'yarn global add neovim'
su "$_user_www" --login -c 'npm install -g neovim'
su "$_user_www" --login -c 'python2 -m pip install --user --upgrade pynvim'
su "$_user_www" --login -c 'python3 -m pip install --user --upgrade pynvim'
su "$_user_www" --login -c "curl -fLo $_home_dir/nvim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
su "$_user_www" --login -c 'nvim --headless +PlugInstall +qall'
# locale
if [ -f /etc/locale.gen ] && command -v locale-gen ; then
echo 'en_GB.UTF-8 UTF-8' > /etc/locale.gen
locale-gen
echo 'LANG="en_GB.UTF-8"' > /etc/default/locale
else
echo 'Warning can not set locale'
fi
su "$_user_www" -c "git clone https://git.rayelliott.dev/dots/tmux.git $_config_dir/tmux"
su "$_user_www" -c "ln -bfs $_config_dir/tmux/tmux.conf $_home_dir/.tmux.conf"
su "$_user_www" -c "ln -bfs /$_config_dir/tmux/tmux $_home_dir/.tmux"
su "$_user_www" -c "ln -bfs /$_config_dir/tmux/tmux.colours-base16.conf $_config_dir/tmux/tmux.colours.conf"
su "$_user_www" -c "git clone https://git.rayelliott.dev/dots/zsh.git $_config_dir/zsh"
su "$_user_www" -c "git clone https://github.com/tarjoilija/zgen.git $_config_dir/zsh/zgen"
su "$_user_www" -c "ln -bfs /var/www/.config/zsh/zshrc $_home_dir/.zshrc"
# set interactive shell
_zsh=$(command -v zsh)
if [ -f "$_zsh" ] ; then
chsh "$_user_www" -s "$_zsh"
fi