Skip to content

Instantly share code, notes, and snippets.

@DJviolin
Last active August 3, 2016 21:39
Show Gist options
  • Save DJviolin/12be78600cdac7c7ee89e18e61d8dd33 to your computer and use it in GitHub Desktop.
Save DJviolin/12be78600cdac7c7ee89e18e61d8dd33 to your computer and use it in GitHub Desktop.
WSL
#!/bin/dash
# Windows folder:
# C:\Users\[user]\AppData\Local\lxss
# Uninstall with keeping root dir
# lxrun /uninstall
# Uninstall completely:
# lxrun /uninstall /full /y
# New install (root user created):
# lxrun /install /y
# Symlink shared folder into WSL
# mkdir -p $HOME/www
# ln -s /mnt/c/www/lxss $HOME/www
# cd $HOME/www/lxss
# chmod +x install.sh
# ./install.sh
# ln -s $HOME/www/lxss/.vimrc $HOME/.vimrc
# ln -s $HOME/www/lxss/.Xresources $HOME/.Xresources && xrdb ~/.Xresources
# Running Sublime Text (with Xming)
# make sure Xming is already running before running the shortcut
# C:\Windows\System32\bash.exe ~ -c "DISPLAY=:0 /opt/sublime_text/sublime_text"
# Documentation:
# https://msdn.microsoft.com/hu-hu/commandline/wsl/faq
#### Pre-settings
# set -e making the commands if they were like &&
# set -x putting + before every line
set -e
echo "\
#!/bin/sh\n\
exit 101" > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
#### Base
echo "\
# Ubuntu Main Repos\n\
deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse\n\
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse\n\
# Ubuntu Update Repos\n\
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse\n\
deb-src http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse\n\
deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse\n\
deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse" > /etc/apt/sources.list
rm -rf /var/lib/apt/lists/*
apt-get update
apt-get upgrade -y --force-yes
apt-get dist-upgrade -y --force-yes
apt-get install -y \
build-essential
#### Change default language to en_US
update-locale LANG=en_US.UTF8
#### Clang
echo "\
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\n\
# 3.8\n
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main\n\
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main\n\
# 3.9\n\
#deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main\n\
#deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main" > /etc/apt/sources.list.d/llvm.list
curl http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
apt-get update
apt-get install -y \
clang-4.0 \
lldb-4.0 \
clang-format-4.0
ln -s /usr/bin/clang-4.0 /usr/bin/clang
ln -s /usr/bin/clang++-4.0 /usr/bin/clang++
ln -s /usr/bin/clang-format-4.0 /usr/bin/clang-format
clang --version
clang++ --version
clang-format --version
#### Node.js
curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
VERSION=node_6.x
DISTRO="$(lsb_release -s -c)"
echo "\
deb https://deb.nodesource.com/$VERSION $DISTRO main\n\
deb-src https://deb.nodesource.com/$VERSION $DISTRO main" > /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get install -y \
nodejs
node -v
npm -v
#### Git
apt-get install -y \
git
#### Xming
# https://channel9.msdn.com/Blogs/WinCoder/XMING--Bash-on-Ubuntu-on-Windows--X11-Window-System-Running-from-Windows10-Subsystem-for-Linux
# http://www.straightrunning.com/XmingNotes
# https://sourceforge.net/projects/xming
# http://packages.ubuntu.com/xenial/x11-apps
# $ xeyes & // Opens in background
# Watch star wars: $ telnet towel.blinkenlights.nl
apt-get install -y \
cmatrix \
cowsay \
xcowsay \
x11-xserver-utils \
xterm
echo "\n\
# User added\n\
export PATH=\$PATH:/usr/games\n\
export DISPLAY=localhost:0.0" >> $HOME/.bashrc
source $HOME/.bashrc
ls -al /etc/X11/app-defaults
#### Vim
mkdir -p $HOME/.vim/bundle/Vundle.vim
git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
#### Boost library
BOOST_VERSION="1.61.0"
BOOST_ARCHIVE="boost_1_61_0"
apt-get install -y --no-install-recommends --no-install-suggests \
gcc \
g++ \
python-dev \
autotools-dev \
libicu-dev \
libbz2-dev \
zlib1g-dev
mkdir -p $HOME/boost
curl -fSL "http://downloads.sourceforge.net/project/boost/boost/$BOOST_VERSION/$BOOST_ARCHIVE.tar.gz" -o "$BOOST_ARCHIVE.tar.gz"
tar -xzf "$BOOST_ARCHIVE.tar.gz" -C $HOME/boost --strip-components=1
rm -rf "$BOOST_ARCHIVE.tar.gz"
cd $HOME/boost
./bootstrap.sh \
--show-libraries
./bootstrap.sh \
--without-libraries=mpi \
--prefix=/usr/local
./b2 \
--with=all \
install
rm -rf $HOME/boost
#### Cleanup
rm -rf /var/lib/apt/lists/*
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
apt -y autoremove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment