1
0
mirror of https://github.com/smallstep/cli.git synced 2025-09-17 08:42:12 +03:00
Files
step-ca-cli/scripts/postinstall.sh
Omar Aloraini fb2ca6cde7 Add completion command
Fixes #622
2022-02-10 01:26:12 +03:00

40 lines
643 B
Bash

#!/bin/sh
updateAlternatives() {
update-alternatives --install /usr/bin/step step /usr/bin/step-cli 50
}
updateCompletion() {
/usr/bin/step completion bash > /usr/share/bash-completion/completions/step
chmod 644 /usr/share/bash-completion/completions/step
}
cleanInstall() {
updateAlternatives
updateCompletion
}
upgrade() {
updateAlternatives
updateCompletion
}
action="$1"
if [ "$1" = "configure" ] && [ -z "$2" ]; then
action="install"
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
action="upgrade"
fi
case "$action" in
"1" | "install")
cleanInstall
;;
"2" | "upgrade")
upgrade
;;
*)
cleanInstall
;;
esac