diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..69b7523 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,55 @@ +# This is a basic workflow to help you get started with Actions + +name: PackageCreator + +# Controls when the action will run. +on: + # Triggers the workflow on new version + push: + tags: + - "v*.*.*" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Build libraries and executable + run: | + cmake build . + make + sudo make install + cd Examples/PosturePerfection + cmake build . + make + - name: Build Linux Packages + # You may pin to the exact commit or the version. + # uses: kentik/pkg@acc28d8704a179dd0378c3c21eb8d8dbb803edb6 + uses: kentik/pkg@v1.0.0-rc7 + with: + # Package name + name: PosturePerfectionReceiver + # Package version + version: 1.0.0 + # Package architecture + arch: x86_64 + # Package format + format: deb + # Package spec file + package: package.yaml + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: PosturePerfectionReceiver + path: ${{ github.workspace }}/*.deb diff --git a/.gitignore b/.gitignore index 9a1fa35..61130af 100644 --- a/.gitignore +++ b/.gitignore @@ -12,11 +12,11 @@ Examples/PosturePerfection/CMakeFiles/* Examples/PosturePerfection/Makefile #Binaries -libRemoteNotify.a libRemoteNotifyBroadcast.a libRemoteNotifyReceive.a -PosturePerfectionReceiver -PosturePerfectionTestBroadcast +Examples/PosturePerfection/PosturePerfectionReceiver +Examples/PosturePerfection/PosturePerfectionLocalReceiver +Examples/PosturePerfection/PosturePerfectionTestBroadcast #Vim .swp #VSCODE diff --git a/Examples/PosturePerfection/CMakeLists.txt b/Examples/PosturePerfection/CMakeLists.txt index e9dea1d..5856e14 100644 --- a/Examples/PosturePerfection/CMakeLists.txt +++ b/Examples/PosturePerfection/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) -project(Posture{erfectionNotification) +project(PosturePerfectionNotification) # add the executable add_executable(PosturePerfectionLocalReceiver PosturePerfection_receiver.cpp) diff --git a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64.deb b/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64.deb deleted file mode 100644 index dc307b9..0000000 Binary files a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64.deb and /dev/null differ diff --git a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/DEBIAN/control b/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/DEBIAN/control deleted file mode 100644 index bd62bc6..0000000 --- a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/DEBIAN/control +++ /dev/null @@ -1,5 +0,0 @@ -Package: PosturePerfectionReceiver -Version: 1.0 -Architecture: amd64 -Maintainer: ESE-Peasy -Description: A UDP receiver from messages generated by the main PosturePerfection program diff --git a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/usr/local/include/RemoteNotifyReceive.h b/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/usr/local/include/RemoteNotifyReceive.h deleted file mode 100644 index 2763763..0000000 --- a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/usr/local/include/RemoteNotifyReceive.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @file RemoteNotifyReceive.h - * @brief For listening and receiving notifications from - * `RemoteNotify::Broadcast` - * - * @copyright Copyright (C) 2021 Conor Begley - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef REMOTENOTIFYRECEIVE_H_ -#define REMOTENOTIFYRECEIVE_H_ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace RemoteNotify { -/** - * @brief Error handler for socket connections - * - * @param num The result of socket function - * @param msg Message to be printed also default error message - */ -int err_msg(int num, std::string msg); - -/** - * @brief Return result from system command as a string - * @param cmd The system command - */ -std::string GetStringFromCommand(std::string cmd); - -/** - * @brief A `RemoteNotify::Receive` for listening and receiving notifications - * from `RemoteNotify::Broadcast` - * - */ -class Receive { - private: - int receive_fd; ///< Receive socket file descriptor - struct sockaddr_in address, ///< Receive address - Broadcast_address; ///< Specific address details for received messages - int addr_len = sizeof(address); ///< Length of address structure - int Broadcast_len = - sizeof(Broadcast_address); ///< Length of Broadcast address structure - std::string command = "notify-send -t 0"; ///< Notify-send command - ///< and flags - std::string title; ///< Title of Notify Send message - std::string image; ///< Absolute path of image - std::string middle = "--icon"; - char quote = '"'; - char space = ' '; - - public: - char buffer[1024]; ///< Returned result from broadcasted message - /** - * @brief Constructor for `RemoteNotify::Receive` - * - * @param port Port number to listen on (default is 121121) - * @param ignore Boolean to ignore location where Notify::NotifyReceive is - * running - * @param check_env If `true` will check current desktop environment and - * change notify-send command if needed - */ - Receive(int port = 121121, bool check_env = true, - std::string title = "Remote Notify Send Receive", - std::string image = ""); - ~Receive(); - - /** - * @brief Sets the `Notify::NotifyReceive` to start listening - */ - void run(); -}; -} // namespace RemoteNotify -#endif // SRC_NOTIFICATIONS_Receive_H_ diff --git a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/usr/local/share/PosturePerfection/posture-logo-no-text.png b/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/usr/local/share/PosturePerfection/posture-logo-no-text.png deleted file mode 100644 index 8157c10..0000000 Binary files a/Examples/PosturePerfection/debPackage/PosturePerfectionReceiver_1.0_amd64/usr/local/share/PosturePerfection/posture-logo-no-text.png and /dev/null differ diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..82f70f2 --- /dev/null +++ b/package.yaml @@ -0,0 +1,24 @@ +meta: + description: UDP Receiver for messages from Posture Perfection main program + vendor: ESE-Peasy + maintainer: ESE-Peasy +files: + "/usr/local/bin/PosturePerfectionReceiver": + file: Examples/PosturePerfection/PosturePerfectionReceiver + mode: "0755" + user: "root" + "/usr/local/lib/libRemoteNotifyReceive.a": + file: libRemoteNotifyReceive.a + mode: "0755" + user: "root" + keep: true + "/usr/local/include/RemoteNotifyReceive.h": + file: RemoteNotifyReceive.h + mode: "0755" + user: "root" + keep: true + "/usr/local/share/PosturePerfection/posture-logo-no-text.png": + file: Examples/PosturePerfection/posture-logo-no-text.png + mode: "0755" + user: "root" + keep: true