switching to neovim and fixing git-passthru setup
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
read -p 'Install prerequisites (git, vim, curl, and jq)? [y/N]: ' response
|
||||
read -p 'Install prerequisites (git, neovim, curl, and jq)? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
# before we can begin, we need what should have already been installed
|
||||
sudo apt install git vim curl jq -y
|
||||
sudo apt install git neovim curl jq -y
|
||||
;;
|
||||
* )
|
||||
echo 'Skipping'
|
||||
|
||||
@@ -86,7 +86,7 @@ echo ''
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
install_collection 'core utilities: (curl, python3, jq, htop, etc.)' curl git htop jq grep gzip net-tools goaccess dnsutils bash-completion cron vim make chrony build-essential gcc inotify-tools python3 python-is-python3 screen bc
|
||||
install_collection 'core utilities: (curl, python3, jq, htop, etc.)' curl git htop jq grep gzip net-tools goaccess dnsutils bash-completion cron neovim make chrony build-essential gcc inotify-tools python3 python-is-python3 screen bc
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
|
||||
+20
-20
@@ -244,26 +244,26 @@ read -p 'Set VIM colors, config, and plugins? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
make_bashrc_backup
|
||||
if [[ -z $(command -v 'vim') ]] || [[ -z $(command -v 'curl') ]] || [[ -z $(command -v 'jq') ]]; then
|
||||
sudo apt install vim curl jq -y
|
||||
if [[ -z $(command -v 'nvim') ]] || [[ -z $(command -v 'curl') ]] || [[ -z $(command -v 'jq') ]]; then
|
||||
sudo apt install neovim curl jq -y
|
||||
fi
|
||||
( cat << 'BASHRC'
|
||||
|
||||
# ABS default to using vim
|
||||
export EDITOR=vim
|
||||
export VISUAL=vim
|
||||
# ABS default to using neovim
|
||||
export EDITOR=nvim
|
||||
export VISUAL=nvim
|
||||
# ABS less to render tabs as 4 characters
|
||||
export LESS=Rx4
|
||||
|
||||
BASHRC
|
||||
) >> "${HOME}/.bashrc"
|
||||
|
||||
if [[ -f "${HOME}/.vimrc" ]] && [[ ! -f "${HOME}/vimrc.backup.${curdate}" ]]; then
|
||||
mv "${HOME}/.vimrc" "${HOME}/vimrc.backup.${curdate}"
|
||||
if [[ -f "${HOME}/.config/nvim/init.vim" ]] && [[ ! -f "${HOME}/nvim-init.backup.${curdate}" ]]; then
|
||||
mv "${HOME}/.config/nvim/init.vim" "${HOME}/nvim-init.backup.${curdate}"
|
||||
fi
|
||||
|
||||
[ ! -d "${HOME}/.vim/colors" ] && mkdir -p "${HOME}/.vim/colors"
|
||||
[ ! -d "${HOME}/.vim/autoload" ] && mkdir -p "${HOME}/.vim/autoload"
|
||||
[ ! -d "${HOME}/.config/nvim/colors" ] && mkdir -p "${HOME}/.config/nvim/colors"
|
||||
[ ! -d "${HOME}/.config/nvim/autoload" ] && mkdir -p "${HOME}/.config/nvim/autoload"
|
||||
|
||||
# determine vim-plug latest version release tag
|
||||
version=$(curl --silent 'https://api.github.com/repos/junegunn/vim-plug/releases/latest' | jq -r '.tag_name')
|
||||
@@ -271,19 +271,19 @@ BASHRC
|
||||
# fallback to main branch if needed
|
||||
version="master"
|
||||
fi
|
||||
curl --output "${HOME}/.vim/autoload/plug.vim" --silent "https://raw.githubusercontent.com/junegunn/vim-plug/${version}/plug.vim"
|
||||
curl --output "${HOME}/.config/nvim/autoload/plug.vim" --silent "https://raw.githubusercontent.com/junegunn/vim-plug/${version}/plug.vim"
|
||||
|
||||
cp "${script_dir}/config/vim-vimrc" "${HOME}/.vimrc"
|
||||
cp "${script_dir}/config/vim-colors/colorful256.vim" "${HOME}/.vim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/desertink.vim" "${HOME}/.vim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/everforest.vim" "${HOME}/.vim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/gruvbox.vim" "${HOME}/.vim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/jellybeans.vim" "${HOME}/.vim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/space-vim-dark.vim" "${HOME}/.vim/colors/"
|
||||
cp "${script_dir}/config/vim-autoload/everforest.vim" "${HOME}/.vim/autoload/"
|
||||
cp "${script_dir}/config/vim-autoload/gruvbox.vim" "${HOME}/.vim/autoload/"
|
||||
cp "${script_dir}/config/vim-vimrc" "${HOME}/.config/nvim/init.vim"
|
||||
cp "${script_dir}/config/vim-colors/colorful256.vim" "${HOME}/.config/nvim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/desertink.vim" "${HOME}/.config/nvim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/everforest.vim" "${HOME}/.config/nvim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/gruvbox.vim" "${HOME}/.config/nvim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/jellybeans.vim" "${HOME}/.config/nvim/colors/"
|
||||
cp "${script_dir}/config/vim-colors/space-vim-dark.vim" "${HOME}/.config/nvim/colors/"
|
||||
cp "${script_dir}/config/vim-autoload/everforest.vim" "${HOME}/.config/nvim/autoload/"
|
||||
cp "${script_dir}/config/vim-autoload/gruvbox.vim" "${HOME}/.config/nvim/autoload/"
|
||||
|
||||
vim +'PlugInstall --sync' +quitall
|
||||
nvim +'PlugInstall --sync' +quitall
|
||||
;;
|
||||
* )
|
||||
echo 'Skipping'
|
||||
|
||||
+18
-14
@@ -36,10 +36,27 @@ echo ''
|
||||
groups git > /dev/null
|
||||
userExists="$?"
|
||||
|
||||
# we need that directory to exist, if we are going to make the shell file
|
||||
sudo mkdir -p /home/git
|
||||
|
||||
# create shell for git user, put in /usr/local/bin/git-shell
|
||||
echo 'creating custom git-shell'
|
||||
( cat << 'TERM'
|
||||
#!/bin/sh
|
||||
/usr/bin/docker exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" 'gitea' sh "$@"
|
||||
|
||||
TERM
|
||||
) | sudo tee '/home/git/git-shell' > /dev/null
|
||||
|
||||
# make it executable
|
||||
echo 'making custom git-shell executable'
|
||||
sudo chmod +x /home/git/git-shell
|
||||
|
||||
# user doesn't exist yet, so create it, just the way we want it
|
||||
if [[ "$userExists" -ne "0" ]]; then
|
||||
echo 'create git user (locked password, custom shell, docker group)'
|
||||
sudo useradd git -d /home/git -s /home/git/git-shell -m -U git -G docker
|
||||
|
||||
sudo useradd -d /home/git -s /home/git/git-shell -m -U -G docker git
|
||||
else
|
||||
# user exists, make sure it matches our expectations
|
||||
echo 'git user already exists'
|
||||
@@ -70,24 +87,11 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# create shell for git user, put in /usr/local/bin/git-shell
|
||||
echo 'creating custom git-shell'
|
||||
( cat << 'TERM'
|
||||
#!/bin/sh
|
||||
/usr/bin/docker exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" 'gitea' sh "$@"
|
||||
|
||||
TERM
|
||||
) | sudo tee '/home/git/git-shell' > /dev/null
|
||||
|
||||
# use custom docker container name, if provided one
|
||||
if [[ ! -z "$dockerContainer" ]]; then
|
||||
sudo sed -i "s/gitea/${dockerContainer}/g" /home/git/git-shell
|
||||
fi
|
||||
|
||||
# make it executable
|
||||
echo 'making custom git-shell executable'
|
||||
sudo chmod +x /home/git/git-shell
|
||||
|
||||
# update sshd config to allow the docker container to specify the list of authorized keys
|
||||
echo 'configuring sshd to check docker container for authorized keys for git user'
|
||||
sudo mkdir -p '/etc/ssh/sshd_config.d'
|
||||
|
||||
Reference in New Issue
Block a user