summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2022-02-12 17:44:49 -0500
committerSam Chudnick <sam@chudnick.com>2022-02-12 17:44:49 -0500
commitafdbc74b5aee3f9c7873e0c5397487f4f52afdfa (patch)
tree6de72a8c57aca849ccbb61da057d6fc81c207723
parent2e98e5cc4d4537a713cac2861abdd60bcda64675 (diff)
Combine init.sh and user.sh into deploy.shHEADmaster
-rw-r--r--deploy.conf16
-rwxr-xr-xdeploy.sh105
-rwxr-xr-xinit.sh52
-rwxr-xr-xuser.sh53
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"
10DWM=1
11DWMBLOCKS=1
12#CONFIG_SSH=1
13#CONFIG_SSH_SERVER=1
14#CONFIG_GPG=1
15
16# Change apt sources to use https
17sed -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
23apt update -y && apt upgrade -y
24
25# Temporarily add contrib and non-free repos for necessary proprietary firmware and microcode
26sed -i "s/main/main contrib non-free/" /etc/apt/sources.list
27apt 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
34sed -i "s/main contrib non-free/main/" /etc/apt/sources.list
35apt update -y
36
37# Install packages
38apt install $(cat packages.base) -y
39apt 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
46ufw enable
47ufw default deny incoming
48ufw default allow outgoing
49ufw reload
50
51# add user to sudo group
52user=$(cat /etc/passwd | grep 1000 | cut -d ':' -f 1)
53usermod -aG sudo $user
54
55# Change to user
56su -l $user
57
58# lock root account
59sudo passwd -l root
60
61# Get and deploy dotfiles
62echo "backing up current home directory to ~/home_backup"
63rsync -av $HOME/ $HOME/home_backup/
64cd $HOME
65git clone https://git.chudnick.com/dotfiles
66rsync --exclude .git/ --exclude LICENSE -av $HOME/dotfiles/ $HOME
67sudo chsh -s $(which zsh) $USER
68
69# DWM
70if [ ! -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
78fi
79
80# DWMBLOCKS
81if [ ! -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
89fi
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
100exit
101
102echo -e "\n\n"
103echo "Next: If you chose to install dwm, logout and log back in."
104echo "If you did not install dwm, you will need to install a desktop environment or window manager and then do the above"
105echo -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
6source deploy.conf
7
8# Change apt sources to use https
9sed -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
15apt update -y && apt upgrade -y
16
17# Temporarily add contrib and non-free repos for necessary proprietary firmware and microcode
18sed -i "s/main/main contrib non-free/" /etc/apt/sources.list
19apt 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
26sed -i "s/main contrib non-free/main/" /etc/apt/sources.list
27apt update -y
28
29# Install packages
30apt install $(cat packages.base) -y
31apt 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
38ufw enable
39ufw default deny incoming
40ufw default allow outgoing
41ufw reload
42
43# add user to sudo group
44user=$(cat /etc/passwd | grep 1000 | cut -d ':' -f 1)
45usermod -aG sudo $user
46
47cp user.sh deploy.conf /home/$user/
48
49echo -e "\n\n"
50echo "Next: run 'logout' and then log in as the standard user created during the installation"
51echo "After logging in run: './ user.sh'"
52echo -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
6source deploy.conf
7
8# Disable root password
9sudo passwd -l root
10
11# Get and deploy dotfiles
12echo "backing up current home directory to ~/home_backup"
13rsync -av $HOME/ $HOME/home_backup/
14cd $HOME
15git clone https://git.chudnick.com/dotfiles
16rsync --exclude .git/ --exclude LICENSE -av $HOME/dotfiles/ $HOME
17chsh -s $(which zsh) $USER
18
19# DWM
20if [ ! -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
28fi
29
30# DWMBLOCKS
31if [ ! -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
39fi
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
50echo -e "\n\n"
51echo "Next: If you chose to install dwm, logout and log back in."
52echo "If you did not install dwm, you will need to install a desktop environment or window manager and then do the above"
53echo -e "\n\n"