forked from Ourobotos/hexo-git-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
33 lines (29 loc) · 791 Bytes
/
start.sh
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
#!/bin/sh
# copy all keys to authorized_keys
if [ "$(ls -A /hexo-server/keys/)" ]; then
cd /home/git
for file in /hexo-server/keys/*.pub
do
cat $file >> .ssh/authorized_keys
done
chown -R git:git .ssh
chmod 700 .ssh
chmod -R 600 .ssh/*
fi
# if the empty repo doesn't exists, copy one
if [ ! -d "/hexo-server/repos/hexo.git" ]; then
cp /home/git/hexo.git /hexo-server/repos/hexo.git -r
chmod +x /hexo-server/repos/hexo.git/hooks/post-receive
fi
# give repos file read write and exec ability
if [ "$(ls -A /hexo-server/repos/)" ]; then
cd /hexo-server/repos
chown -R git:git .
chmod -R ug+rwX .
find . -type d -exec chmod g+s '{}' +
cd /hexo-server/html
chown -R git:git .
chmod -R ug+rwX .
find . -type d -exec chmod g+s '{}' +
fi
/usr/sbin/sshd -D