Yerbacon/scripts/postinst

29 lines
779 B
Bash

#!/bin/sh
set -e
# Post install ybcon script
ybconDir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/ybcon.d"
fishLoc="/usr/share/fish/vendor_completions.d"
bashcompleteLoc="/etc/bash_completion.d"
zshLoc="/etc/zsh_completion.d"
if [ -d $bashcompleteLoc ]; then
ln -sf "$ybconDir/completions/bash-completion.sh" "$bashcompleteLoc/ybcon.sh"
fi
if [ -f "/usr/bin/fish" ]; then
if [ ! -d $fishLoc ]; then
mkdir "$fishLoc"
fi
ln -sf "$ybconDir/completions/fish-completion.fish" "$fishLoc/ybcon.fish"
fi
zshBin="/usr/bin/zsh"
if [ -f $zshBin ]; then
if ! [ -d $zshLoc ]; then
zshLoc="/usr/share/zsh/vendor-completions"
fi
if [ -d $zshLoc ]; then
ln -sf "$ybconDir/completions/zsh-completion.zsh" "$zshLoc/_ybcon"
rm -f /home/*/.zcompdump*
fi
fi