Commit 724a4d7
Changed files (6)
.gitignore
@@ -1,1 +1,3 @@
wpa_supplicant.conf
+venv
+*.swp
ansible.cfg
@@ -0,0 +1,5 @@
+[defaults]
+localhost_warning=False
+
+[inventory]
+inventory_unparsed_warning=False
main.yml
@@ -0,0 +1,27 @@
+---
+- name: mf main.yml
+ hosts: localhost
+ gather_facts: True
+ vars_files: "vars.yml"
+ tasks:
+ - name: apt update cache
+ apt:
+ update_cache: True
+ cache_valid_time: 1800 #30m
+ become: True
+
+ - name: apt upgrade
+ apt:
+ name: "*"
+ state: latest
+ update_cache: True
+ cache_valid_time: 1800 #30m
+ become: True
+
+ - name: apt install tools
+ apt:
+ update_cache: True
+ cache_valid_time: 1800 #30m
+ state: latest
+ pkg: "{{ apt_pkgs }}"
+ become: True
mf.sh
@@ -1,75 +1,38 @@
#!/bin/bash
set -euxo pipefail
-### Set password
-sudo passwd pi
-
### Apt
sudo apt update
sudo apt -y upgrade
-sudo SKIP_WARNING=1 rpi-update
sudo apt install -y dnsutils mtr-tiny
-### Stop unwanted services
-sudo systemctl disable avahi-daemon.service
-sudo systemctl disable hciuart.service
-sudo systemctl disable bluetooth.service
-sudo systemctl disable triggerhappy.service
-
-
-### Linux console font
-sudo wget -q "https://github.com/powerline/fonts/raw/master/Terminus/PSF/ter-powerline-v14n.psf.gz" -O /usr/share/consolefonts/ter-powerline-v14n.psf.gz
-sudo wget -q "https://github.com/powerline/fonts/raw/master/Terminus/PSF/ter-powerline-v14b.psf.gz" -O /usr/share/consolefonts/ter-powerline-v14b.psf.gz
-
### Yubikey
sudo apt install -y scdaemon pinentry-curses
-sudo update-alternatives --set pinentry /usr/bin/pinentry-curses
-
-# enable ssh
-sudo systemctl enable ssh
-sudo systemctl start ssh
+sudo update-alternatives --set pinentry /usr/bin/pinentry-gnome3
### Configuration files
-###### /etc/host[s|name] ######
+#### /etc/host[s|name]
echo mf4 | sudo tee /etc/hostname
sudo tee << EOF /etc/hosts > /dev/null
# managed by mf.sh
127.0.0.1 localhost
-::1 localhost ip6-localhost ip6-loopback
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-127.0.1.1 mf3
-EOF
-
-###### /etc/default/keyboard ######
-sudo tee << EOF /etc/default/keyboard > /dev/null
-# managed by mf.sh
-XKBLAYOUT='us'
-BACKSPACE='guess'
-EOF
-
-###### /etc/default/console-setup ######
-sudo tee << EOF /etc/default/console-setup > /dev/null
-# managed by mf.sh
-ACTIVE_CONSOLES="/dev/tty[1-6]"
-CHARMAP="UTF-8"
-CODESET="guess"
-FONT='ter-powerline-v14b.psf.gz'
+127.0.1.1 mf4
EOF
-###### /home/pi/.gnupg/gpg-agent.conf ########
-mkdir -p /home/pi/.gnupg/
-tee << EOF /home/pi/.gnupg/gpg-agent.conf > /dev/null
+#### /home/pi/.gnupg/gpg-agent.conf
+mkdir -p ${HOME}/.gnupg/
+tee << EOF ${HOME}/.gnupg/gpg-agent.conf > /dev/null
enable-ssh-support
-default-cache-ttl 600
-max-cache-ttl 1200
-pinentry-program /usr/bin/pinentry-tty
+ttyname $GPG_TTY
+default-cache-ttl 60
+max-cache-ttl 120
+pinentry-program /usr/bin/pinentry-gnome3
EOF
###### /home/pi/.ssh/config ######
-mkdir -p /home/pi/.ssh/
-tee << EOF /home/pi/.ssh/config > /dev/null
+mkdir -p ${HOME}/.ssh/
+tee << EOF ${HOME}/.ssh/config > /dev/null
Host tmc
Hostname trustme.click
User ubuntu
@@ -77,67 +40,19 @@ Host tmc
ForwardAgent true
EOF
-###### /boot/config.txt ######
-sudo tee << EOF /boot/config.txt > /dev/null
-# managed by mf.sh
-
-# boot settings
-boot_delay=0
-disable_splash=1
-
-# video settings
-hdmi_force_hotplug=1 # force hdmi to be 'on' even if it is not plugged in
-hdmi_drive=1 # no sound
-hdmi_group=2
-hdmi_mode=83 # 1600x900
-hdmi_blanking=0 # screen 'off' = black
-framebuffer_width=1600
-framebuffer_height=900
-
-# overclock sdcard
-dtoverlay=sdweak,overclock_50=100
-EOF
-
-###### .bashrc ######
-# add to end
+#### .bashrc
+LINE='source .bashrc.d/*'
+FILE="${HOME}/.bashrc"
+grep -qF "${LINE}" "${FILE}" || echo "${LINE}" | tee --append "${FILE}"
source .bashrc_*
+mkdir -p ${HOME}/.bashrc.d
-###### .bashrc_gpg ######
-tee << 'EOF' /home/pi/.bashrc_gpg > /dev/null
+#### .bashrc_gpg
+tee << 'EOF' ${HOME}/.bashrc.d/gpg.sh > /dev/null
# GPG Yubikey -- github.com/drduh/Yubikey-Guide
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
-gpg-connect-agent updatestartuptty /bye
-ssh-add -l
-EOF
-
-###### .bashrc_colors ######
-tee << 'EOF' /home/pi/.bashrc_colors > /dev/null
-# base16 pop for linux term
-echo -en "\e]P0000000" #C00 black
-echo -en "\e]P1EB008A" #C01 darkred
-echo -en "\e]P237B449" #C02 darkgreen
-echo -en "\e]P3F8CA12" #C03 yellow (brown)
-echo -en "\e]P40E5A94" #C04 darkblue
-echo -en "\e]PC0C92F2" #blue (lighter than orig)
-echo -en "\e]P5B31E8D" #C05 darkmagenta
-echo -en "\e]P600AABB" #C06 darkcyan
-echo -en "\e]P7E0E0E0" #C07 lightgrey
-echo -en "\e]P8505050" #C08 darkgrey
-echo -en "\e]P9EB008A" #C09 red
-echo -en "\e]PA37B449" #green
-echo -en "\e]PBF8CA12" #yellow
-echo -en "\e]PDB31E8D" #magenta
-echo -en "\e]PE00AABB" #cyan
-echo -en "\e]PFFFFFFF" #white
-EOF
-
-###### .bashrc_colors ######
-tee << 'EOF' /home/pi/.bashrc_fonts > /dev/null
-# bold/thin console font
-alias thin="setfont /usr/share/consolefonts/ter-powerline-v14n.psf.gz && echo -en \"\e]P7FFFFFF\" && clear && showconsolefont -v"
-alias bold="setfont /usr/share/consolefonts/ter-powerline-v14b.psf.gz && echo -en \"\e]P7E0E0E0\" && clear && showconsolefont -v"
EOF
### Reboot
README.md
@@ -1,3 +1,20 @@
+## Quickstart
+
+```bash
+{
+ sudo apt update
+ sudo apt install -y python3-pip python3-venv git
+ mkdir -p ${HOME}/git
+ git clone git@github.com:bryfry/mg.git ${HOME}/git/mf
+ cd ${HOME}/git/mf
+ python3 -m venv venv
+ source venv/bin/activate
+ python3 -m pip install ansible
+ ansible-playbook main.yml --ask-become-pass
+}
+```
+
+
## Prescript commands
- `sudo raspi-config` _#set us keyboard_
vars.yml
@@ -0,0 +1,22 @@
+# mf vars.yml
+---
+apt_pkgs:
+ - sway
+ # cli
+ - kitty
+ - tmux
+ - htop
+ - vim
+ - git
+ # utils
+ - unzip
+ - strace
+ - shellcheck
+ # browser
+ - firefox-esr
+ # yubikey
+ - gnupg2
+ - gnupg-agent
+ - scdaemon
+ - pcscd
+ - pinentry-gnome3