-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_system
More file actions
executable file
·59 lines (47 loc) · 1.15 KB
/
setup_system
File metadata and controls
executable file
·59 lines (47 loc) · 1.15 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
#!/bin/bash
set -e
apt install -y make
read -p "hostname [$HOSTNAME]:" input < /dev/tty
input=${input:-$HOSTNAME}
echo $input > /etc/hostname
hostname $input
if [ -z $(docker network ls --format {{.ID}} -f name=hub) ]; then
docker network create --subnet=192.168.168.0/24 hub
fi
ufw disable
echo y | ufw reset
ufw limit ssh
ufw allow http
ufw allow https
ufw limit in on eth0 to any port 3306 proto tcp
ufw allow 3306/tcp
echo y | ufw enable
dpkg-reconfigure tzdata
if [ "$LC_ALL" != "en_US.UTF-8" ]; then
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
cat >> /etc/environment <<EOF
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
EOF
fi
if [ -z $(id -u git 2>/dev/null) ]; then
useradd -r -m -s /bin/bash git
usermod -a -G docker git
fi
if [ ! -f ~/monster.pub ]; then
cat ~/.ssh/authorized_keys | head -n 1 > ~/monster.pub
fi
mv ~/monster.pub ~git/ && chown git ~git/monster.pub
sudo -i -u git << EOF
git clone https://github.com/sitaramc/gitolite
mkdir bin
gitolite/install -to /home/git/bin
bin/gitolite setup -pk monster.pub
git clone https://github.com/sudachen/keepmywork
cd keepmywork
./setup_hooks
cd ..
rm -rf keepmywork
EOF