Commit 9565476e authored by Simon Schürg's avatar Simon Schürg 🚀
Browse files

feat(build): Add uninstall script and improve install from source script

parent 6c7bdedd
......@@ -22,18 +22,29 @@ __base="$(basename "${__file}" .sh)"
# cd in the project root
cd "${__dir}/.."
BUILD_DIR=$(mktemp -d)
# Create a temporary build directory
BUILD_DIR=$(mktemp --directory --tmpdir actl.build.XXXXXXXXXX)
# Build the actl binary with output in the temp build dir
go build -o ${BUILD_DIR}/actl actl.go
# Generate docs and shell completions in the build dir
cd ${BUILD_DIR}
./actl docs
sudo cp docs/man/* /usr/share/man/man3
sudo sh -c './actl completion bash > /usr/share/bash-completion/completions/actl'
sudo sh -c './actl completion fish > /usr/share/zsh/site-functions/_actl'
sudo sh -c './actl completion zsh > /usr/share/fish/completions/actl.fish'
sudo mv ${BUILD_DIR}/actl /usr/local/bin/actl
mkdir ./completions
./actl completion bash > ./completions/actl
./actl completion fish > ./completions/actl.fish
./actl completion zsh > ./completions/_actl
# Copy all install assets to the correct locations
sudo cp -v ${BUILD_DIR}/actl /usr/local/bin/actl
sudo cp -v ${BUILD_DIR}/docs/man/* /usr/share/man/man3
sudo cp -v ${BUILD_DIR}/completions/actl /usr/share/bash-completion/completions/actl
sudo cp -v ${BUILD_DIR}/completions/actl.fish /usr/share/fish/completions/actl.fish
sudo cp -v ${BUILD_DIR}/completions/_actl /usr/share/zsh/site-functions/_actl
# Ensure a system wide /etc/actl/actl.toml exists.
# Copy the example config only if /etc/actl/actl.toml is not already present.
cd "${__dir}/.."
sudo mkdir --verbose -p /etc/actl
# Copy if not exists, do not overwrite
sudo mkdir --verbose --parents /etc/actl
sudo cp --verbose --no-clobber actl.toml /etc/actl/actl.toml
#!/usr/bin/env bash
#
#
# Simon Schürg <simon@schuerg.net>
# Exit on error. Append "|| true" if you expect an error.
set -o errexit
# Exit on error inside any functions or subshells.
set -o errtrace
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
set -o nounset
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
set -o pipefail
# Turn on traces, useful while debugging but commented out by default
# set -o xtrace
# Set magic variables for current file, directory, os, etc.
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename "${__file}" .sh)"
# cd in the project root
cd "${__dir}/.."
echo 'Delete files created by the install_from_source.sh script:'
sudo rm -fv /usr/local/bin/actl
sudo rm -fv /usr/share/man/man3/actl-*
sudo rm -fv /usr/share/bash-completion/completions/actl
sudo rm -fv /usr/share/fish/completions/actl.fish
sudo rm -fv /usr/share/zsh/site-functions/_actl
echo ''
echo 'User data files as config files and cache files will not be deleted by default.'
echo 'But you can do it manually with the following command:'
echo '# sudo rm -rfv /etc/actl ${HOME}/.config/actl ${HOME}/.cache/actl'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment