From df2433575cbbafc4a1366b80ae0e3e917a64e144 Mon Sep 17 00:00:00 2001 From: LplusKira Date: Sun, 9 Jan 2022 21:23:33 -0800 Subject: [PATCH 1/3] start u18's --- platforms/ubuntu/install.sh | 161 ++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 platforms/ubuntu/install.sh diff --git a/platforms/ubuntu/install.sh b/platforms/ubuntu/install.sh new file mode 100644 index 0000000..796773f --- /dev/null +++ b/platforms/ubuntu/install.sh @@ -0,0 +1,161 @@ +#!/bin/bash +set -euo pipefail + +# Check local vimrc's download +function replace_vimrc() { + local repo_vimrc="../../cfg/vimrc" + local local_vimrc="$HOME/.vimrc" + if [ -f "$local_vimrc" ]; then + mv $local_vimrc "$local_vimrc.bak" + fi + cp $repo_vimrc $local_vimrc +} + +# Check if vim supports python +function vim_supports_python() { + # ref: https://www.feliciano.tech/blog/how-to-check-if-vim-supports-python/ + local res=`vim --version | grep "+python"` + echo $res # E.g. "+conceal +linebreak +python3 +visualextra" +} + +# Install YouCompleteMe +function install_YCM() { + # Ref: https://github.com/ycm-core/YouCompleteMe + # Note: there's A LOT of places that might fail you here + + # Dependencies + brew install cmake python go nodejs + brew install mono + brew install java + sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk + + # MacOS doens't support Python3 + brew install vim + + # Compile YCM (YouCompleteMe) + ## If having cert error, check https://github.com/LplusKira/vimvimder/issues/1 + cd ~/.vim/bundle/YouCompleteMe + python3 install.py --all + cd - +} + +# Install tidy +function install_tidy() { + ### Ref: https://github.com/htacg/tidy-html5/blob/next/README/BUILD.md + git clone https://github.com/htacg/tidy-html5.git + cd tidy-html5/build/cmake + cmake ../.. -DCMAKE_BUILD_TYPE=Release + make + make install +} + +# Install flake8 +function install_flake8() { + pip3 install flake8 +} + +# Complete dependencies +## - Prerequisites git, curl, python3, my .vimrc +apt-get update -y +apt-get install -y git python3 curl cmake +## - Overwrite vimrc +replace_vimrc + +# Install plugins through Vundle +git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +vim +PluginInstall +qall + +# Install specials +## - YCM +install_YCM +## - tidy +install_tidy +## - flake8 +install_flake8 + + +#!/bin/bash +# - (Ubuntu 16.04 and later only) +set -e + +# Checking dependencies ... +## - Assert prerequisites git, curl, python3, my .vimrc +apt-get update -y +apt-get install -y git python3 curl cmake +#git --version +#python3 --version +#curl --version +#cmake --version +#pip3 --version + +remote_vimrc="https://gist.githubusercontent.com/LplusKira/f68437c2b7e4af2b9686043093320f56/raw/a92eb772af2aeb9dac1fcf85911f69b4837093d2/.vimrc" +local_vimrc="$HOME/.vimrc" #"/root/.vimrc" # +curl -o ${local_vimrc} ${remote_vimrc} +if [ ! -f "$local_vimrc" ]; then + echo "$local_vimrc download fails! Abort" + exit 1 +fi + +# Installing ... +git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim + +vim +PluginInstall +qall + +## - Specially handle YouCompleteMe -- complie it mannually @@ +### Ref: https://github.com/ycm-core/YouCompleteMe#linux-64-bit +apt-get install -y build-essential cmake python3-dev +### vv mono-complete +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +apt-get install -y apt-transport-https ca-certificates +echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list +apt-get update +apt install mono-devel +### ^^ mono-complete +curl -O https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz +tar -xvf go1.13.3.linux-amd64.tar.gz +mv go /usr/local +for f in ~/.bashrc ~/.zshrc +do + export GOROOT=/usr/local/go + export GOPATH=$HOME/go + export PATH=$GOPATH/bin:$GOROOT/bin:$PATH + echo "export GOROOT=/usr/local/go" >> $f + echo "export GOPATH=$HOME/go" >> $f + echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> $f +done +# vv node, npm +ver=12 +apt-get install -y python-software-properties +curl -sL "https://deb.nodesource.com/setup_${ver}.x" | bash - +apt-get install -y nodejs +# ^^ node, npm +# vv clang 9 (default clang is too old) +## Ref: https://justiceboi.github.io/blog/install-clang-9-on-ubuntu/ +## Ref: (if using old clang) https://github.com/ycm-core/YouCompleteMe/issues/3236#issuecomment-439987788 +curl -SL http://releases.llvm.org/9.0.0/clang%2bllvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar -xJC . +mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04 clang_9.0.0 +sudo mv clang_9.0.0 /usr/local +for f in ~/.bashrc ~/.zshrc +do + export PATH=/usr/local/clang_9.0.0/bin:$PATH + export LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH + echo "PATH=/usr/local/clang_9.0.0/bin:$PATH" >> $f + echo "LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH" >> $f +done +# ^^ clang 9 (default clang is too old) +# Do not use `python3 install.py --all` # this uses some battery-included clang compiler which does not work +## Ref: https://github.com/ycm-core/YouCompleteMe/issues/1711#issuecomment-329520570 +cd ~/.vim/bundle/YouCompleteMe +./install.py --clang-completer --system-libclang + + +## - Specially install tidy +### Ref: https://github.com/htacg/tidy-html5/blob/next/README/BUILD.md +git clone https://github.com/htacg/tidy-html5.git +cd tidy-html5/build/cmake +cmake ../.. -DCMAKE_BUILD_TYPE=Release +make +make install + +## - Specially install flake8 (python linting) +pip3 install flake8 From d870ad599812938e885b53f7b604929e78d24c7c Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 10 Jan 2022 05:54:54 +0000 Subject: [PATCH 2/3] rrr --- platforms/ubuntu/install.sh | 100 +++--------------------------------- platforms/ubuntu/rrr.sh | 85 ++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 94 deletions(-) create mode 100644 platforms/ubuntu/rrr.sh diff --git a/platforms/ubuntu/install.sh b/platforms/ubuntu/install.sh index 796773f..84c2ddd 100644 --- a/platforms/ubuntu/install.sh +++ b/platforms/ubuntu/install.sh @@ -24,13 +24,8 @@ function install_YCM() { # Note: there's A LOT of places that might fail you here # Dependencies - brew install cmake python go nodejs - brew install mono - brew install java - sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk - - # MacOS doens't support Python3 - brew install vim + apt install -y build-essential cmake vim-nox python3-dev + apt install -y mono-complete golang nodejs default-jdk npm # Compile YCM (YouCompleteMe) ## If having cert error, check https://github.com/LplusKira/vimvimder/issues/1 @@ -58,6 +53,10 @@ function install_flake8() { ## - Prerequisites git, curl, python3, my .vimrc apt-get update -y apt-get install -y git python3 curl cmake +## - Install proper-ver vim +add-apt-repository -y ppa:jonathonf/vim +apt update -y +apt install -y vim ## - Overwrite vimrc replace_vimrc @@ -72,90 +71,3 @@ install_YCM install_tidy ## - flake8 install_flake8 - - -#!/bin/bash -# - (Ubuntu 16.04 and later only) -set -e - -# Checking dependencies ... -## - Assert prerequisites git, curl, python3, my .vimrc -apt-get update -y -apt-get install -y git python3 curl cmake -#git --version -#python3 --version -#curl --version -#cmake --version -#pip3 --version - -remote_vimrc="https://gist.githubusercontent.com/LplusKira/f68437c2b7e4af2b9686043093320f56/raw/a92eb772af2aeb9dac1fcf85911f69b4837093d2/.vimrc" -local_vimrc="$HOME/.vimrc" #"/root/.vimrc" # -curl -o ${local_vimrc} ${remote_vimrc} -if [ ! -f "$local_vimrc" ]; then - echo "$local_vimrc download fails! Abort" - exit 1 -fi - -# Installing ... -git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim - -vim +PluginInstall +qall - -## - Specially handle YouCompleteMe -- complie it mannually @@ -### Ref: https://github.com/ycm-core/YouCompleteMe#linux-64-bit -apt-get install -y build-essential cmake python3-dev -### vv mono-complete -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -apt-get install -y apt-transport-https ca-certificates -echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list -apt-get update -apt install mono-devel -### ^^ mono-complete -curl -O https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz -tar -xvf go1.13.3.linux-amd64.tar.gz -mv go /usr/local -for f in ~/.bashrc ~/.zshrc -do - export GOROOT=/usr/local/go - export GOPATH=$HOME/go - export PATH=$GOPATH/bin:$GOROOT/bin:$PATH - echo "export GOROOT=/usr/local/go" >> $f - echo "export GOPATH=$HOME/go" >> $f - echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> $f -done -# vv node, npm -ver=12 -apt-get install -y python-software-properties -curl -sL "https://deb.nodesource.com/setup_${ver}.x" | bash - -apt-get install -y nodejs -# ^^ node, npm -# vv clang 9 (default clang is too old) -## Ref: https://justiceboi.github.io/blog/install-clang-9-on-ubuntu/ -## Ref: (if using old clang) https://github.com/ycm-core/YouCompleteMe/issues/3236#issuecomment-439987788 -curl -SL http://releases.llvm.org/9.0.0/clang%2bllvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar -xJC . -mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04 clang_9.0.0 -sudo mv clang_9.0.0 /usr/local -for f in ~/.bashrc ~/.zshrc -do - export PATH=/usr/local/clang_9.0.0/bin:$PATH - export LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH - echo "PATH=/usr/local/clang_9.0.0/bin:$PATH" >> $f - echo "LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH" >> $f -done -# ^^ clang 9 (default clang is too old) -# Do not use `python3 install.py --all` # this uses some battery-included clang compiler which does not work -## Ref: https://github.com/ycm-core/YouCompleteMe/issues/1711#issuecomment-329520570 -cd ~/.vim/bundle/YouCompleteMe -./install.py --clang-completer --system-libclang - - -## - Specially install tidy -### Ref: https://github.com/htacg/tidy-html5/blob/next/README/BUILD.md -git clone https://github.com/htacg/tidy-html5.git -cd tidy-html5/build/cmake -cmake ../.. -DCMAKE_BUILD_TYPE=Release -make -make install - -## - Specially install flake8 (python linting) -pip3 install flake8 diff --git a/platforms/ubuntu/rrr.sh b/platforms/ubuntu/rrr.sh new file mode 100644 index 0000000..94b075a --- /dev/null +++ b/platforms/ubuntu/rrr.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# - (Ubuntu 16.04 and later only) +set -e + +# Checking dependencies ... +## - Assert prerequisites git, curl, python3, my .vimrc +apt-get update -y +apt-get install -y git python3 curl cmake +#git --version +#python3 --version +#curl --version +#cmake --version +#pip3 --version + +remote_vimrc="https://gist.githubusercontent.com/LplusKira/f68437c2b7e4af2b9686043093320f56/raw/a92eb772af2aeb9dac1fcf85911f69b4837093d2/.vimrc" +local_vimrc="$HOME/.vimrc" #"/root/.vimrc" # +curl -o ${local_vimrc} ${remote_vimrc} +if [ ! -f "$local_vimrc" ]; then + echo "$local_vimrc download fails! Abort" + exit 1 +fi + +# Installing ... +git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim + +vim +PluginInstall +qall + +## - Specially handle YouCompleteMe -- complie it mannually @@ +### Ref: https://github.com/ycm-core/YouCompleteMe#linux-64-bit +apt-get install -y build-essential cmake python3-dev +### vv mono-complete +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +apt-get install -y apt-transport-https ca-certificates +echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list +apt-get update +apt install mono-devel +### ^^ mono-complete +curl -O https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz +tar -xvf go1.13.3.linux-amd64.tar.gz +mv go /usr/local +for f in ~/.bashrc ~/.zshrc +do + export GOROOT=/usr/local/go + export GOPATH=$HOME/go + export PATH=$GOPATH/bin:$GOROOT/bin:$PATH + echo "export GOROOT=/usr/local/go" >> $f + echo "export GOPATH=$HOME/go" >> $f + echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> $f +done +# vv node, npm +ver=12 +apt-get install -y python-software-properties +curl -sL "https://deb.nodesource.com/setup_${ver}.x" | bash - +apt-get install -y nodejs +# ^^ node, npm +# vv clang 9 (default clang is too old) +## Ref: https://justiceboi.github.io/blog/install-clang-9-on-ubuntu/ +## Ref: (if using old clang) https://github.com/ycm-core/YouCompleteMe/issues/3236#issuecomment-439987788 +curl -SL http://releases.llvm.org/9.0.0/clang%2bllvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar -xJC . +mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04 clang_9.0.0 +sudo mv clang_9.0.0 /usr/local +for f in ~/.bashrc ~/.zshrc +do + export PATH=/usr/local/clang_9.0.0/bin:$PATH + export LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH + echo "PATH=/usr/local/clang_9.0.0/bin:$PATH" >> $f + echo "LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH" >> $f +done +# ^^ clang 9 (default clang is too old) +# Do not use `python3 install.py --all` # this uses some battery-included clang compiler which does not work +## Ref: https://github.com/ycm-core/YouCompleteMe/issues/1711#issuecomment-329520570 +cd ~/.vim/bundle/YouCompleteMe +./install.py --clang-completer --system-libclang + + +## - Specially install tidy +### Ref: https://github.com/htacg/tidy-html5/blob/next/README/BUILD.md +git clone https://github.com/htacg/tidy-html5.git +cd tidy-html5/build/cmake +cmake ../.. -DCMAKE_BUILD_TYPE=Release +make +make install + +## - Specially install flake8 (python linting) +pip3 install flake8 From 10385a4ff647cad071126afb9cf73eece42a3c87 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 12 Jan 2022 06:50:37 +0000 Subject: [PATCH 3/3] update --- platforms/ubuntu/install.sh | 55 +++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/platforms/ubuntu/install.sh b/platforms/ubuntu/install.sh index 84c2ddd..d6bfd26 100644 --- a/platforms/ubuntu/install.sh +++ b/platforms/ubuntu/install.sh @@ -1,5 +1,6 @@ #!/bin/bash -set -euo pipefail +# TODO(po-kai): 'sudo' on proper places +set -exuo pipefail # Check local vimrc's download function replace_vimrc() { @@ -22,10 +23,30 @@ function vim_supports_python() { function install_YCM() { # Ref: https://github.com/ycm-core/YouCompleteMe # Note: there's A LOT of places that might fail you here + local password=$1 + + # Cmake troubles + echo $password | sudo -S apt-get purge -y cmake + local version="3.22.1" + cwd=`pwd` + tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) + cd $tmp_dir + wget https://github.com/Kitware/CMake/releases/download/v$version/cmake-$version.tar.gz + tar -xzvf cmake-$version.tar.gz + cd cmake-$version/ + ./bootstrap + echo $password | sudo -S make + echo $password | sudo -S make install + cd $cwd + + # G++8 + echo $password | sudo -S apt-get install -y g++-8 + echo $password | sudo -S update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7 + echo $password | sudo -S update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 # Dependencies - apt install -y build-essential cmake vim-nox python3-dev - apt install -y mono-complete golang nodejs default-jdk npm + echo $password | sudo -S apt install -y build-essential vim-nox python3-dev + echo $password | sudo -S apt install -y mono-complete golang nodejs default-jdk npm # Compile YCM (YouCompleteMe) ## If having cert error, check https://github.com/LplusKira/vimvimder/issues/1 @@ -37,11 +58,15 @@ function install_YCM() { # Install tidy function install_tidy() { ### Ref: https://github.com/htacg/tidy-html5/blob/next/README/BUILD.md + cwd=`pwd` + tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) + cd $tmp_dir git clone https://github.com/htacg/tidy-html5.git cd tidy-html5/build/cmake cmake ../.. -DCMAKE_BUILD_TYPE=Release - make - make install + echo $password | sudo -S make + echo $password | sudo -S make install + cd $cwd } # Install flake8 @@ -49,14 +74,20 @@ function install_flake8() { pip3 install flake8 } +# Read in pwd +echo "Enter your password: " +read -s password + # Complete dependencies ## - Prerequisites git, curl, python3, my .vimrc -apt-get update -y -apt-get install -y git python3 curl cmake -## - Install proper-ver vim -add-apt-repository -y ppa:jonathonf/vim -apt update -y -apt install -y vim +echo $password | sudo -S apt-get update -y +echo $password | sudo -S apt-get install -y git python3 curl cmake +## - Install 8.2-ver vim +echo $password | sudo -S add-apt-repository -y ppa:jonathonf/vim +echo $password | sudo -S apt update -y +echo $password | sudo -S apt install -y vim +## - Change owner +echo $password | sudo -S chown -R $USER "$HOME/.vim*" ## - Overwrite vimrc replace_vimrc @@ -66,7 +97,7 @@ vim +PluginInstall +qall # Install specials ## - YCM -install_YCM +install_YCM $password ## - tidy install_tidy ## - flake8