Clening of setup script. Add ssh config
This commit is contained in:
parent
2d63016f8a
commit
497f1b1fa6
71
install.sh
71
install.sh
@ -4,13 +4,17 @@ function install_dependencies() {
|
||||
sudo -n apt-get update
|
||||
sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
fish \
|
||||
neovim
|
||||
neovim \
|
||||
tmux
|
||||
}
|
||||
|
||||
function setup_ssh() {
|
||||
mkdir -p ~/.ssh
|
||||
touch ~/.ssh/config
|
||||
chmod 644 ~/.ssh/config
|
||||
cat << EOF >> ~/.ssh/config
|
||||
Include ${HOME}/dotfiles/ssh.config
|
||||
EOF
|
||||
}
|
||||
|
||||
function setup_git() {
|
||||
@ -22,43 +26,50 @@ function setup_git() {
|
||||
EOF
|
||||
|
||||
setup_ssh
|
||||
cat << EOF >> ~/.ssh/config
|
||||
Host *
|
||||
AddKeysToAgent yes
|
||||
IdentityFile ~/.ssh/thomas_rsa
|
||||
VisualHostKey yes
|
||||
Host github.com
|
||||
User git
|
||||
Host gitea
|
||||
HostName git.thomasloven.com
|
||||
User git
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
USER=`whoami`
|
||||
function setup_tmux() {
|
||||
cat << EOF > ~/.tmux.conf
|
||||
source ${HOME}/dotfiles/tmux/tmux.conf
|
||||
EOF
|
||||
}
|
||||
|
||||
if [[ ${REMOTE_CONTAINERS} || ${DEVCONTAINER} ]]; then
|
||||
function setup_fish() {
|
||||
USER=`whoami`
|
||||
sudo -n chsh $USER -s $(which fish)
|
||||
# Force fish shell for devcontainers
|
||||
echo "exec $(which fish) -l" >> ~/.profile
|
||||
echo "exec $(which fish) -l" >> ~/.bashrc
|
||||
echo "exec $(which fish) -l" >> ~/.zshrc
|
||||
|
||||
mkdir -p ~/.config/
|
||||
ln -s ~/dotfiles/fish ~/.config/fish
|
||||
}
|
||||
|
||||
function setup_nvim() {
|
||||
mkdir -p ~/.config/nvim/
|
||||
ln -s ~/dotfiles/init.vim ~/.config/nvim/init.vim
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
||||
if [[ ${REMOTE_CONTAINERS} || ${DEVCONTAINER} ]]; then
|
||||
|
||||
echo "INSTALLING IN DEVCONTAINER"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
install_dependencies
|
||||
install_dependencies
|
||||
|
||||
sudo -n chsh $USER -s $(which fish)
|
||||
echo "exec $(which fish) -l" >> ~/.profile
|
||||
echo "exec $(which fish) -l" >> ~/.bashrc
|
||||
echo "exec $(which fish) -l" >> ~/.zshrc
|
||||
|
||||
echo "sv_SE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
|
||||
sudo locale-gen
|
||||
echo "sv_SE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
|
||||
sudo locale-gen
|
||||
|
||||
setup_ssh
|
||||
setup_git
|
||||
|
||||
mkdir -p ~/.config/
|
||||
ln -s ~/dotfiles/fish ~/.config/fish
|
||||
mkdir -p ~/.config/nvim/
|
||||
ln -s ~/dotfiles/init.vim ~/.config/nvim/init.vim
|
||||
setup_fish
|
||||
setup_ssh
|
||||
setup_git
|
||||
setup_tmux
|
||||
setup_nvim
|
||||
}
|
||||
|
||||
main $@
|
||||
|
9
ssh.config
Normal file
9
ssh.config
Normal file
@ -0,0 +1,9 @@
|
||||
Host *
|
||||
AddKeysToAgent yes
|
||||
IdentityFile ~/.ssh/thomas_rsa
|
||||
VisualHostKey yes
|
||||
Host github.com
|
||||
User git
|
||||
Host gitea
|
||||
HostName git.thomasloven.com
|
||||
User git
|
@ -4,6 +4,9 @@ cd "$(dirname "$0")/.."
|
||||
|
||||
docker build . -t dotfiles -f test/Dockerfile.devcontainer --force-rm
|
||||
|
||||
docker run --rm -it -v $(pwd):/workspaces/test dotfiles zsh
|
||||
docker run --rm -it \
|
||||
-v $(pwd):/workspaces/test \
|
||||
-v $(dirname $SSH_AUTH_SOCK):$(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK\
|
||||
dotfiles zsh
|
||||
|
||||
docker rmi dotfiles
|
||||
|
Loading…
x
Reference in New Issue
Block a user