Matheus Sampaio Queiroga
469d6e2d43
Some checks failed
/ release (push) Blocked by required conditions
/ build (riscv64) (push) Has been cancelled
/ build (arm) (push) Has been cancelled
/ build (386) (push) Has been cancelled
/ build (arm64) (push) Has been cancelled
/ build (amd64) (push) Has been cancelled
Signed-off-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
32 lines
1008 B
Bash
Executable File
32 lines
1008 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# https://docs.gitea.io/en-us/install-from-binary/
|
|
USERNAME=git
|
|
GROUP=git
|
|
|
|
if getent passwd gitea >/dev/null 2>&1; then
|
|
USERNAME=gitea
|
|
GROUP=gitea
|
|
elif ! getent passwd $USERNAME >/dev/null 2>&1;then
|
|
echo "Creating $USERNAME user"
|
|
adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /var/lib/gitea/home $USERNAME
|
|
fi
|
|
|
|
if ![[ -f "/etc/gitea/app.ini" ]]; then
|
|
echo "Creating and set permissions to /etc/gitea"
|
|
mkdir /etc/gitea || echo "Folder ared exit, continue"
|
|
chown -R root:$GROUP /etc/gitea
|
|
chmod 770 /etc/gitea
|
|
cp -v /etc/gitea/example.ini /etc/gitea/app.ini
|
|
chmod 640 /etc/gitea/app.ini
|
|
fi
|
|
|
|
# Set gitea folder permisions
|
|
chown $USERNAME:$GROUP /var/lib/gitea
|
|
|
|
# Start service
|
|
if command -v systemctl &> /dev/null; then
|
|
systemctl daemon-reload || echo "Systemctl not loaded"
|
|
systemctl enable gitea.service || echo "Gitea service is ared enabled"
|
|
systemctl restart gitea.service || echo "Systemctl not loaded"
|
|
fi
|