-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhostinit.sh
More file actions
75 lines (64 loc) · 1.89 KB
/
hostinit.sh
File metadata and controls
75 lines (64 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#exec with sudo in ~/
#dev'd on ubuntu 20.04
#apt update
apt update
# add line nums to nano cfg
echo "set linenumbers" >> ~/.nanorc
#install things
things="zsh zsh-syntax-highlighting zsh-autosuggestions openssh-server"
read -p "install figlet and lolcat?: " yn
if [ "$yn" == "y" ];
then
things="$things figlet lolcat"
motd=y
fi
read -p "install tree, curl, net-tools, & traceroute?: " yn
if [ "$yn" == "y" ];
then
things="$things curl net-tools tree traceroute"
fi
apt install -y $things
read -p "run apt upgrade?: " yn
if [ "$yn" == "y" ];
then
apt upgrade
fi
#change shell to zsh
#usermod -s /usr/bin/zsh $USER
chsh -s $(which zsh) $SUDO_USER
if [ "$motd" == "y" ];
then
#pull x bit from default motd scripts
chmod -R -x /etc/update-motd.d/*
#change motd target from motd.dynamic to motd
sed -i -e 's/motd.dynamic/motd/g' /etc/pam.d/login
#comment out noupdate
sed -i -e 's/session optional pam_motd.so noupdate/#session optional pam_motd.so noupdate/g' /etc/pam.d/login
#get motd file
echo "downloading motd..."
wget -q https://raw.githubusercontent.com/p27182/linux/main/00-motd
#add x bit and move to the spot...
chmod +x 00-motd && mv 00-motd /etc/update-motd.d/00-motd
fi
read -p "disable IPv6?: " yn
if [ "$yn" == "y" ];
then
# create disable ipv6 conf file
echo "net.ipv6.conf.all.disable_ipv6=1" > /etc/sysctl.d/99-disable-ipv6.conf
echo "net.ipv6.conf.default.disable_ipv6=1" > /etc/sysctl.d/99-disable-ipv6.conf
echo "net.ipv6.conf.lo.disable_ipv6=1" > /etc/sysctl.d/99-disable-ipv6.conf
if ! sysctl --system >/dev/null 2>&1 ;
then
sysctl -p
fi
fi
echo "downloading .zshrc..."
if [ -n "$SUDO_USER" ]; then
orig_user="${SUDO_USER:-$USER}"
sudo -u "$orig_user" wget -q https://raw.githubusercontent.com/p27182/linux/main/.zshrc
sudo -i -u $SUDO_USER
else
wget -q https://raw.githubusercontent.com/p27182/linux/main/.zshrc
su $USER
fi