Files
ntfy-freebsd-server/install_ntfy_server.sh
2025-05-31 21:03:25 -05:00

47 lines
1005 B
Bash
Executable File

#!/bin/sh
ntfy_version=2.11.0
CGO_ENABLED=1
# Grab Release tarball
fetch https://github.com/binwiederhier/ntfy/archive/refs/tags/v${ntfy_version}.tar.gz
# Extract Release source code
tar zxvf v${ntfy_version}.tar.gz
# Change to build directory
cd ntfy-${ntfy_version}
# Build
make cli-deps-static-sites
make web
make web-deps
make web-build
go build
# Copy binary to install directory
cp ntfy /usr/local/bin/
# Copy server & client configs
mkdir /usr/local/etc/ntfy
cp server/server.yml client/client.yml /usr/local/etc/ntfy/
# Change back to root of install
cd ..
# Make executable & Copy startup scripts
chmod +x rc.d/ntfy*
cp rc.d/ntfy rc.d/ntfy-client /usr/local/etc/rc.d/
# Create ntfy user
pw user add -n ntfy -c 'ntfy user' -d /var/empty -s /usr/sbin/nologin
# Create directories for attachments, db, and pid file
mkdir -p /var/run/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
chown ntfy /var/run/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
# Setup instructions
cat postinstall