Compare commits
	
		
			2 Commits
		
	
	
		
			67ffb18e03
			...
			c828dfc2e6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c828dfc2e6 | |||
| feb789c989 | 
@ -1,4 +1,4 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
HASH="%C(yellow)%h%C(reset)"
 | 
			
		||||
RELATIVE_TIME="%C(green)%ar%C(reset)"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										59
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								install.sh
									
									
									
									
									
								
							@ -1,38 +1,65 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
function install_pkg() {
 | 
			
		||||
  if hash apt-get 2>/dev/null; then
 | 
			
		||||
    sudo -n apt-get update
 | 
			
		||||
    sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${@}
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if hash nix 2>/dev/null; then
 | 
			
		||||
    echo "INSTALL ${@} yourself with nix"
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setup_ssh() {
 | 
			
		||||
  configfile=~/.ssh/config
 | 
			
		||||
  if grep -Fxq "# dotfiles installed" ${configfile}; then
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  mkdir -p ~/.ssh
 | 
			
		||||
  touch ~/.ssh/config
 | 
			
		||||
  chmod 644 ~/.ssh/config
 | 
			
		||||
  cat << EOF >> ~/.ssh/config
 | 
			
		||||
  touch ${configfile}
 | 
			
		||||
  chmod 644 ${configfile}
 | 
			
		||||
  cat << EOF >> ${configfile}
 | 
			
		||||
Include ${HOME}/dotfiles/ssh.config
 | 
			
		||||
# dotfiles installed
 | 
			
		||||
EOF
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setup_git() {
 | 
			
		||||
  cat << EOF > ~/.gitconfig
 | 
			
		||||
  configfile=~/.gitconfig
 | 
			
		||||
  if grep -Fxq "# dotfiles installed" ${configfile}; then
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  cat << EOF > ${configfile}
 | 
			
		||||
[include]
 | 
			
		||||
  path = ${HOME}/dotfiles/git/gitconfig
 | 
			
		||||
[core]
 | 
			
		||||
  excludesfile = ${HOME}/dotfiles/git/gitignore_global
 | 
			
		||||
# dotfiles installed
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
  setup_ssh
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setup_tmux() {
 | 
			
		||||
  sudo -n apt-get update
 | 
			
		||||
  sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    tmux
 | 
			
		||||
  cat << EOF > ~/.tmux.conf
 | 
			
		||||
  configfile=~/.tmux.conf
 | 
			
		||||
  if grep -Fxq "# dotfiles installed" ${configfile}; then
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  install_pkg tmux
 | 
			
		||||
  cat << EOF > ${configfile}
 | 
			
		||||
source ${HOME}/dotfiles/tmux/tmux.conf
 | 
			
		||||
# dotfiles.installed
 | 
			
		||||
EOF
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setup_fish() {
 | 
			
		||||
  sudo -n apt-get update
 | 
			
		||||
  sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    fish
 | 
			
		||||
  install_pkg fish
 | 
			
		||||
 | 
			
		||||
  USER=`whoami`
 | 
			
		||||
  sudo -n chsh $USER -s $(which fish)
 | 
			
		||||
@ -45,9 +72,7 @@ function setup_fish() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setup_nvim() {
 | 
			
		||||
  sudo -n apt-get update
 | 
			
		||||
  sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    neovim
 | 
			
		||||
  install_pkg neovim
 | 
			
		||||
  mkdir -p ~/.config/nvim/
 | 
			
		||||
  ln -s ~/dotfiles/init.vim ~/.config/nvim/init.vim
 | 
			
		||||
 | 
			
		||||
@ -60,10 +85,12 @@ function setup_nvim() {
 | 
			
		||||
 | 
			
		||||
function main() {
 | 
			
		||||
 | 
			
		||||
  sudo apt-get install locales less
 | 
			
		||||
  install_pkg locales less
 | 
			
		||||
 | 
			
		||||
  if [[ ${REMOTE_CONTAINERS} || ${DEVCONTAINER} ]]; then
 | 
			
		||||
    echo "sv_SE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
 | 
			
		||||
    sudo locale-gen
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  setup_fish
 | 
			
		||||
  setup_ssh
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
cd "$(dirname "$0")/.."
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user