2022-05-20 06:14:35 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Functions
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
DownloadFile()
|
|
|
|
{
|
|
|
|
url=$1
|
|
|
|
dest_file=$2
|
2022-01-19 02:47:12 +00:00
|
|
|
|
2022-05-20 06:14:35 +00:00
|
|
|
if [[ -f "${dest_file}" ]]; then
|
2022-07-10 07:25:29 +00:00
|
|
|
echo "- [DownloadFile/Cached] ${url} to ${dest_file}"
|
2022-05-20 06:14:35 +00:00
|
|
|
else
|
2022-07-10 07:25:29 +00:00
|
|
|
echo "- [DownloadFile] ${url} to ${dest_file}"
|
2022-05-20 06:14:35 +00:00
|
|
|
wget --output-document ${dest_file} ${url}
|
|
|
|
if [ $? -ne 0 ]; then
|
2022-07-10 07:25:29 +00:00
|
|
|
echo "- [DownloadFile] Download failed [url=${url}]"
|
2022-05-20 06:14:35 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2022-01-19 02:47:12 +00:00
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
FileSHA256Check()
|
2022-05-20 06:14:35 +00:00
|
|
|
{
|
|
|
|
file=$1
|
|
|
|
expected=$2
|
|
|
|
|
|
|
|
echo "${expected} ${file}" | sha256sum --check
|
|
|
|
if [[ $? -ne 0 ]]; then
|
2022-07-10 07:25:29 +00:00
|
|
|
echo "- [FileSHA256Check] Failed [file=${file}, "
|
|
|
|
echo " expect=${expected} ${file},"
|
|
|
|
echo " actual=$(sha256sum ${file})"
|
|
|
|
echo " ]"
|
2022-05-20 06:14:35 +00:00
|
|
|
exit
|
|
|
|
else
|
2022-07-10 07:25:29 +00:00
|
|
|
echo "- [FileSHA256Check] OK [file=${file}, hash=${expected}]"
|
2022-05-20 06:14:35 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Setup
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
root_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
|
|
|
|
home_dir=${root_dir}/Home
|
|
|
|
installer_dir=${root_dir}/Installer
|
|
|
|
tools_dir=${root_dir}/Tools
|
|
|
|
downloads_dir=${root_dir}/Downloads
|
|
|
|
mkdir --parents ${home_dir}
|
|
|
|
mkdir --parents ${tools_dir}
|
|
|
|
mkdir --parents ${downloads_dir}
|
|
|
|
|
|
|
|
bin_dir=${tools_dir}/Binaries
|
2022-01-19 02:47:12 +00:00
|
|
|
mkdir --parents ${bin_dir}
|
2021-08-21 14:31:45 +00:00
|
|
|
|
2022-05-20 06:14:35 +00:00
|
|
|
# Tools
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
# CMake
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
cmake_sha256=aaced6f745b86ce853661a595bdac6c5314a60f8181b6912a0a4920acfa32708
|
|
|
|
cmake_exe_sha256=95b80ba2b97b619abce1ed6fd28fe189cacba48403e9c69256f2f94e3405e645
|
|
|
|
cmake_version=3.23.2
|
|
|
|
|
|
|
|
cmake_label=cmake_linux64_${cmake_version}
|
|
|
|
cmake_download_file=${downloads_dir}/${cmake_label}.tar.gz
|
|
|
|
cmake_dir=${tools_dir}/${cmake_label}
|
|
|
|
cmake_exe=${cmake_dir}/bin/cmake
|
|
|
|
|
|
|
|
if [[ ! -f "${cmake_exe}" ]]; then
|
|
|
|
DownloadFile "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-linux-x86_64.tar.gz" "${cmake_download_file}" || exit
|
|
|
|
FileSHA256Check "${cmake_download_file}" "${cmake_sha256}" || exit
|
|
|
|
mkdir --parents "${cmake_dir}" && tar xf "${cmake_download_file}" --overwrite --directory="${cmake_dir}" || exit
|
|
|
|
echo "mv --force ${cmake_dir}/cmake-${cmake_version}-linux-x86_64 "${cmake_dir}""
|
|
|
|
mv ${cmake_dir}/cmake-${cmake_version}-linux-x86_64/* "${cmake_dir}" || exit
|
|
|
|
rm --recursive ${cmake_dir}/cmake-${cmake_version}-linux-x86_64 || exit
|
2020-07-22 01:02:05 +00:00
|
|
|
fi
|
2019-02-05 05:43:53 +00:00
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
FileSHA256Check "${cmake_exe}" "${cmake_exe_sha256}" || exit
|
|
|
|
cd "${bin_dir}" && ln --force --symbolic --relative "${cmake_exe}" cmake && cd "${root_dir}"
|
|
|
|
cd "${bin_dir}" && ln --force --symbolic --relative "${cmake_exe}" cmake-${cmake_version} && cd "${root_dir}"
|
2021-01-06 23:23:02 +00:00
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
# Vim Configuration
|
2022-01-19 02:47:12 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2022-07-10 07:25:29 +00:00
|
|
|
cp --force ${installer_dir}/os_vimrc ~/.vimrc || exit
|
|
|
|
cp --force ${installer_dir}/os_clang_format_style_file ~/_clang-format || exit
|
|
|
|
|
|
|
|
# Nvim Config
|
|
|
|
nvim_init_dir=~/.config/nvim
|
|
|
|
mkdir --parents "${nvim_init_dir}"
|
|
|
|
cp --force ${installer_dir}/os_nvim_init.vim ${nvim_init_dir}/init.vim || exit
|
|
|
|
|
|
|
|
# Vim Package Manager
|
|
|
|
vim_plug_dir=${nvim_init_dir}/autoload
|
|
|
|
vim_plug=${vim_plug_dir}/plug.vim
|
|
|
|
mkdir --parents ${vim_plug_dir}
|
|
|
|
DownloadFile "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" "${vim_plug}" || exit
|
|
|
|
|
|
|
|
# Nvim
|
2022-01-19 02:47:12 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2022-07-10 07:25:29 +00:00
|
|
|
nvim_sha256=33b5d020c730b6d1b5185b1306ead83b6b8f8fab0239e0580c72b5224a9658e1
|
|
|
|
nvim_version=0.7.2
|
|
|
|
|
|
|
|
nvim_label=nvim_linux64_${nvim_version}
|
|
|
|
nvim_exe=${tools_dir}/${nvim_label}.appimage
|
|
|
|
|
|
|
|
DownloadFile "https://github.com/neovim/neovim/releases/download/v${nvim_version}/nvim.appimage" "${nvim_exe}" || exit
|
|
|
|
FileSHA256Check "${nvim_exe}" "${nvim_sha256}" || exit
|
|
|
|
|
|
|
|
chmod +x "${nvim_exe}"
|
|
|
|
cd "${bin_dir}" && ln --force --symbolic --relative "${nvim_exe}" nvim && cd "${root_dir}"
|
|
|
|
cd "${bin_dir}" && ln --force --symbolic --relative "${nvim_exe}" vim && cd "${root_dir}"
|
2022-05-20 06:14:35 +00:00
|
|
|
|
|
|
|
# Neovide
|
|
|
|
# ----------------------------------------------------------------------------
|
2022-07-10 07:25:29 +00:00
|
|
|
neovide_sha256=684cbcaeb2e67f1d95822ef80e03e1475395d537f2032f47b8202fe48c428b08
|
|
|
|
neovide_exe_sha256=e4fbc8b56af2e25127938ae2974921e25b4df5722086d7e8c3e517e8ee86e2df
|
|
|
|
neovide_version=0.9.0
|
2022-05-20 06:14:35 +00:00
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
neovide_label=neovide_linux64_${neovide_version}
|
|
|
|
neovide_download_file=${downloads_dir}/${neovide_label}.tar.gz
|
|
|
|
neovide_dir=${tools_dir}
|
|
|
|
neovide_exe=${neovide_dir}/${neovide_label}
|
2022-05-20 06:14:35 +00:00
|
|
|
|
|
|
|
if [[ ! -f "${neovide_exe}" ]]; then
|
2022-07-10 07:25:29 +00:00
|
|
|
DownloadFile "https://github.com/neovide/neovide/releases/download/${neovide_version}/neovide.tar.gz" ${neovide_download_file} || exit
|
|
|
|
FileSHA256Check ${neovide_download_file} ${neovide_sha256} || exit
|
|
|
|
|
|
|
|
mkdir --parents "${cmake_dir}" && tar xf ${neovide_download_file} --overwrite --directory=${neovide_dir}/neovide-tmp || exit
|
|
|
|
mv ${neovide_dir}/neovide-tmp/target/release/neovide "${neovide_exe}" || exit
|
|
|
|
rm -rf ${neovide_dir}/neovide-tmp
|
2022-05-20 06:14:35 +00:00
|
|
|
fi
|
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
FileSHA256Check ${neovide_exe} ${neovide_exe_sha256} || exit
|
|
|
|
cd "${bin_dir}" && ln --force --symbolic --relative "${neovide_exe}" neovide && cd "${root_dir}"
|
2020-11-05 03:41:47 +00:00
|
|
|
|
|
|
|
# Ctags
|
2022-01-19 02:47:12 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
rm --force ${bin_dir}/ctags_cpp.sh
|
|
|
|
echo ctags --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ \$\@ >> ${bin_dir}/ctags_cpp.sh
|
2022-05-16 12:51:54 +00:00
|
|
|
chmod +x ${bin_dir}/ctags_cpp.sh
|
2022-05-20 06:14:35 +00:00
|
|
|
|
2022-07-10 07:25:29 +00:00
|
|
|
echo PATH=${tools_dir}/Binaries:\$\{PATH\}> ${tools_dir}/linux_terminal.sh
|
|
|
|
|