Last active
November 13, 2019 12:27
-
-
Save cheginit/49dd556bb6ad314268dcd56510742883 to your computer and use it in GitHub Desktop.
Fresh Regolith install
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 | |
set -e | |
# ===================== USER CONFIGURATION ===================== # | |
# location where github repositories of the apps will be downloaded to | |
export GITHUB_DIR="$HOME/repos/github" | |
# Whether install GIS related packages such netcdf and paraview | |
GIS=true | |
if [[ $GIS == 'true' ]]; then | |
# major and minor versions of paraview can be found in https://www.paraview.org/download | |
# the dropdown menu is the major version and the minor version can be found | |
# from the file name such as 2 or 0-RC1 | |
export paraview_major_version='5.6' | |
export paraview_minor_version='2' | |
fi | |
# ============================================================== # | |
# location where apps will be installed | |
export APP_DIR="$HOME/.local/apps" | |
# make the required directories | |
mkdir -p ${APP_DIR} | |
mkdir -p ${GITHUB_DIR} | |
mkdir -p ~/.local/share/applications | |
mkdir -p ~/.local/bin | |
# ============================================================== # | |
# function for getting latest release from a git repo | |
git_latest(){ | |
repo=$1 | |
asset=$2 | |
URL=$( curl -s "https://api.github.com/repos/${repo}/releases/latest" | jq -r ".assets[$asset] | .browser_download_url" ) && \ | |
curl -LO "$URL" && \ | |
echo "$(basename $URL)" | |
} | |
# ============================================================== # | |
# remove all GTK window buttons (close etc.) | |
gsettings set org.gnome.desktop.wm.preferences button-layout : | |
# install some essential apps | |
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent pkg-config && \ | |
# add gimp ppa | |
sudo add-apt-repository -yn ppa:otto-kesselgulasch/gimp && \ | |
# add uget ppa | |
sudo add-apt-repository -yn ppa:uget-team/ppa && \ | |
sudo add-apt-repository -yn ppa:plushuang-tw/uget-stable && \ | |
# add git-lfs ppa | |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash && \ | |
# add lazygit | |
sudo add-apt-repository -yn ppa:lazygit-team/release && \ | |
# add rawtherapee | |
sudo add-apt-repository -yn ppa:dhor/myway && \ | |
# add texstudio | |
sudo add-apt-repository -yn ppa:sunderme/texstudio && \ | |
# add go | |
sudo add-apt-repository -yn ppa:longsleep/golang-backports && \ | |
# install essentials | |
sudo apt update && \ | |
sudo apt full-upgrade -y && \ | |
sudo apt install -y \ | |
gfortran cmake cmake-data build-essential valgrind valgrind-mpi perl-tk tcl-dev tk-dev openmpi-bin libopenmpi-dev golang-go libssl-dev libfltk1.3-dev liboce-ocaf-dev oce-draw libffi-dev \ | |
asciidoc autoconf automake ccache libpam0g-dev xdotool libncurses-dev libncursesw5-dev libreadline-dev libxcb-render0-dev libutempter-dev libevent-dev bison libboost-all-dev dialog gv at xdg-utils libxrandr-dev \ | |
git git-lfs lazygit darcs \ | |
python-dev python3-dev libpython-dev libpython3-dev python3-smbc python3-gpg python3-pip python-cffi \ | |
doxygen graphviz dot2tex zathura zathura-djvu zathura-ps zathura-pdf-poppler zathura-cb texlive-full texstudio qpdf gnuplot wmctrl python3-pybtex \ | |
vlc vlc-plugin-skins2 vlc-plugin-video-splitter vlc-plugin-vlsub \ | |
gimp-gmic gimp-data-extras gimp-python gimp-help-en ffmpeg imagemagick inkscape inkscape-open-symbols rawtherapee \ | |
xclip htop neofetch exfat-fuse exfat-utils jq global samba exuberant-ctags zsh p7zip-full p7zip-rar unrar uget aria2 uget-integrator trash-cli feh calcurse \ | |
bc neomutt isync msmtp pass w3m notmuch libnotify-bin mailsync abook urlview && \ | |
# config dotfiles | |
mkdir -p ~/.config/regolith/i3 && \ | |
git clone https://github.com/cheginit/dotfiles.git ~/.dotfiles && \ | |
cd ~/.dotfiles && \ | |
sudo cp -r fonts/* /usr/share/fonts/ && \ | |
for f in $(ls .{zshrc,Xresources-regolith}); do \ | |
rm -rf ~/$f && \ | |
ln -s $(readlink -f $f) ~/; | |
done | |
for f in $(ls -d .config/*); do \ | |
rm -rf ~/$f && \ | |
ln -s $(readlink -f $f) ~/.config/; | |
done | |
ln -s $(readlink -f bin/*) ~/.local/bin && \ | |
rm -rf ~/.Xresources.d && \ | |
ln -s $(readlink -f .Xresources.d) ~/ && \ | |
xrdb -merge ~/.Xresources-regolith | |
# install polybar and jsoncpp | |
sudo apt install -y \ | |
python3-sphinx libcairo2-dev libxcb1-dev libxcb-util0-dev libxcb-randr0-dev \ | |
libxcb-composite0-dev python-xcbgen xcb-proto libxcb-image0-dev libxcb-ewmh-dev \ | |
libxcb-icccm4-dev libxcb-xkb-dev libxcb-xrm-dev libxcb-cursor-dev libasound2-dev \ | |
libpulse-dev libmpdclient-dev libcurl4-openssl-dev libnl-genl-3-dev && \ | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/open-source-parsers/jsoncpp.git && \ | |
cd jsoncpp && \ | |
mkdir build && \ | |
cd build && \ | |
cmake .. && \ | |
sudo make -j4 install && \ | |
cd ${GITHUB_DIR} && \ | |
git clone --recursive https://github.com/polybar/polybar && \ | |
cd polybar && \ | |
mkdir build && \ | |
cd build && \ | |
cmake .. && \ | |
sudo make -j4 install | |
# install dunst | |
sudo apt install -y \ | |
libgdk-pixbuf2.0-dev libxinerama-dev \ | |
librust-pangocairo-dev libdbus-1-dev && \ | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/dunst-project/dunst.git && \ | |
cd dunst && \ | |
make && \ | |
sudo make install && \ | |
gsettings set org.gnome.gnome-flashback notifications false | |
# install ack | |
ver="$(curl -s "https://beyondgrep.com/changes.txt" | sed -n '4p' | awk -F' ' ' {print $1}')" | |
curl https://beyondgrep.com/ack-${ver} > ~/.local/bin/ack && chmod 0755 ~/.local/bin/ack | |
# install tlp if on a laptop | |
[[ ! -z $(upower -i `upower -e | grep 'BAT'`) ]] && \ | |
sudo add-apt-repository -y ppa:linrunner/tlp && \ | |
sudo apt install -y tlp tlp-rdw solaar && \ | |
sudo tlp start | |
# some apps are only available on ubuntu disco | |
if (( $(echo "$(lsb_release -r --short) > 19" |bc -l) )); then \ | |
vga="$(lspci -nn |egrep "VGA|Display" | grep -o Intel)" && \ | |
if [[ "$vga" == "Intel" ]]; then \ | |
sudo apt install -y intel-media-va-driver-non-free mesa-vdpau-drivers; \ | |
fi; \ | |
fi | |
# install some snap apps | |
command -v snap >/dev/null 2>&1 && \ | |
sudo snap install blender --classic && \ | |
sudo snap install slack --classic && \ | |
sudo snap install spotify && \ | |
sudo snap install telegram-desktop | |
# install docker | |
sudo apt purge -y docker docker-engine docker.io containerd runc | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \ | |
sudo add-apt-repository -y \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" && \ | |
sudo apt install -y docker-ce docker-ce-cli containerd.io && \ | |
sudo groupadd docker && \ | |
sudo usermod -aG docker $USER && \ | |
sudo systemctl enable docker | |
# install skype | |
wget https://repo.skype.com/latest/skypeforlinux-64.deb && \ | |
sudo dpkg -i skypeforlinux-64.deb && \ | |
rm skypeforlinux-64.deb | |
# install dropbox | |
fname=$( curl -s "https://linux.dropbox.com/packages/ubuntu/" | grep href=\"dropbox | grep amd64.deb | tail -1 | awk -F ">" '{ print $2 }' | awk -F "<" '{ print $1 }' ) && \ | |
curl -LO "https://linux.dropbox.com/packages/ubuntu/$fname" && \ | |
sudo dpkg -i $fname && \ | |
rm $fname | |
# install chrome | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \ | |
sudo dpkg -i google-chrome-stable_current_amd64.deb && \ | |
rm google-chrome-stable_current_amd64.deb | |
# install PDFStudioViewer | |
wget https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.deb && \ | |
sudo dpkg -i PDFStudioViewer_linux64.deb && \ | |
rm PDFStudioViewer_linux64.deb | |
# install foliate | |
name="$( git_latest 'johnfactotum/foliate' 0 )" && \ | |
sudo dpkg -i ${name} && \ | |
rm $name | |
# install playerctl | |
name="$( git_latest 'altdesktop/playerctl' 3 )" && \ | |
sudo dpkg -i ${name} && \ | |
rm $name | |
# install flameshot | |
name="$( git_latest 'lupoDharkael/flameshot' 0 )" && \ | |
sudo dpkg -i ${name} && \ | |
rm $name | |
# install etcher | |
name="$( git_latest 'balena-io/etcher' 4 )" && \ | |
sudo dpkg -i ${name} && \ | |
rm $name | |
# install pandoc | |
name="$( git_latest 'jgm/pandoc' 0 )" && \ | |
sudo dpkg -i ${name} && \ | |
rm $name | |
# install spotify from terminal | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && \ | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/Spotifyd/spotifyd.git && \ | |
cd spotifyd && \ | |
cargo build --release && \ | |
mkdir -p ~/.config/systemd/user/ && \ | |
ln -s $(readlink -f contrib/spotifyd.service) ~/.config/systemd/user/ && \ | |
systemctl --user enable spotifyd.service && \ | |
systemctl --user start spotifyd.service && \ | |
cargo install spotify-tui | |
sudo apt install -f -y && \ | |
sudo apt autoremove -y && \ | |
sudo apt autoclean -y | |
# install zotero | |
wget -O zotero.tar.bz2 'https://www.zotero.org/download/client/dl?channel=release&platform=linux-x86_64&version=5.0.76' && \ | |
tar xvf zotero.tar.bz2 -C ${APP_DIR}/ && \ | |
ln -s ${APP_DIR}/Zotero_linux-x86_64/zotero.desktop ~/.local/share/applications/zotero.desktop | |
# install miniconda | |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ | |
chmod +x Miniconda3-latest-Linux-x86_64.sh && \ | |
bash ./Miniconda3-latest-Linux-x86_64.sh -b -p ${APP_DIR}/miniconda && \ | |
rm -f Miniconda3-latest-Linux-x86_64.sh | |
# install pam-gnupg | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/cruegge/pam-gnupg.git && \ | |
cd pam-gnupg && \ | |
./autogen.sh && \ | |
./configure && \ | |
make && \ | |
sudo make install | |
# compile and install neovim from source | |
sudo apt-get install ninja-build gettext libtool libtool-bin && \ | |
sudo apt purge -y vim vim-runtime gvim && \ | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/neovim/neovim.git && \ | |
cd neovim && \ | |
make -j4 CMAKE_BUILD_TYPE=Release && \ | |
sudo make install | |
# install nvim plugins | |
nvim +'PlugInstall --sync' +qa && \ | |
# Add some latext related repos | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/gillescastel/latex-snippets.git && \ | |
cd latex-snippets && \ | |
ln -s $(readlink -f tex.snippets ) ~/.vim/plugged/ultisnips | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/jleightcap/LaTeX-Templates.git | |
# install n then lts version of nodejs and npm | |
cd ${GITHUB_DIR} && \ | |
rm -rf n && \ | |
git clone https://github.com/tj/n.git && \ | |
cd n && \ | |
PREFIX=${APP_DIR}/n make install && \ | |
export N_PREFIX="${APP_DIR}/n" && \ | |
${N_PREFIX}/bin/n lts | |
# install mutt-wizard | |
cd ${GITHUB_DIR} && \ | |
rm -rf mutt-wizard && \ | |
git clone https://github.com/LukeSmithxyz/mutt-wizard && \ | |
cd mutt-wizard && \ | |
sudo make install | |
# install tmux from source | |
cd ${GITHUB_DIR} && \ | |
rm -rf tmux && \ | |
git clone https://github.com/tmux/tmux.git && \ | |
cd tmux && \ | |
sh autogen.sh && \ | |
./configure --enable-utempter && \ | |
sudo make install | |
# config tmux | |
cd && \ | |
git clone https://github.com/gpakosz/.tmux.git && \ | |
ln -s -f .tmux/.tmux.conf && \ | |
cp .tmux/.tmux.conf.local . | |
# install zsh plugins | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/wbingli/zsh-wakatime.git && \ | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git && \ | |
# make pip3 the default pip | |
sudo ln -s /usr/bin/pip3 /usr/bin/pip | |
# install some useful python libraries | |
pip3 install --user -U \ | |
matplotlib numpy yapf flake8 inkscape-figures \ | |
wakatime pybind11 thefuck grip blacktex betterbib \ | |
fortran-linter pynvim pywal pytype flashfocus | |
# install gomatrix, lf | |
go get -u github.com/GeertJohan/gomatrix | |
go get -u github.com/gokcehan/lf | |
# setup fzf | |
cd ~/.fzf && \ | |
./install --key-bindings --completion --no-update-rc --no-bash | |
if [[ $GIS == 'true' ]]; then | |
# add qgis | |
wget -O - https://qgis.org/downloads/qgis-$(date +'%Y').gpg.key | gpg --import && \ | |
gpg --export --armor 51F523511C7028C3 | sudo apt-key add - && \ | |
sudo add-apt-repository -s -y "deb https://qgis.org/debian $(lsb_release -c | cut -f2) main" && \ | |
sudo apt install -y \ | |
libnetcdf-c++4-dev libnetcdff-dev libnetcdf-dev nco libhdf5-dev libhdf5-openmpi-dev \ | |
pnetcdf-bin libpnetcdf-dev netcdf-bin qgis python-qgis libboost-dev liblapack-dev libblas-dev \ | |
libcoarrays-dev libfftw3-dev qt5-qmake qt5-qmake-bin flex freeglut3-dev libosmesa6-dev libglew-dev swig \ | |
gsl-bin libgsl-dev swig libglfw3 libglfw3-dev libfreetype6-dev smpeg-plaympeg gifsicle pstoedit \ | |
libudunits2-dev libxml2-dev libgdal-dev r-base-dev r-cran-devtools r-cran-roxygen2 && \ | |
if (( $(echo "$(lsb_release -r --short) > 19" |bc -l) )); then | |
sudo apt install -y libnetcdf-pnetcdf-dev | |
fi | |
# install paraview | |
fname="ParaView-${paraview_major_version}.${paraview_minor_version}-MPI-Linux-64bit" && \ | |
wget -O paraview.tar.gz "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v${paraview_major_version}&type=binary&os=Linux&downloadFile=${fname}.tar.gz" && \ | |
tar xvf paraview.tar.gz -C ${APP_DIR} && \ | |
mv ${APP_DIR}/$fname ${APP_DIR}/paraview && \ | |
cp ~/.dotfiles/applications/paraview.desktop ${APP_DIR}/paraview/share/applications && \ | |
ln -s ${APP_DIR}/paraview/share/applications/paraview.desktop ~/.local/share/applications && \ | |
rm paraview.tar.gz | |
# install mmg for meshing | |
sudo apt install -y libscotch-dev && | |
cd ${GITHUB_DIR} && \ | |
git clone https://github.com/MmgTools/mmg.git && \ | |
mkdir mmg/build && \ | |
cd mmg/build && \ | |
cmake .. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_CXX_FLAGS="-O3" \ | |
-DCMAKE_C_FLAGS="-O3" \ | |
-DUSE_SCOTCH=ON && \ | |
make -j4 && \ | |
sudo make install | |
fi | |
# install some fonts | |
cd && \ | |
mkdir fonts && \ | |
cd fonts | |
fonts=("IBM+Plex+Mono" "IBM+Plex+Sans" "IBM+Plex+Sans+Condensed" "IBM+Plex+Serif" "Lato" "Source+Code+Pro" "Cormorant%20Garamond" "EB%20Garamond") | |
for f in ${fonts[@]}; do \ | |
curl -Lo font.zip "https://fonts.google.com/download?family=$f" && \ | |
unzip font.zip -d ${f//+/_} && \ | |
rm font.zip; \ | |
done | |
wget https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/MaterialIcons-Regular.ttf && \ | |
fonts+=( materialdesignicons-webfont.ttf ) && \ | |
name="$( git_latest 'microsoft/cascadia-code' 0 )" && \ | |
fonts+=( $name ) && \ | |
name="$( git_latest 'FortAwesome/Font-Awesome' 0 )" && \ | |
unzip -j $name "$(basename ${name%.*})/otfs/*" -d FontAwesome && \ | |
rm -rf $name | |
fonts+=( FontAwesome ) && \ | |
name="$( git_latest 'belluzj/fantasque-sans' 6 )" && \ | |
tar xvf $name TTF && \ | |
mv TTF FantasqueSansMono && \ | |
rm -rf $name && \ | |
fonts+=( FantasqueSansMono ) && \ | |
url="$(curl -s "https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest" | jq -r ".assets[0] | .browser_download_url")" | |
wget "$(dirname "$url")/FiraCode.zip" && \ | |
unzip FiraCode.zip -d FiraCode | |
fonts+=( FiraCode ) && \ | |
for f in ${fonts[@]}; do \ | |
font=${f//+/_} | |
sudo mv $font /usr/share/fonts/ && \ | |
sudo chmod --reference=/usr/share/fonts/opentype /usr/share/fonts/$font; \ | |
done | |
sudo fc-cache -fv | |
cd .. | |
rm -rf fonts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment