Skip to content

Commit

Permalink
Support "curl | sudo sh" for (un)installing
Browse files Browse the repository at this point in the history
Create "install" and "uninstall" scripts for slightly easier
(un)installation of the binary release.  This simplifies the
documentation a little.
  • Loading branch information
weiss committed Sep 18, 2023
1 parent 1dacadb commit d1f6bf5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
13 changes: 4 additions & 9 deletions doc/overview.edoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,18 @@ file shipped with eturnal's <a
href="https://eturnal.net/download/eturnal-1.11.1.tar.gz">source code
archive</a>.

The binary release is installed using the following commands (on AArch64
systems, `x64' must be replaced with `arm64'):
The binary release is installed using the following command line:

```
curl -O https://eturnal.net/eturnal-1.11.1-linux-x64.run
chmod +x eturnal-1.11.1-linux-x64.run
sudo ./eturnal-1.11.1-linux-x64.run
curl -fsS https://eturnal.net/install | sudo sh
'''

The installer extracts the release archive into `/opt/eturnal' and creates a
system user called `eturnal'. An example configuration is installed as
`/etc/eturnal.yml' if that file doesn't exist yet. On systemd-managed systems,
a service unit is created and eturnal is started.

If the above commands were used to upgrade eturnal from an earlier version, the
If the above command was used to upgrade eturnal from an earlier version, the
service must be restarted afterwards. On systemd-managed systems:

```
Expand All @@ -82,9 +79,7 @@ For uninstalling eturnal and removing the configuration, run the following
commands:

```
sudo systemctl --now disable eturnal
sudo rm -rf /opt/eturnal
sudo rm /etc/systemd/system/eturnal.service
curl -fsS https://eturnal.net/uninstall | sudo sh
sudo rm /etc/eturnal.yml
'''

Expand Down
52 changes: 52 additions & 0 deletions tools/publish-release
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,55 @@ do
done
createrepo_c "$rpm_repo_dir"
gpg --detach-sign --armor "$rpm_repo_dir/repodata/repomd.xml"

cat >"$web_root_dir/install" <<-EOF
#!/bin/sh
set -e
set -u
rel_name='$rel_name'
rel_vsn='$rel_vsn'
os='linux'
platform="\$(uname -s)/\$(uname -m)"
domain="\$rel_name.net"
tmp_dir=\$(mktemp -d "\$rel_name.XXXXXX")
trap 'rm -rf "\$tmp_dir"' INT TERM EXIT
unsupported()
{
echo >&2 "No \$rel_name binaries available for \$1 systems."
echo >&2
echo >&2 "For building \$rel_name from source, see:"
echo >&2
echo >&2 "https://\$domain/documentation/code/install.html"
exit 1
}
case \$platform in
Linux/aarch64) arch='arm64' ;;
Linux/x86_64) arch='x64' ;;
*) unsupported "\$platform" ;;
esac
if ! ldd --version 2>'/dev/null' | grep -qiE '(GNU libc|GLIBC)'
then unsupported 'non-glibc'
fi
installer="\$rel_name-\$rel_vsn-\$os-\$arch.run"
url="https://\$domain/\$installer"
cd "\$tmp_dir"
if type curl >'/dev/null'
then curl -fsSLO "\$url"
else wget --quiet "\$url"
fi
chmod +x "\$installer"
./\$installer
cd "\$OLDPWD"
EOF
cat >"$web_root_dir/uninstall" <<-'EOF'
#!/bin/sh
set -e
set -u
if [ -e '/run/systemd/system' ]
then
systemctl --now disable eturnal
rm -f /etc/systemd/system/eturnal.service
fi
rm -rf /opt/eturnal
echo 'eturnal has been uninstalled successfully.'
EOF

0 comments on commit d1f6bf5

Please sign in to comment.