Add Gitea Actions CI and release workflows and deployment assets
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e7cb8171f
commit
d87c77dc13
12 files changed
+414
No files matched your search
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
# Installs bamboo as a systemd service from the files in this folder.
|
||||
#
|
||||
# sudo ./install.sh install or upgrade (your settings and data are kept)
|
||||
# sudo ./install.sh --start the same, then start (or restart) the service
|
||||
# sudo ./install.sh --uninstall remove the service and binary (keeps the settings and data)
|
||||
#
|
||||
# Files: /usr/local/bin/bamboo, /etc/systemd/system/bamboo.service,
|
||||
# /etc/bamboo/bamboo.env (your settings and secrets), /var/lib/bamboo (data).
|
||||
# Set DESTDIR=/some/dir to stage everything there without touching the system.
|
||||
set -eu
|
||||
NAME=bamboo
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT=${DESTDIR:-}
|
||||
BIN=$ROOT/usr/local/bin/$NAME
|
||||
UNIT=$ROOT/etc/systemd/system/$NAME.service
|
||||
CONF=$ROOT/etc/$NAME
|
||||
ENVFILE=$CONF/$NAME.env
|
||||
DATA=$ROOT/var/lib/$NAME
|
||||
|
||||
say() { printf '%s\n' "$*"; }
|
||||
real() { [ -z "${DESTDIR:-}" ]; } # are we touching the real system?
|
||||
|
||||
if real; then
|
||||
[ "$(id -u)" = 0 ] || { say "Run this as root: sudo $0 $*"; exit 1; }
|
||||
command -v systemctl > /dev/null 2>&1 || { say "systemd wasn't found. Run $NAME directly (see the README) or use Docker."; exit 1; }
|
||||
fi
|
||||
|
||||
if [ "${1:-}" = "--uninstall" ]; then
|
||||
if real; then
|
||||
systemctl disable --now "$NAME" > /dev/null 2>&1 || true
|
||||
fi
|
||||
rm -f "$UNIT" "$BIN"
|
||||
if real; then
|
||||
systemctl daemon-reload || true
|
||||
fi
|
||||
say "Removed $NAME. Left in place: $CONF and $DATA (delete them yourself if you want them gone)."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ -f "$HERE/$NAME" ] || { say "Can't find the $NAME binary next to this script."; exit 1; }
|
||||
|
||||
if real && ! id "$NAME" > /dev/null 2>&1; then
|
||||
useradd --system --home-dir "/var/lib/$NAME" --shell /usr/sbin/nologin "$NAME"
|
||||
say "Created the system user '$NAME'."
|
||||
fi
|
||||
|
||||
mkdir -p "$ROOT/usr/local/bin" "$ROOT/etc/systemd/system" "$CONF" "$DATA"
|
||||
install -m 0755 "$HERE/$NAME" "$BIN.new"
|
||||
mv -f "$BIN.new" "$BIN" # atomic, so upgrading a running service is safe
|
||||
install -m 0644 "$HERE/$NAME.service" "$UNIT"
|
||||
if [ ! -f "$ENVFILE" ]; then
|
||||
install -m 0600 "$HERE/.env.example" "$ENVFILE"
|
||||
say "Created $ENVFILE. Edit it before starting."
|
||||
fi
|
||||
if real; then
|
||||
chown -R "$NAME:$NAME" "$DATA"
|
||||
fi
|
||||
|
||||
if real; then
|
||||
systemctl daemon-reload
|
||||
systemctl enable "$NAME" > /dev/null 2>&1
|
||||
if [ "${1:-}" = "--start" ] || systemctl is-active --quiet "$NAME"; then
|
||||
systemctl restart "$NAME"
|
||||
say "$NAME is running."
|
||||
fi
|
||||
fi
|
||||
|
||||
say "Installed $("$BIN" -version 2> /dev/null || echo "$NAME")."
|
||||
say "Next:"
|
||||
say " 1. edit $ENVFILE"
|
||||
say " 2. systemctl start $NAME (or run this again with --start)"
|
||||
say " 3. journalctl -u $NAME -f to watch it"
|
||||
Reference in new issue
Block a user