diff options
| author | Sam Chudnick <sam@chudnick.com> | 2022-02-12 17:44:49 -0500 | 
|---|---|---|
| committer | Sam Chudnick <sam@chudnick.com> | 2022-02-12 17:44:49 -0500 | 
| commit | afdbc74b5aee3f9c7873e0c5397487f4f52afdfa (patch) | |
| tree | 6de72a8c57aca849ccbb61da057d6fc81c207723 | |
| parent | 2e98e5cc4d4537a713cac2861abdd60bcda64675 (diff) | |
| -rw-r--r-- | deploy.conf | 16 | ||||
| -rwxr-xr-x | deploy.sh | 105 | ||||
| -rwxr-xr-x | init.sh | 52 | ||||
| -rwxr-xr-x | user.sh | 53 | 
4 files changed, 105 insertions, 121 deletions
| diff --git a/deploy.conf b/deploy.conf deleted file mode 100644 index 469d144..0000000 --- a/deploy.conf +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # Configuration file for deployment script | ||
| 4 | |||
| 5 | #BACKPORTS=1 | ||
| 6 | #VM=1 | ||
| 7 | #AMDCPU=1 | ||
| 8 | #INTELCPU=1 | ||
| 9 | #AMDGPU=1 | ||
| 10 | #APTOPTS="--no-install-recommends" | ||
| 11 | #DWM=1 | ||
| 12 | #DWMBLOCKS=1 | ||
| 13 | #CONFIG_SSH=1 | ||
| 14 | #CONFIG_SSH_SERVER=1 | ||
| 15 | #CONFIG_GPG=1 | ||
| 16 | |||
| diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..0396b90 --- /dev/null +++ b/deploy.sh | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Feature variables - uncomment to enable, comment to disable | ||
| 4 | #BACKPORTS=1 | ||
| 5 | #VM=1 | ||
| 6 | #AMDCPU=1 | ||
| 7 | #INTELCPU=1 | ||
| 8 | #AMDGPU=1 | ||
| 9 | #APTOPTS="--no-install-recommends" | ||
| 10 | DWM=1 | ||
| 11 | DWMBLOCKS=1 | ||
| 12 | #CONFIG_SSH=1 | ||
| 13 | #CONFIG_SSH_SERVER=1 | ||
| 14 | #CONFIG_GPG=1 | ||
| 15 | |||
| 16 | # Change apt sources to use https | ||
| 17 | sed -i "s/http:/https:/" /etc/apt/sources.list | ||
| 18 | |||
| 19 | [ ! -z $BACKPORTS ] && echo "deb https://deb.debian.org/debian/ bullseye-backports main" >> \ | ||
| 20 | /etc/apt/sources.list | ||
| 21 | |||
| 22 | # Update packages | ||
| 23 | apt update -y && apt upgrade -y | ||
| 24 | |||
| 25 | # Temporarily add contrib and non-free repos for necessary proprietary firmware and microcode | ||
| 26 | sed -i "s/main/main contrib non-free/" /etc/apt/sources.list | ||
| 27 | apt update -y | ||
| 28 | |||
| 29 | [ ! -z $AMDCPU ] && apt install amd64-microcode -y | ||
| 30 | [ ! -z $AMDGPU ] && apt install firmware-amd-graphics -y | ||
| 31 | [ ! -z $INTELCPU ] && apt install intel-microcode -y | ||
| 32 | |||
| 33 | # Remove contrib and non-free repos | ||
| 34 | sed -i "s/main contrib non-free/main/" /etc/apt/sources.list | ||
| 35 | apt update -y | ||
| 36 | |||
| 37 | # Install packages | ||
| 38 | apt install $(cat packages.base) -y | ||
| 39 | apt install $(cat packages.custom) -y | ||
| 40 | |||
| 41 | # For virtual machines | ||
| 42 | |||
| 43 | [ ! -z $VM ] && apt install spice-vdagent xserver-xorg-video-qxl -y | ||
| 44 | |||
| 45 | # basic configuration of ufw | ||
| 46 | ufw enable | ||
| 47 | ufw default deny incoming | ||
| 48 | ufw default allow outgoing | ||
| 49 | ufw reload | ||
| 50 | |||
| 51 | # add user to sudo group | ||
| 52 | user=$(cat /etc/passwd | grep 1000 | cut -d ':' -f 1) | ||
| 53 | usermod -aG sudo $user | ||
| 54 | |||
| 55 | # Change to user | ||
| 56 | su -l $user | ||
| 57 | |||
| 58 | # lock root account | ||
| 59 | sudo passwd -l root | ||
| 60 | |||
| 61 | # Get and deploy dotfiles | ||
| 62 | echo "backing up current home directory to ~/home_backup" | ||
| 63 | rsync -av $HOME/ $HOME/home_backup/ | ||
| 64 | cd $HOME | ||
| 65 | git clone https://git.chudnick.com/dotfiles | ||
| 66 | rsync --exclude .git/ --exclude LICENSE -av $HOME/dotfiles/ $HOME | ||
| 67 | sudo chsh -s $(which zsh) $USER | ||
| 68 | |||
| 69 | # DWM | ||
| 70 | if [ ! -z $DWM ]; then | ||
| 71 | mkdir -p $HOME/.local/src/ | ||
| 72 | cd $HOME/.local/src/ | ||
| 73 | sudo apt install libx11-dev libx11-xcb-dev libxcb-res0-dev libxft-dev libxinerama-dev -y | ||
| 74 | git clone https://git.chudnick.com/dwm | ||
| 75 | cd dwm | ||
| 76 | sudo make install | ||
| 77 | cd $HOME | ||
| 78 | fi | ||
| 79 | |||
| 80 | # DWMBLOCKS | ||
| 81 | if [ ! -z $DWMBLOCKS ]; then | ||
| 82 | mkdir -p $HOME/.local/src/ | ||
| 83 | cd $HOME/.local/src/ | ||
| 84 | sudo apt install libx11-dev -y | ||
| 85 | git clone https://git.chudnick.com/dwmblocks | ||
| 86 | cd dwmblocks | ||
| 87 | sudo make install | ||
| 88 | cd $HOME | ||
| 89 | fi | ||
| 90 | |||
| 91 | # SSH | ||
| 92 | [ ! -z $CONFIG_SSH ] && ssh-keygen | ||
| 93 | |||
| 94 | # SSH SERVER | ||
| 95 | [ ! -z $CONFIG_SSH_SERVER ] && sudo apt install openssh-server -y && sudo ufw allow ssh | ||
| 96 | |||
| 97 | # GPG | ||
| 98 | [ ! -z $CONFIG_GPG ] && gpg --full-gen-key | ||
| 99 | |||
| 100 | exit | ||
| 101 | |||
| 102 | echo -e "\n\n" | ||
| 103 | echo "Next: If you chose to install dwm, logout and log back in." | ||
| 104 | echo "If you did not install dwm, you will need to install a desktop environment or window manager and then do the above" | ||
| 105 | echo -e "\n\n" | ||
| diff --git a/init.sh b/init.sh deleted file mode 100755 index 50fd850..0000000 --- a/init.sh +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # Script 1 - run this as root after installation | ||
| 4 | |||
| 5 | # source configuration file | ||
| 6 | source deploy.conf | ||
| 7 | |||
| 8 | # Change apt sources to use https | ||
| 9 | sed -i "s/http:/https:/" /etc/apt/sources.list | ||
| 10 | |||
| 11 | [ ! -z $BACKPORTS ] && echo "deb https://deb.debian.org/debian/ bullseye-backports main" >> \ | ||
| 12 | /etc/apt/sources.list | ||
| 13 | |||
| 14 | # Update packages | ||
| 15 | apt update -y && apt upgrade -y | ||
| 16 | |||
| 17 | # Temporarily add contrib and non-free repos for necessary proprietary firmware and microcode | ||
| 18 | sed -i "s/main/main contrib non-free/" /etc/apt/sources.list | ||
| 19 | apt update -y | ||
| 20 | |||
| 21 | [ ! -z $AMDCPU ] && apt install amd64-microcode -y | ||
| 22 | [ ! -z $AMDGPU ] && apt install firmware-amd-graphics -y | ||
| 23 | [ ! -z $INTELCPU ] && apt install intel-microcode -y | ||
| 24 | |||
| 25 | # Remove contrib and non-free repos | ||
| 26 | sed -i "s/main contrib non-free/main/" /etc/apt/sources.list | ||
| 27 | apt update -y | ||
| 28 | |||
| 29 | # Install packages | ||
| 30 | apt install $(cat packages.base) -y | ||
| 31 | apt install $(cat packages.custom) -y | ||
| 32 | |||
| 33 | # For virtual machines | ||
| 34 | |||
| 35 | [ ! -z $VM ] && apt install spice-vdagent xserver-xorg-video-qxl -y | ||
| 36 | |||
| 37 | # basic configuration of ufw | ||
| 38 | ufw enable | ||
| 39 | ufw default deny incoming | ||
| 40 | ufw default allow outgoing | ||
| 41 | ufw reload | ||
| 42 | |||
| 43 | # add user to sudo group | ||
| 44 | user=$(cat /etc/passwd | grep 1000 | cut -d ':' -f 1) | ||
| 45 | usermod -aG sudo $user | ||
| 46 | |||
| 47 | cp user.sh deploy.conf /home/$user/ | ||
| 48 | |||
| 49 | echo -e "\n\n" | ||
| 50 | echo "Next: run 'logout' and then log in as the standard user created during the installation" | ||
| 51 | echo "After logging in run: './ user.sh'" | ||
| 52 | echo -e "\n\n" | ||
| diff --git a/user.sh b/user.sh deleted file mode 100755 index 105610a..0000000 --- a/user.sh +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # Script 2 - run as standard user | ||
| 4 | |||
| 5 | # source configuration file | ||
| 6 | source deploy.conf | ||
| 7 | |||
| 8 | # Disable root password | ||
| 9 | sudo passwd -l root | ||
| 10 | |||
| 11 | # Get and deploy dotfiles | ||
| 12 | echo "backing up current home directory to ~/home_backup" | ||
| 13 | rsync -av $HOME/ $HOME/home_backup/ | ||
| 14 | cd $HOME | ||
| 15 | git clone https://git.chudnick.com/dotfiles | ||
| 16 | rsync --exclude .git/ --exclude LICENSE -av $HOME/dotfiles/ $HOME | ||
| 17 | chsh -s $(which zsh) $USER | ||
| 18 | |||
| 19 | # DWM | ||
| 20 | if [ ! -z $DWM ]; then | ||
| 21 | mkdir -p $HOME/.local/src/ | ||
| 22 | cd $HOME/.local/src/ | ||
| 23 | sudo apt install libx11-dev libx11-xcb-dev libxcb-res0-dev libxft-dev libxinerama-dev -y | ||
| 24 | git clone https://git.chudnick.com/dwm | ||
| 25 | cd dwm | ||
| 26 | sudo make install | ||
| 27 | cd $HOME | ||
| 28 | fi | ||
| 29 | |||
| 30 | # DWMBLOCKS | ||
| 31 | if [ ! -z $DWMBLOCKS ]; then | ||
| 32 | mkdir -p $HOME/.local/src/ | ||
| 33 | cd $HOME/.local/src/ | ||
| 34 | sudo apt install libx11-dev -y | ||
| 35 | git clone https://git.chudnick.com/dwmblocks | ||
| 36 | cd dwmblocks | ||
| 37 | sudo make install | ||
| 38 | cd $HOME | ||
| 39 | fi | ||
| 40 | |||
| 41 | # SSH | ||
| 42 | [ ! -z $CONFIG_SSH ] && ssh-keygen | ||
| 43 | |||
| 44 | # SSH SERVER | ||
| 45 | [ ! -z $CONFIG_SSH_SERVER ] && sudo apt install openssh-server -y && sudo ufw allow ssh | ||
| 46 | |||
| 47 | # GPG | ||
| 48 | [ ! -z $CONFIG_GPG ] && gpg --full-gen-key | ||
| 49 | |||
| 50 | echo -e "\n\n" | ||
| 51 | echo "Next: If you chose to install dwm, logout and log back in." | ||
| 52 | echo "If you did not install dwm, you will need to install a desktop environment or window manager and then do the above" | ||
| 53 | echo -e "\n\n" | ||
