Fix Makefile

This commit is contained in:
eyedeekay
2025-05-21 11:44:11 -04:00
parent efab5ff9b1
commit e50b8c82e4

132
Makefile
View File

@ -10,96 +10,96 @@ DATA_PATH = /var/lib/gitea
all: help all: help
help: help:
@echo "GitLooseLeaf - Modified Gitea with multi-protocol support" @echo "GitLooseLeaf - Modified Gitea with multi-protocol support"
@echo "" @echo ""
@echo "Usage:" @echo "Usage:"
@echo " make download - Download the latest gitea binary" @echo " make download - Download the latest gitea binary"
@echo " make setup-user - Create git user and required directories" @echo " make setup-user - Create git user and required directories"
@echo " make install-binary - Install Gitea binary" @echo " make install-binary - Install Gitea binary"
@echo " make install-systemd - Install systemd service files" @echo " make install-systemd - Install systemd service files"
@echo " make enable - Enable and start Gitea service" @echo " make enable - Enable and start Gitea service"
@echo " make disable - Disable and stop Gitea service" @echo " make disable - Disable and stop Gitea service"
@echo " make install - Complete installation (all above steps)" @echo " make install - Complete installation (all above steps)"
@echo " make uninstall - Remove Gitea" @echo " make uninstall - Remove Gitea"
@echo " make clean - Clean up downloaded files" @echo " make clean - Clean up downloaded files"
@echo "" @echo ""
@echo "Note: Many commands require root privileges (use sudo)" @echo "Note: Many commands require root privileges (use sudo)"
# Download latest Gitea binary # Download latest Gitea binary
download: download:
@echo "Downloading latest Gitea binary..." @echo "Downloading latest Gitea binary..."
mkdir -p downloads mkdir -p downloads
GITEA_URL="https://github.com/go-i2p/go-gitlooseleaf/releases/download/nightly/gitea-Linux"; \ GITEA_URL="https://github.com/go-i2p/go-gitlooseleaf/releases/download/nightly/gitea-Linux"; \
wget -O downloads/gitea "$$GITEA_URL" || curl -L -o downloads/gitea "$$GITEA_URL" wget -O downloads/gitea "$$GITEA_URL" || curl -L -o downloads/gitea "$$GITEA_URL"
chmod +x downloads/gitea chmod +x downloads/gitea
# Setup git user and directories # Setup git user and directories
setup-user: setup-user:
@echo "Setting up git user and directories..." @echo "Setting up git user and directories..."
id -u git &>/dev/null || adduser \ id -u git &>/dev/null || adduser \
--system \ --system \
--shell /bin/bash \ --shell /bin/bash \
--gecos 'Git Version Control' \ --gecos 'Git Version Control' \
--group \ --group \
--disabled-password \ --disabled-password \
--home /home/git \ --home /home/git \
git git
mkdir -p $(DATA_PATH)/{custom,data,log} mkdir -p $(DATA_PATH)/{custom,data,log}
mkdir -p $(CONFIG_PATH) mkdir -p $(CONFIG_PATH)
chown -R git:git $(DATA_PATH)/ chown -R git:git $(DATA_PATH)/
chmod -R 750 $(DATA_PATH)/ chmod -R 750 $(DATA_PATH)/
chown root:git $(CONFIG_PATH) chown root:git $(CONFIG_PATH)
chmod 770 $(CONFIG_PATH) chmod 770 $(CONFIG_PATH)
# Install Gitea binary # Install Gitea binary
install-binary: download install-binary: download
@echo "Installing Gitea binary..." @echo "Installing Gitea binary..."
cp downloads/gitea $(BINARY_PATH) cp downloads/gitea $(BINARY_PATH)
chmod +x $(BINARY_PATH) chmod +x $(BINARY_PATH)
setcap CAP_NET_BIND_SERVICE=+eip $(BINARY_PATH) setcap CAP_NET_BIND_SERVICE=+eip $(BINARY_PATH)
# Install systemd service files # Install systemd service files
install-systemd: install-systemd:
@echo "Installing systemd service files..." @echo "Installing systemd service files..."
mkdir -p $(SYSTEMD_PATH)/gitea.service.d mkdir -p $(SYSTEMD_PATH)/gitea.service.d
cp etc/systemd/system/gitea.service $(SYSTEMD_PATH)/ cp etc/systemd/system/gitea.service $(SYSTEMD_PATH)/
cp etc/systemd/system/gitea.service.d/user-config.conf $(SYSTEMD_PATH)/gitea.service.d/ cp etc/systemd/system/gitea.service.d/user-config.conf $(SYSTEMD_PATH)/gitea.service.d/
systemctl daemon-reload systemctl daemon-reload
# Enable and start Gitea service # Enable and start Gitea service
enable: enable:
@echo "Enabling and starting Gitea service..." @echo "Enabling and starting Gitea service..."
systemctl enable gitea.service systemctl enable gitea.service
systemctl start gitea.service systemctl start gitea.service
@echo "Gitea service started successfully!" @echo "Gitea service started successfully!"
@echo "Please configure your email in $(SYSTEMD_PATH)/gitea.service.d/user-config.conf" @echo "Please configure your email in $(SYSTEMD_PATH)/gitea.service.d/user-config.conf"
@echo "Then restart with: systemctl restart gitea.service" @echo "Then restart with: systemctl restart gitea.service"
# Disable and stop Gitea service # Disable and stop Gitea service
disable: disable:
@echo "Disabling and stopping Gitea service..." @echo "Disabling and stopping Gitea service..."
systemctl disable gitea.service systemctl disable gitea.service
systemctl stop gitea.service systemctl stop gitea.service
# Complete installation # Complete installation
install: setup-user install-binary install-systemd enable install: setup-user install-binary install-systemd enable
@echo "Installation complete!" @echo "Installation complete!"
@echo "You can now access Gitea at:" @echo "You can now access Gitea at:"
@echo "- HTTPS: https://$(shell hostname):3000" @echo "- HTTPS: https://$(shell hostname):3000"
@echo "- I2P/Tor: Check logs for actual addresses: journalctl -u gitea" @echo "- I2P/Tor: Check logs for actual addresses: journalctl -u gitea"
# Uninstall Gitea # Uninstall Gitea
uninstall: disable uninstall: disable
@echo "Uninstalling Gitea..." @echo "Uninstalling Gitea..."
rm -f $(BINARY_PATH) rm -f $(BINARY_PATH)
rm -f $(SYSTEMD_PATH)/gitea.service rm -f $(SYSTEMD_PATH)/gitea.service
rm -rf $(SYSTEMD_PATH)/gitea.service.d rm -rf $(SYSTEMD_PATH)/gitea.service.d
systemctl daemon-reload systemctl daemon-reload
@echo "Gitea has been uninstalled." @echo "Gitea has been uninstalled."
@echo "Note: User and data directories were not removed." @echo "Note: User and data directories were not removed."
@echo "To completely remove, delete: $(CONFIG_PATH) and $(DATA_PATH)" @echo "To completely remove, delete: $(CONFIG_PATH) and $(DATA_PATH)"
# Clean up # Clean up
clean: clean:
@echo "Cleaning up..." @echo "Cleaning up..."
rm -rf downloads rm -rf downloads