init commit
This commit is contained in:
72
provision/base.sh
Normal file
72
provision/base.sh
Normal file
@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
#
|
||||
# Helper functions
|
||||
#
|
||||
declare -i term_width=80
|
||||
|
||||
h1() {
|
||||
declare border padding text
|
||||
border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m'
|
||||
padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))"
|
||||
text="\\e[1m$*\\e[0m"
|
||||
echo -e "$border"
|
||||
echo -e "${padding}${text}${padding}"
|
||||
echo -e "$border"
|
||||
}
|
||||
|
||||
h2() {
|
||||
printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*"
|
||||
}
|
||||
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# !!!!!!!!!!!!!!!
|
||||
# Wyłącz swap!!
|
||||
# swapoff -a
|
||||
# sed -i -E 's,^([^#]+\sswap\s.+),#\1,' /etc/fstab
|
||||
|
||||
h1 "Debug networking and system uuid"
|
||||
ip addr
|
||||
cat /sys/class/dmi/id/product_uuid
|
||||
|
||||
h1 "Prepare base system"
|
||||
h2 "Install applications and utils"
|
||||
# update the package cache.
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends jq curl bash-completion vim tcpdump traceroute iptables
|
||||
|
||||
h2 "Configure vim"
|
||||
cat >/etc/vim/vimrc.local <<'EOF'
|
||||
syntax on
|
||||
set background=dark
|
||||
set esckeys
|
||||
set ruler
|
||||
set laststatus=2
|
||||
set nobackup
|
||||
EOF
|
||||
|
||||
h2 "Configure shell"
|
||||
cat >/etc/profile.d/login.sh <<'EOF'
|
||||
[[ "$-" != *i* ]] && return
|
||||
export EDITOR=vim
|
||||
export PAGER=less
|
||||
alias l='ls -lF --color'
|
||||
alias ll='l -a'
|
||||
alias h='history 25'
|
||||
alias j='jobs -l'
|
||||
EOF
|
||||
|
||||
cat >/etc/inputrc <<'EOF'
|
||||
set input-meta on
|
||||
set output-meta on
|
||||
set show-all-if-ambiguous on
|
||||
set completion-ignore-case on
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
"\eOD": backward-word
|
||||
"\eOC": forward-word
|
||||
EOF
|
||||
|
Reference in New Issue
Block a user