diff options
author | ChacaS0 | 2018-09-13 21:29:36 +0400 |
---|---|---|
committer | ChacaS0 | 2018-09-13 21:29:36 +0400 |
commit | 1240e291126c46c9150ed9619c45e58c0c41d3c4 (patch) | |
tree | 289b141f02a34c3008fc2cc7b14d3755d0181962 | |
parent | 72e97875a6f97e25552ff9948063397de47a61c6 (diff) | |
download | aur-tempest.tar.gz |
:heavy_check_mark: Added .install --> post_remove
:memo: [TODO] Tests
-rw-r--r-- | .install | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.install b/.install new file mode 100644 index 000000000000..3175089967d0 --- /dev/null +++ b/.install @@ -0,0 +1,36 @@ + +# protote at /usr/share/pacman/proto.install +post_remove() { + # remove + # sudo rm -f ${which tempest} + # sudo rm /usr/bin/tempest + + goclean github.com/ChacaS0/tempest +} + +goclean() { + local pkg=$1; shift || return 1 + local ost + local cnt + local scr + + # Clean removes object files from package source directories (ignore error) + go clean -i $pkg &>/dev/null + + # Set local variables + [[ "$(uname -m)" == "x86_64" ]] \ + && ost="$(uname)";ost="${ost,,}_amd64" \ + && cnt="${pkg//[^\/]}" + + # Delete the source directory and compiled package directory(ies) + if (("${#cnt}" == "2")); then + rm -rf "${GOPATH%%:*}/src/${pkg%/*}" + rm -rf "${GOPATH%%:*}/pkg/${ost}/${pkg%/*}" + elif (("${#cnt}" > "2")); then + rm -rf "${GOPATH%%:*}/src/${pkg%/*/*}" + rm -rf "${GOPATH%%:*}/pkg/${ost}/${pkg%/*/*}" + fi + + # Reload the current shell + source ~/.bashrc +} |