summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2021-12-26 16:23:54 -0500
committerSam Chudnick <sam@chudnick.com>2021-12-26 16:23:54 -0500
commit89b4e6601fd71f151bf8076c41d1e88b42090cae (patch)
treeee48c17191881cf79887eb9c2a6330924cc24672
parentf585930413fd3a8b0beede193f42fa5f8eab5a00 (diff)
Break deployment script into two separate scripts - run intended to run as root and the other as the standard user
-rwxr-xr-xinit.sh (renamed from install.sh)46
-rwxr-xr-xuser.sh48
2 files changed, 53 insertions, 41 deletions
diff --git a/install.sh b/init.sh
index 03d93ad..cf69dea 100755
--- a/install.sh
+++ b/init.sh
@@ -1,5 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2 2
3# Script 1 - run this as root after installation
4
3# source configuration file 5# source configuration file
4source deploy.conf 6source deploy.conf
5 7
@@ -43,45 +45,7 @@ ufw reload
43user=$(cat /etc/passwd | grep 1000 | cut -d ':' -f 1) 45user=$(cat /etc/passwd | grep 1000 | cut -d ':' -f 1)
44usermod -aG sudo $user 46usermod -aG sudo $user
45 47
46# Switch to standard user and disable root password 48cp user.sh deploy.conf /home/$USER/
47su $user
48passwd -l root
49
50# Get and deploy dotfiles
51echo "backing up current home directory to ~/home_backup"
52rsync -av $HOME/ $HOME/home_backup/
53cd $HOME
54git clone https://git.chudnick.com/dotfiles
55rsync --exclude .git/ --exclude LICENSE -av $HOME/dotfiles/ $HOME
56chsh -s $(which zsh) $USER
57
58# DWM
59if [ ! -z $DWM ]; then
60 mkdir -p $HOME/.local/src/
61 cd $HOME/.local/src/
62 sudo apt install libx11-dev libx11-xcb-dev libxcb-res0-dev libxft-dev libxinerama-dev -y
63 git clone https://git.chudnick.com/dwm
64 cd dwm
65 sudo make install
66 cd $HOME
67fi
68
69# DWMBLOCKS
70if [ ! -z $DWMBLOCKS ]; then
71 mkdir -p $HOME/.local/src/
72 cd $HOME/.local/src/
73 sudo apt install libx11-dev -y
74 git clone https://git.chudnick.com/dwmblocks
75 cd dwmblocks
76 sudo make install
77 cd $HOME
78fi
79
80# SSH
81[ ! -z $CONFIG_SSH ] && ssh-keygen
82
83# SSH SERVER
84[ ! -z $CONFIG_SSH_SERVER ] && sudo apt install openssh-server -y && sudo ufw allow ssh
85 49
86# GPG 50echo "Next: run 'logout' and then log in as the standard user created during the installation"
87[ ! -z $CONFIG_GPG ] && gpg --full-gen-key 51echo "After loggin in run: './ user.sh'"
diff --git a/user.sh b/user.sh
new file mode 100755
index 0000000..3843b04
--- /dev/null
+++ b/user.sh
@@ -0,0 +1,48 @@
1#!/bin/bash
2
3# Script 2 - run as standard user
4
5# source configuration file
6source deploy.conf
7
8# Disable root password
9passwd -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