diff --git a/CMakeLists.txt b/CMakeLists.txt index f24afb3..2893fb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,20 +65,12 @@ if (UNIX AND NOT MINGW) if (NOT DEFINED CPACK_GENERATOR) set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB) endif() - install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon - ${CMAKE_CURRENT_SOURCE_DIR}/scripts/bash-completion.sh - ${CMAKE_CURRENT_SOURCE_DIR}/scripts/fish-completion.fish - ${CMAKE_CURRENT_SOURCE_DIR}/scripts/zsh-completion.zsh + install(PROGRAMS + ${CMAKE_CURRENT_BINARY_DIR}/ybcon DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon - PERMISSIONS - OWNER_WRITE - OWNER_EXECUTE - OWNER_READ - WORLD_READ - WORLD_EXECUTE - DESTINATION bin) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/completions DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d) + install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon + DESTINATION ${CMAKE_INSTALL_BINDIR}) elseif(MINGW OR MSVC) set(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++ ${CMAKE_EXE_LINKER_FLAGS}") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_wpkg") diff --git a/scripts/bash-completion.sh b/scripts/completions/bash-completion.sh similarity index 100% rename from scripts/bash-completion.sh rename to scripts/completions/bash-completion.sh diff --git a/scripts/fish-completion.fish b/scripts/completions/fish-completion.fish similarity index 100% rename from scripts/fish-completion.fish rename to scripts/completions/fish-completion.fish diff --git a/scripts/zsh-completion.zsh b/scripts/completions/zsh-completion.zsh similarity index 100% rename from scripts/zsh-completion.zsh rename to scripts/completions/zsh-completion.zsh diff --git a/scripts/postinst.sh b/scripts/postinst.sh index d34635a..75ece12 100644 --- a/scripts/postinst.sh +++ b/scripts/postinst.sh @@ -3,25 +3,23 @@ # Post install ybcon script ybconDir="/opt/etc/ybcon.d" -ln -sf "$ybconDir/ybcon" "/usr/bin/ybcon" - fishLoc="/usr/share/fish/vendor_completions.d" bashcompleteLoc="/etc/bash_completion.d" zshLoc="/etc/zsh_completion.d" if [ -d $bashcompleteLoc ]; then - ln -sf "$ybconDir/bash-completion.sh" "$bashcompleteLoc/ybcon.sh" + 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/fish-completion.fish" "$fishLoc/ybcon.fish" + ln -sf "$ybconDir/completions/fish-completion.fish" "$fishLoc/ybcon.fish" fi zshBin="/usr/bin/zsh" if [ -f $zshBin ]; then if [ -d $zshLoc ]; then - ln -sf "$ybconDir/zsh-completion.zsh" "$zshLoc/_ybcon" + ln -sf "$ybconDir/completions/zsh-completion.zsh" "$zshLoc/_ybcon" fi fi \ No newline at end of file diff --git a/scripts/ybcon b/scripts/ybcon index 5544b16..6d00c4d 100755 --- a/scripts/ybcon +++ b/scripts/ybcon @@ -5,7 +5,7 @@ EXENAME=ybcon # Default location of the executable -defaultBinLocation=/opt/bin/ybcon +defaultBinLocation=/opt/etc/ybcon.d/ybcon usage() { if [ "$1" = false ]; then echo "Invalid arguments, usage:"; fi