31 lines
1.1 KiB
Bash
31 lines
1.1 KiB
Bash
#!/bin/dash
|
|
|
|
# Main Data Path : /var/lib/gitea
|
|
# Data path : /var/lib/gitea/data
|
|
# DB path : /var/lib/gitea/db/gitea.db
|
|
# Git path : /var/lib/gitea/git
|
|
# GIT LFS : /var/lib/gitea/data/lfs
|
|
|
|
IPV4=$(getent hosts "$(hostname)" | awk '{print $1}')
|
|
|
|
apk add gitea
|
|
|
|
cd /etc/gitea || exit
|
|
gitea cert --host "${IPV4}"
|
|
chown gitea:www-data cert.pem key.pem
|
|
|
|
sed -i '/\[server\]/a KEY_FILE = /etc/gitea/key.pem' /etc/gitea/app.ini
|
|
sed -i '/\[server\]/a CERT_FILE = /etc/gitea/cert.pem' /etc/gitea/app.ini
|
|
sed -i '/\[server\]/a HTTP_PORT = 443' /etc/gitea/app.ini
|
|
sed -i '/\[server\]/a PROTOCOL = https' /etc/gitea/app.ini
|
|
|
|
rc-update add gitea
|
|
service gitea start
|
|
|
|
if [ -f "/etc/iptables/rules-save" ]; then
|
|
sed -i '/^-A INPUT -i lo -j ACCEPT.*/a -A INPUT -p tcp -m tcp --dport 443 -m state --state NEW -j ACCEPT' /etc/iptables/rules-save
|
|
sed -i '/^-A INPUT -i lo -j ACCEPT.*/a -A INPUT -p udp -m udp --dport 443 -m state --state NEW -j ACCEPT' /etc/iptables/rules-save
|
|
sed -i '/^-A INPUT -i lo -j ACCEPT.*/a # GITEA' /etc/iptables/rules-save
|
|
iptables-restore /etc/iptables/rules-save
|
|
fi
|