Committing updates.
This commit is contained in:
@@ -39,7 +39,7 @@ add_custom_target(
|
||||
auto_increment_version
|
||||
${CMAKE_COMMAND}
|
||||
-D VERSION_FILE=${CMAKE_SOURCE_DIR}/version.h
|
||||
-P ${CMAKE_SOURCE_DIR}/AutoVersion.cmake
|
||||
-P ${CMAKE_MODULE_PATH}/AutoVersion.cmake
|
||||
)
|
||||
|
||||
set(PROJECT_LIB_DIR "src/lib")
|
||||
|
||||
@@ -2,14 +2,19 @@ find_package(Git)
|
||||
|
||||
if (GIT_FOUND)
|
||||
message(STATUS "Found Git")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
message(STATUS "Current Git commit hash: " ${GIT_REVISION})
|
||||
if (EXISTS .git)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
set(GIT_REVISION "e00000")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Current Git commit hash: " ${GIT_REVISION})
|
||||
|
||||
file(READ ${VERSION_FILE} VERSION_TEXT)
|
||||
|
||||
message(STATUS "FILE: ${VERSION_TEXT}")
|
||||
64
deploy
64
deploy
@@ -40,10 +40,12 @@ display_help()
|
||||
display_message "Usage: ./deploy [OPTION]..."
|
||||
display_message "Manage the configure."
|
||||
display_message "Script options:"
|
||||
display_message " --build-dir=<path> Location of build files (default: $BUILD_DIR)."
|
||||
display_message " --release Release builed (default)."
|
||||
display_message " --debug Debug build."
|
||||
display_message " --help Display usage, overriding script execution."
|
||||
display_message " --install Install $PROJECT_NAME (run as root)."
|
||||
display_message " --update Update $PROJECT_NAME (run as root)."
|
||||
display_message " --release Release build (default)."
|
||||
display_message " --debug Debug build."
|
||||
display_message " --build-dir=<path> Location of build files (default: $BUILD_DIR)."
|
||||
display_message ""
|
||||
}
|
||||
|
||||
@@ -57,6 +59,17 @@ display_configuration()
|
||||
display_message "--------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
install_project()
|
||||
{
|
||||
push_directory "$BUILD_DIR"
|
||||
|
||||
display_heading_message "Install: $PROJECT_NAME"
|
||||
|
||||
make install
|
||||
|
||||
pop_directory
|
||||
}
|
||||
|
||||
make_project()
|
||||
{
|
||||
push_directory "$BUILD_DIR"
|
||||
@@ -72,8 +85,10 @@ update_project()
|
||||
{
|
||||
display_heading_message "Update $PROJECT_NAME"
|
||||
|
||||
display_heading_message "stop service $PROJECT_NAME"
|
||||
systemctl stop $PROJECT_NAME.service
|
||||
if [[ -f /usr/bin/systemctl ]]; then
|
||||
display_heading_message "stop service $PROJECT_NAME"
|
||||
systemctl stop $PROJECT_NAME.service
|
||||
fi
|
||||
|
||||
display_heading_message "copy $PROJECT_NAME to /usr/bin"
|
||||
|
||||
@@ -84,12 +99,20 @@ update_project()
|
||||
|
||||
pop_directory
|
||||
|
||||
display_heading_message "clear log files..."
|
||||
rm -rf /etc/$PROJECT_NAME/logs/*.log
|
||||
rm -rf /var/log/$PROJECT_NAME/*.log
|
||||
if [[ -d /etc/$PROJECT_NAME/logs ]]; then
|
||||
display_heading_message "clear log files..."
|
||||
rm -rf /etc/$PROJECT_NAME/logs/*.log
|
||||
fi
|
||||
|
||||
display_heading_message "start service $PROJECT_NAME"
|
||||
systemctl start ${PROJECT_NAME}.service
|
||||
if [[ -d /var/log/$PROJECT_NAME ]]; then
|
||||
display_heading_message "clear log files..."
|
||||
rm -rf /var/log/$PROJECT_NAME/*.log
|
||||
fi
|
||||
|
||||
if [[ -f /usr/bin/systemctl ]]; then
|
||||
display_heading_message "start service $PROJECT_NAME"
|
||||
systemctl start ${PROJECT_NAME}.service
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse command line options that are handled by this script.
|
||||
@@ -99,22 +122,23 @@ for OPTION in "$@"; do
|
||||
# Standard script options.
|
||||
(--help) DISPLAY_HELP="yes";;
|
||||
|
||||
(--install) MAKE_INSTALL="yes";;
|
||||
(--update) BUILD_UPDATE="yes";;
|
||||
|
||||
(--release) BUILD_TYPE="Release";;
|
||||
(--debug) BUILD_TYPE="Debug";;
|
||||
|
||||
(--update) BUILD_UPDATE="yes";;
|
||||
|
||||
# Unique script options.
|
||||
(--build-dir=*) BUILD_DIR="${OPTION#*=}";;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [[ $BUILD_DIR ]]; then
|
||||
if [[ $BUILD_TYPE == Debug ]]; then
|
||||
BUILD_DIR=cmake-build-debug
|
||||
else
|
||||
BUILD_DIR=cmake-build-release
|
||||
fi
|
||||
if [[ $BUILD_TYPE == Debug ]]; then
|
||||
BUILD_DIR=cmake-build-debug
|
||||
else
|
||||
BUILD_DIR=cmake-build-release
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure.
|
||||
@@ -125,7 +149,11 @@ else
|
||||
display_configuration
|
||||
|
||||
if ! [[ $BUILD_UPDATE ]]; then
|
||||
make_project
|
||||
if [[ $MAKE_INSTALL ]]; then
|
||||
install_project
|
||||
else
|
||||
make_project
|
||||
fi
|
||||
fi
|
||||
|
||||
update_project
|
||||
|
||||
Reference in New Issue
Block a user