add a (un)install script to package

This commit is contained in:
Abraham Toriz 2022-11-26 18:52:41 -06:00
parent c9f5782f59
commit d56ef65f73
No known key found for this signature in database
GPG Key ID: D5B4A746DB5DD42A
4 changed files with 37 additions and 9 deletions

View File

@ -144,7 +144,7 @@ for and whose design I took as reference, keeping compatibility when possible.
* fix the pipeline because it's broken. The last release and its artifacts are
wrong.
* add ain install/uninstall script to the any-linux package.
* add an install/uninstall script to the any-linux package.
* finish the `summary` formatter.
* match formatters by prefix (so there's no need to type all of its name if the
prefix is unambiguous).

View File

@ -16,17 +16,20 @@ cargo test
cargo build --locked --release
# move binary
install -m 755 -D target/release/t build/bin/t
install -Dm755 target/release/t build/bin/t
# move documentation
install -m 644 -D CHANGELOG.md build/share/doc/tiempo/CHANGELOG.md
install -m 644 -D README.md build/share/doc/tiempo/README.md
install -m 644 -D LICENSE build/share/doc/tiempo/LICENSE
install -Dm644 CHANGELOG.md build/share/doc/tiempo/CHANGELOG.md
install -Dm644 README.md build/share/doc/tiempo/README.md
install -Dm644 LICENSE build/share/doc/tiempo/LICENSE
# move man page
install -m 644 -D docs/build/man/tiempo.1.gz build/share/man/man1/tiempo.1.gz
install -Dm644 docs/build/man/tiempo.1.gz build/share/man/man1/tiempo.1.gz
# move completions
install -m 644 -D completions/bash/t build/share/bash-completion/completions/t
install -m 644 -D completions/fish/t.fish build/share/fish/vendor_completions.d/t.fish
install -m 644 -D completions/zsh/_t build/share/zsh/site-functions/_t
install -Dm644 completions/bash/t build/share/bash-completion/completions/t
install -Dm644 completions/fish/t.fish build/share/fish/vendor_completions.d/t.fish
install -Dm644 completions/zsh/_t build/share/zsh/site-functions/_t
# move install scripts
install -Dm755 scripts/install.sh build/install.sh
install -Dm755 scripts/uninstall.sh build/uninstall.sh
# compress the tar file
tar -cvzf tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz build/

13
scripts/install.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
__dir=$(dirname $(realpath $0))
prefix=${1:-/usr}
install -Dm755 $__dir/bin/t $prefix/bin/t
install -Dm644 $__dir/share/fish/vendor_completions.d/t.fish $prefix/share/fish/vendor_completions.d/t.fish
install -Dm644 $__dir/share/doc/tiempo/README.md $prefix/share/doc/tiempo/README.md
install -Dm644 $__dir/share/doc/tiempo/CHANGELOG.md $prefix/share/doc/tiempo/CHANGELOG.md
install -Dm644 $__dir/share/doc/tiempo/LICENSE $prefix/share/doc/tiempo/LICENSE
install -Dm644 $__dir/share/bash-completion/completions/t $prefix/share/bash-completion/completions/t
install -Dm644 $__dir/share/zsh/site-functions/_t $prefix/share/zsh/site-functions/_t
install -Dm644 $__dir/share/man/man1/tiempo.1.gz $prefix/share/man/man1/tiempo.1.gz

12
scripts/uninstall.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
rm -f /usr/bin/t
prefix=${1:-/usr}
rm -f $prefix/bin/t
rm -rf $prefix/share/doc/tiempo/
rm -f $prefix/share/fish/vendor_completions.d/t.fish
rm -f $prefix/share/bash-completion/completions/t
rm -f $prefix/share/zsh/site-functions/_t
rm -f $prefix/share/man/man1/tiempo.1.gz