Commit c1a963e

bryfry <116113+bryfry@users.noreply.github.com>
2021-11-25 10:41:05
Update mf.sh
1 parent de7ed45
Changed files (1)
mf.sh
@@ -4,23 +4,26 @@ 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 scdaemon pinentry-tty dnsutils mtr-tiny
+sudo apt install -y dnsutils mtr-tiny
 
 ### Stop unwanted services
 sudo systemctl disable avahi-daemon.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
-systemctl --user mask --now gpg-agent.service gpg-agent.socket gpg-agent-ssh.socket gpg-agent-extra.socket gpg-agent-browser.socket
-sudo update-alternatives --set pinentry /usr/bin/pinentry-tty
+sudo apt install -y scdaemon pinentry-tty
+sudo update-alternatives --set pinentry /usr/bin/pinentry-curses
 
 # enable ssh
 sudo systemctl enable ssh
@@ -29,7 +32,7 @@ sudo systemctl start ssh
 ### Configuration files
 
 ###### /etc/host[s|name] ######
-echo mf3 | sudo tee /etc/hostname
+echo mf4 | sudo tee /etc/hostname
 sudo tee << EOF /etc/hosts > /dev/null
 # managed by mf.sh
 127.0.0.1	localhost
@@ -42,8 +45,8 @@ EOF
 ###### /etc/default/keyboard ######
 sudo tee << EOF /etc/default/keyboard > /dev/null
 # managed by mf.sh
-XKBLAYOUT="us"
-BACKSPACE="guess"
+XKBLAYOUT='us'
+BACKSPACE='guess'
 EOF
 
 ###### /etc/default/console-setup ######
@@ -64,12 +67,6 @@ max-cache-ttl 1200
 pinentry-program /usr/bin/pinentry-tty
 EOF
 
-###### /home/pi/.ssh/authorized_keys ######
-mkdir -p /home/pi/.ssh/
-tee << EOF /home/pi/.ssh/authorized_keys > /dev/null
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDGLlbdAnZXOQp/1ReBj9IqUvjNZBJtuvm4zk0mWKORgqgdAAkiHcb4eY1XWsdtNjNFjKPAD97XlTTcPQuDGJnZ9xV6MsGiyag3aAmrJZBxqWmgDeY8EDo7L7mLwBxO/XHkQc98RIQ0KvmDlKknoABqYcvrzw2GvROOjbKfTrv6FeuoTQqAJBB8iR4WC5NlUvY19lP4AmqZuaya7cEbM6gfK4VuOYjFgvAN3n18Cj8MTTvx5GtFR6n2AKjKeoMgJIN+J6Tl0GZuTNOAK2SqDacNSmOLgNKDkWTmDUHl5zvVLGl4gMU3b8azGsRyOElGHOkjQADj5udCaOjvfDUxK2svwhsAhF/GZiZ2yCQZeAsWiS1otNnsqH+y/dWAHJRQiDIp1ZycXuPySJdRA9RYOfCVASXXzlTGA2+T1vW+kYQyzoXepF2cCIDc3SwSpXUOVEtbvsTVJgJPfs6Uqmy74nbw3nbfedxQmODiDVK1YHLO/lZX6fZODIxjApZLs7S/zSK3a6m22ZP6DJTLtrcwj387wEikk9v9HKSAYuf83V7qghcOAxfPqyLn3k4Wc4P9HcqpYyyMGqrz6JPpfdWMy1LsNVk8D9IGDZEAM1u0hXLsJJocRPkWIF2RX1eToj9tpAq2hWNxQcgoY9xrFMfHpaYV5K/xBU1OIlmtLb0/3Erelw== cardno:000607097811
-EOF
-
 ###### /home/pi/.ssh/config ######
 mkdir -p /home/pi/.ssh/
 tee << EOF /home/pi/.ssh/config > /dev/null
@@ -102,37 +99,21 @@ dtoverlay=sdweak,overclock_50=100
 EOF
 
 ###### .bashrc ###### 
-tee << 'EOF' /home/pi/.bashrc > /dev/null
-# managed by mf.sh, mostly default bashrc without comments
-case $- in
-    *i*) ;;
-      *) return;;
-esac
-HISTCONTROL=ignoreboth
-shopt -s histappend
-HISTSIZE=1000
-HISTFILESIZE=2000
-shopt -s checkwinsize
-case "${TERM}" in
-    xterm-color|*-256color) color_prompt=yes;;
-esac
-PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
-if [ -x /usr/bin/dircolors ]; then
-    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
-    alias ls='ls --color=auto'
-    alias grep='grep --color=auto'
-    alias fgrep='fgrep --color=auto'
-    alias egrep='egrep --color=auto'
-fi
-alias ll='ls -l'
-if ! shopt -oq posix; then
-  if [ -f /usr/share/bash-completion/bash_completion ]; then
-    . /usr/share/bash-completion/bash_completion
-  elif [ -f /etc/bash_completion ]; then
-    . /etc/bash_completion
-  fi
-fi
+# add to end
+source .bashrc_*
 
+###### .bashrc_gpg ###### 
+tee << 'EOF' /home/pi/.bashrc_gpg > /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
@@ -150,25 +131,13 @@ 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"
-
-# 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
-if [[ $runonce -gt 0 ]];
-then
-   echo "not refreshing gpg"
-else
-   gpg-connect-agent updatestartuptty /bye
-   ssh localhost exit
-   runonce=$((runonce + 1))
-   export runonce
-fi
-ssh-add -l
 EOF
 
 ### Reboot