Skip to content

Commit

Permalink
uninstall: Check for existence of systemd unit
Browse files Browse the repository at this point in the history
Don't attempt to disable the systemd unit if it doesn't exist.
  • Loading branch information
weiss committed Sep 22, 2023
1 parent 8317afd commit e0c01b3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/publish-release
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ cat >"$web_root_dir/install" <<-EOF
./\$installer
cd "\$OLDPWD"
EOF
cat >"$web_root_dir/uninstall" <<-'EOF'
cat >"$web_root_dir/uninstall" <<-EOF
#!/bin/sh
set -e
set -u
if [ -e '/run/systemd/system' ]
rel_name='$rel_name'
if [ -e '/run/systemd/system' ] &&
systemctl list-unit-files \$rel_name.service >'/dev/null' 2>&1
then
systemctl --now disable eturnal
rm -f /etc/systemd/system/eturnal.service
systemctl --now disable \$rel_name
rm -f /etc/systemd/system/\$rel_name.service
fi
rm -rf /opt/eturnal
echo 'eturnal has been uninstalled successfully.'
rm -rf "/opt/\$rel_name"
echo "\$rel_name has been uninstalled successfully."
EOF

0 comments on commit e0c01b3

Please sign in to comment.