From 7ccb83dfce98577765e3099cb59856aeee2d63ed Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 25 Feb 2021 22:02:27 +0100 Subject: [PATCH] [ci skip] Add a work-in-progress bash-completion shell script. --- CMakeLists.txt | 2 ++ scripts/bash-completion.sh | 1 + scripts/postinst.sh | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 scripts/bash-completion.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 4819a98..b8a5ccd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ add_executable(ybcon src/main.cpp resources/Yerbacon.rc src/parser/MainParse.cpp # lpkg = linux package, wpkg = windows package if (UNIX AND NOT MINGW) + include(GNUInstallDirs) set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_lpkg") set(CPACK_SYSTEM_NAME "Linux-${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}") @@ -54,6 +55,7 @@ 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/bash-completion.sh DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon.sh PERMISSIONS OWNER_WRITE diff --git a/scripts/bash-completion.sh b/scripts/bash-completion.sh new file mode 100644 index 0000000..ee4ecd9 --- /dev/null +++ b/scripts/bash-completion.sh @@ -0,0 +1 @@ +# Bash autocomplete script for yerbacon diff --git a/scripts/postinst.sh b/scripts/postinst.sh index 310447e..32e7c15 100644 --- a/scripts/postinst.sh +++ b/scripts/postinst.sh @@ -1,3 +1,10 @@ -#!/usr/bin/sh +#!/bin/sh + +# Post install ybcon script ln -sf /opt/bin/ybcon.sh /usr/bin/ybcon + +bashcompleteLoc="/etc/bash_completion.d" +if [ -d $bashcompleteLoc ]; then + ln -sf /opt/etc/ybcon.d/bash-completion.sh "$bashcompleteLoc/ybcon.sh" +fi \ No newline at end of file