mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-05-06 08:46:35 +00:00
44 lines
1.0 KiB
Bash
44 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
# title: Serviceman
|
|
# homepage: https://git.rootprojects.org/root/serviceman
|
|
# tagline: cross-platform service management for Linux, Mac, and Windows
|
|
# description: |
|
|
# Works with
|
|
# - Launchd (macOS)
|
|
# - Systemd (Linux)
|
|
# - Windows Registry
|
|
# examples: |
|
|
# ```bash
|
|
# serviceman add --name my-service ./serve.js --port 3000
|
|
# ```
|
|
|
|
set -e
|
|
set -u
|
|
|
|
# Get arch envs, etc
|
|
my_url="https://rootprojects.org/serviceman/dist/$(uname -s)/$(uname -m)/serviceman"
|
|
curl -fL "$my_url" -o serviceman
|
|
echo ""
|
|
# Make executable
|
|
chmod +x ./serviceman
|
|
# Move to ~/.local/bin
|
|
mkdir -p ~/.local/bin
|
|
mv ./serviceman ~/.local/bin
|
|
|
|
# Test if in PATH
|
|
set +e
|
|
my_serviceman=$(command -v serviceman)
|
|
set -e
|
|
if [ -n "$my_serviceman" ]; then
|
|
if [ "$my_serviceman" != "$HOME/.local/bin/serviceman" ]; then
|
|
echo "a serviceman installation (which make take precedence) exists at:"
|
|
echo " $my_serviceman"
|
|
echo ""
|
|
fi
|
|
fi
|
|
|
|
# add to ~/.local/bin to PATH, just in case
|
|
pathman add ~/.local/bin # > /dev/null 2> /dev/null
|
|
# TODO inform user to add to path, apart from pathman?
|