update (almost) all taglines and descs
[webi-installers/.git] / serviceman / install.sh
1 #!/bin/bash
2
3 # title: Serviceman
4 # homepage: https://git.rootprojects.org/root/serviceman
5 # tagline: |
6 #   Serviceman: cross-platform service management for Linux, Mac, and Windows.
7 # description: |
8 #   Serviceman is a hassle-free wrapper around your system launcher. It works with `launchctl` (macOS), `systemctl` (Linux), and the Windows Registry to make it easy to start _user_ and _system_ level services, such as webservers, backup scripts, network and system tools, etc.
9 # examples: |
10 #
11 #   Works with anything, including
12 #
13 #   ### Node.js
14 #
15 #   ```bash
16 #   serviceman add --name my-service node ./serve.js --port 3000
17 #   ```
18 #
19 #   ### Golang
20 #
21 #   ```bash
22 #   go build -mod vendor cmd/my-service
23 #   serviceman add ./my-service --port 3000
24 #   ```
25 #
26 #   ### And even bash!
27 #
28 #   ```bash
29 #   serviceman add --name backuper bash ./backup.sh /mnt/data
30 #   ```
31
32 set -e
33 set -u
34
35 # Test if in PATH
36 set +e
37 my_serviceman=$(command -v serviceman)
38 set -e
39 if [ -n "$my_serviceman" ]; then
40         if [ "$my_serviceman" != "$HOME/.local/bin/serviceman" ]; then
41                 echo "a serviceman installation (which make take precedence) exists at:"
42                 echo "    $my_serviceman"
43                 echo ""
44         fi
45 fi
46
47 # Get arch envs, etc
48 webi_download "https://rootprojects.org/serviceman/dist/$(uname -s)/$(uname -m)/serviceman" "$HOME/Downloads/serviceman"
49 chmod +x "$HOME/Downloads/serviceman"
50 mv "$HOME/Downloads/serviceman" "$HOME/.local/bin/"
51
52 # add to ~/.local/bin to PATH, just in case
53 webi_path_add $HOME/.local/bin # > /dev/null 2> /dev/null
54 # TODO inform user to add to path, apart from pathman?