From 6c9e0db9fe2cc200e945deef0f2494671f9cce45 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Thu, 23 May 2024 21:58:33 -0600 Subject: [PATCH 1/7] Change to using verion number instead of /etc/version --- dist.sh | 8 +-- src/client/client.pro | 2 +- src/server/server.pro | 2 +- src/shared/config.cpp | 156 ++++++++++++++++-------------------------- src/xofb/xofb.pro | 2 +- 5 files changed, 65 insertions(+), 105 deletions(-) diff --git a/dist.sh b/dist.sh index 7869f08..09753e0 100755 --- a/dist.sh +++ b/dist.sh @@ -1,7 +1,7 @@ qmake make mkdir -p ./dist -arm-linux-gnueabihf-strip ./src/client/librm2fb_client.so.1.0.1 -cp ./src/xofb/librm2fb_xofb.so.1.0.1 ./dist -cp ./src/server/librm2fb_server.so.1.0.1 ./dist -cp ./src/client/librm2fb_client.so.1.0.1 ./dist +arm-linux-gnueabihf-strip ./src/client/librm2fb_client.so.1.1.0 +cp ./src/xofb/librm2fb_xofb.so.1.1.0 ./dist +cp ./src/server/librm2fb_server.so.1.1.0 ./dist +cp ./src/client/librm2fb_client.so.1.1.0 ./dist diff --git a/src/client/client.pro b/src/client/client.pro index ea40ba1..43063b9 100755 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -4,7 +4,7 @@ TEMPLATE = lib TARGET = rm2fb_client -VERSION = 1.0.1 +VERSION = 1.1.0 INCLUDEPATH += . # The following define makes your compiler warn you if you use any diff --git a/src/server/server.pro b/src/server/server.pro index 3997013..92649a2 100755 --- a/src/server/server.pro +++ b/src/server/server.pro @@ -5,7 +5,7 @@ TEMPLATE = lib TARGET = rm2fb_server INCLUDEPATH += . -VERSION = 1.0.1 +VERSION = 1.1.0 # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings diff --git a/src/shared/config.cpp b/src/shared/config.cpp index a4d5c69..7e5dcd7 100644 --- a/src/shared/config.cpp +++ b/src/shared/config.cpp @@ -11,8 +11,7 @@ namespace { constexpr auto default_config = R"CONF( -!20201016123042 -version str 2.4.0.27 +!2.4.0.27 update addr 0x2b2534 updateType str int4 create addr 0x2b47c0 @@ -20,8 +19,7 @@ shutdown addr 0x2b4764 wait addr 0x2b3ffc getInstance addr 0x2b2a54 -!20201028163830 -version str 2.4.1.30 +!2.4.1.30 update addr 0x2b255c updateType str int4 create addr 0x2b47e8 @@ -29,8 +27,7 @@ shutdown addr 0x2b478c wait addr 0x2b4024 getInstance addr 0x2b2a7c -!20201127104549 -version str 2.5.0.27 +!2.5.0.27 update addr 0x2c050c updateType str int4 create addr 0x2c2798 @@ -38,8 +35,7 @@ shutdown addr 0x2c273c wait addr 0x2c1fd4 getInstance addr 0x2c0a2c -!20201216142449 -version str 2.5.1.47 +!2.5.1.47 update addr 0x2c0664 updateType str int4 create addr 0x2c28f0 @@ -47,8 +43,7 @@ shutdown addr 0x2c2894 wait addr 0x2c212c getInstance addr 0x2c0b84 -!20210311194323 -version str 2.6.1.71 +!2.6.1.71 update addr 0x311c10 updateType str int4 create addr 0x314178 @@ -56,8 +51,7 @@ shutdown addr 0x31411c wait addr 0x31369c getInstance addr 0x312128 -!20210322075357 -version str 2.6.2.75 +!2.6.2.75 update addr 0x311c00 updateType str int4 create addr 0x314168 @@ -65,8 +59,7 @@ shutdown addr 0x31410c wait addr 0x31368c getInstance addr 0x312118 -!20210504114631 -version str 2.7.0.51 +!2.7.0.51 update addr 0x32373c updateType str int4 create addr 0x325ca8 @@ -74,8 +67,7 @@ shutdown addr 0x325c4c wait addr 0x3251cc getInstance addr 0x323c54 -!20210511153632 -version str 2.7.1.53 +!2.7.1.53 update addr 0x32373c updateType str int4 create addr 0x325ca8 @@ -83,8 +75,7 @@ shutdown addr 0x325c4c wait addr 0x3251cc getInstance addr 0x323c54 -!20210611153600 -version str 2.8.0.98 +!2.8.0.98 update addr 0x3426ac updateType str int4 create addr 0x344c18 @@ -92,8 +83,7 @@ shutdown addr 0x344bbc wait addr 0x34413c getInstance addr 0x342bc8 -!20210709092503 -version str 2.9.0.153 +!2.9.0.153 update addr 0x3aa5c4 updateType str QRect create addr 0x3ac9d8 @@ -101,8 +91,7 @@ shutdown addr 0x3ac97c wait addr 0x3abefc getInstance addr 0x3a0e7c -!20210809135257 -version str 2.9.0.210 +!2.9.0.210 update addr 0x3adc0c updateType str QRect create addr 0x3b0020 @@ -110,8 +99,7 @@ shutdown addr 0x3affc4 wait addr 0x3af544 getInstance addr 0x3a44c4 -!20210812195523 -version str 2.9.1.217 +!2.9.1.217 update addr 0x3afc04 updateType str QRect create addr 0x3b2018 @@ -119,8 +107,7 @@ shutdown addr 0x3b1fbc wait addr 0x3b153c getInstance addr 0x3a64bc -!20210929140057 -version str 2.10.1.332 +!2.10.1.332 update addr 0x397ff4 updateType str QRect create addr 0x39a408 @@ -128,8 +115,7 @@ shutdown addr 0x39a3ac wait addr 0x39992c getInstance addr 0x38e8dc -!20211014151303 -version str 2.10.2.356 +!2.10.2.356 update addr 0x398aac updateType str QRect create addr 0x39aec0 @@ -137,8 +123,7 @@ shutdown addr 0x39ae64 wait addr 0x39a3e4 getInstance addr 0x38f394 -!20211102143141 -version str 2.10.3.379 +!2.10.3.379 update addr 0x398acc updateType str QRect create addr 0x39aee0 @@ -146,8 +131,7 @@ shutdown addr 0x39ae84 wait addr 0x39a404 getInstance addr 0x38f3b4 -!20211202111519 -version str 2.11.0.433 +!2.11.0.433 update addr 0x3a9ccc updateType str QRect create addr 0x3ac124 @@ -155,8 +139,7 @@ shutdown addr 0x3ac0c8 wait addr 0x3ab604 getInstance addr 0x3a041c -!20211203054951 -version str 2.11.0.435 +!2.11.0.435 update addr 0x3a9ccc updateType str QRect create addr 0x3ac124 @@ -164,8 +147,7 @@ shutdown addr 0x3ac0c8 wait addr 0x3ab604 getInstance addr 0x3a041c -!20211208075454 -version str 2.11.0.442 +!2.11.0.442 update addr 0x3a9cdc updateType str QRect create addr 0x3ac134 @@ -173,8 +155,7 @@ shutdown addr 0x3ac0d8 wait addr 0x3ab614 getInstance addr 0x3a042c -!20220202133838 -version str 2.12.1.527 +!2.12.1.527 update addr 0x3d72bc updateType str QRect create addr 0x3d9714 @@ -182,8 +163,7 @@ shutdown addr 0x3d96b8 wait addr 0x3d8bf4 getInstance addr 0x3cda0c -!20220303120824 -version str 2.12.2.573 +!2.12.2.573 update addr 0x3edff4 updateType str QRect create addr 0x3f0138 @@ -191,8 +171,7 @@ shutdown addr 0x3f00d0 wait addr 0x3ef704 getInstance addr 0x3e4ddc -!20220330134519 -version str 2.12.3.606 +!2.12.3.606 update addr 0x3ee704 updateType str QRect create addr 0x3f0848 @@ -200,8 +179,7 @@ shutdown addr 0x3f07e0 wait addr 0x3efe14 getInstance addr 0x3e54ec -!20220429114855 -version str 2.13.0.689 +!2.13.0.689 update addr 0X45899c updateType str QRect create addr 0x45aae0 @@ -209,8 +187,7 @@ shutdown addr 0x45aa78 wait addr 0x45a0ac getInstance addr 0x44f784 -!20220519120030 -version str 2.13.0.758 +!2.13.0.758 update addr 0x4589fc updateType str QRect create addr 0x45ab40 @@ -218,8 +195,7 @@ shutdown addr 0x45aad8 wait addr 0x45a10c getInstance addr 0x44f7e4 -!20220601111708 -version str 2.14.0.830 +!2.14.0.830 update addr 0x4931c4 updateType str QRect create addr 0x495308 @@ -227,8 +203,7 @@ shutdown addr 0x4952a0 wait addr 0x4948d4 getInstance addr 0x489fac -!20220615074909 -version str 2.14.0.861 +!2.14.0.861 update addr 0x4931c4 updateType str QRect create addr 0x495308 @@ -236,8 +211,7 @@ shutdown addr 0x4952a0 wait addr 0x4948d4 getInstance addr 0x489fac -!20220617143306 -version str 2.14.1.866 +!2.14.1.866 update addr 0x4931c4 updateType str QRect create addr 0x495308 @@ -245,8 +219,7 @@ shutdown addr 0x4952a0 wait addr 0x4948d4 getInstance addr 0x489fac -!20220725110358 -version str 2.14.3.925 +!2.14.3.925 update addr 0x4bfb1c updateType str QRect create addr 0x4c2740 @@ -254,8 +227,7 @@ shutdown addr 0x4c26d8 wait addr 0x4c16e0 getInstance addr 0x4b66a4 -!20220804123958 -version str 2.14.3.940 +!2.14.3.940 update addr 0x4bfb1c updateType str QRect create addr 0x4c2740 @@ -263,8 +235,7 @@ shutdown addr 0x4c26d8 wait addr 0x4c16e0 getInstance addr 0x4b66a4 -!20220805144937 -version str 2.14.3.942 +!2.14.3.942 update addr 0x4bfb1c updateType str QRect create addr 0x04c2740 @@ -272,8 +243,7 @@ shutdown addr 0x4c26d8 wait addr 0x4c16e0 getInstance addr 0x4b66a4 -!20220817135850 -version str 2.14.3.958 +!2.14.3.958 update addr 0x4bfb2c updateType str QRect create addr 0x4c2750 @@ -281,8 +251,7 @@ shutdown addr 0x4c26e8 wait addr 0x4c16f0 getInstance addr 0x4b66b4 -!20220825124750 -version str 2.14.3.977 +!2.14.3.977 update addr 0x4bfb2c updateType str QRect create addr 0x4c2750 @@ -290,8 +259,7 @@ shutdown addr 0x4c26e8 wait addr 0x4c16f0 getInstance addr 0x4b66b4 -!20220907143405 -version str 2.14.3.1005 +!2.14.3.1005 update addr 0x4bfb2c updateType str QRect create addr 0x4c2750 @@ -299,8 +267,7 @@ shutdown addr 0x4c26e8 wait addr 0x4c16f0 getInstance addr 0x4b66b4 -!20220921101206 -version str 2.14.3.1047 +!2.14.3.1047 update addr 0x4bfb2c updateType str QRect create addr 0x4c2750 @@ -308,8 +275,7 @@ shutdown addr 0x4c26e8 wait addr 0x4c16f0 getInstance addr 0x4b66b4 -!20220929180236 -version str 2.14.4.46 +!2.14.4.46 update addr 0x4c0a0c updateType str QRect create addr 0x4c3630 @@ -317,8 +283,7 @@ shutdown addr 0x4c35c8 wait addr 0x4c25d0 getInstance addr 0x4b7594 -!20220909155240 -version str 2.15.0.1011 +!2.15.0.1011 update addr 0x4e411c updateType str QRect create addr 0x4e6d40 @@ -326,8 +291,7 @@ shutdown addr 0x4e6cd8 wait addr 0x4e5ce0 getInstance addr 0x4daca4 -!20220921071527 -version str 2.15.0.1046 +!2.15.0.1046 update addr 0x4e418c updateType str QRect create addr 0x4e6db0 @@ -335,8 +299,7 @@ shutdown addr 0x4e6d48 wait addr 0x4e5d50 getInstance addr 0x4dad14 -!20220923094801 -version str 2.15.0.1052 +!2.15.0.1052 update addr 0x4e4254 updateType str QRect create addr 0x4e6e78 @@ -344,8 +307,7 @@ shutdown addr 0x4e6e10 wait addr 0x4e5e18 getInstance addr 0x4daddc -!20221003075633 -version str 2.15.0.1067 +!2.15.0.1067 update addr 0x4e425c updateType str QRect create addr 0x4e6e80 @@ -353,8 +315,7 @@ shutdown addr 0x4e6e18 wait addr 0x4e5e20 getInstance addr 0x4dade4 -!20221026104022 -version str 2.15.1.1189 +!2.15.1.1189 update addr 0x4e48fc updateType str QRect create addr 0x4e7520 @@ -363,8 +324,7 @@ wait addr 0x4e64c0 getInstance addr 0x4db484 notify addr 0x4d98a4 -!20221116102140 -version str 3.0.2.1253 +!3.0.2.1253 update addr 0x55200c updateType str QRect create addr 0x555148 @@ -372,8 +332,7 @@ shutdown addr 0x5550d8 wait addr 0x553ff0 getInstance addr 0x548b94 -!20221208102714 -version str 3.0.4.1305 +!3.0.4.1305 update addr 0x552f74 updateType str QRect create addr 0x5560b0 @@ -382,8 +341,7 @@ wait addr 0x554f58 getInstance addr 0x549674 notify addr 0x547a94 -!20221219100426 -version str 3.1.0.1346 +!3.1.0.1346 update addr 0x52d90c updateType str QRect create addr 0x530a90 @@ -391,8 +349,7 @@ shutdown addr 0x530a20 wait addr 0x52f938 getInstance addr 0x5244d4 -!20230224144032 -version str 3.2.2.1581 +!3.2.2.1581 update addr 0x557aa4 updateType str QRect create addr 0x55ad08 @@ -401,8 +358,7 @@ wait addr 0x559bb0 getInstance addr 0x54e284 notify addr 0x54c788 -!20230227165950 -version str 3.2.3.1595 +!3.2.3.1595 update addr 0x557c34 updateType str QRect create addr 0x55ae98 @@ -411,8 +367,7 @@ wait addr 0x559d40 getInstance addr 0x54e414 notify addr 0x54c918 -!20230414143852 -version str 3.3.2.1666 +!3.3.2.1666 update addr 0x5583c8 updateType str QRect create addr 0x55b504 @@ -443,6 +398,7 @@ void read_config_file( std::istringstream line_stream{line.substr(1)}; std::string file_version; line_stream >> file_version; + accumulator["version"] = file_version; if (file_version == version) { version_matches = true; @@ -466,7 +422,7 @@ void read_config_file( accumulator[key] = value; } else { std::cerr << name << ":" << line_no << " - Ignored key of invalid " - "type '" << type << "'\n"; + "type '" << type << "'" << std::endl; } } ++line_no; @@ -493,13 +449,13 @@ Config read_config(const std::string& version) { if (!config_file) { #ifdef DEBUG - std::cerr << path << " - " << std::strerror(errno) << " (skipped)\n"; + std::cerr << path << " - " << std::strerror(errno) << " (skipped)" << std::endl; #endif continue; } #ifdef DEBUG - std::cerr << path << " - Parsing contents\n"; + std::cerr << path << " - Parsing contents" << std::endl; #endif read_config_file(path, config_file, version, result); @@ -510,13 +466,17 @@ Config read_config(const std::string& version) { Config read_config() { std::string version; - std::ifstream version_file_buf{"/etc/version"}; + std::string line; + + std::ifstream file("/usr/share/remarkable/update.conf"); - if (!version_file_buf) { - std::cerr << "/etc/version - " << std::strerror(errno) << "\n"; - std::exit(-1); + while (std::getline(file, line)) { + if (line.rfind("REMARKABLE_RELEASE_VERSION=", 0) == 0) { + std::istringstream line_stream{line.substr(27)}; + line_stream >> version; + break; + } } - std::getline(version_file_buf, version); return read_config(version); } diff --git a/src/xofb/xofb.pro b/src/xofb/xofb.pro index d833c72..7ec2d7f 100755 --- a/src/xofb/xofb.pro +++ b/src/xofb/xofb.pro @@ -5,7 +5,7 @@ TEMPLATE = lib TARGET = rm2fb_xofb INCLUDEPATH += . -VERSION = 1.0.1 +VERSION = 1.1.0 # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings From 7fba9fbca5f18727fe51bf5fe6ecc0f8db45faef Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Thu, 23 May 2024 22:03:33 -0600 Subject: [PATCH 2/7] Update tutorial --- tutorial/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tutorial/README.md b/tutorial/README.md index 8323236..3492359 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -9,7 +9,7 @@ Before starting this tutorial, [download and install Ghidra](https://www.ghidra- ## Setup -1. Copy the contents of `/etc/version` from your reMarkable 2. It should look like a date/time string, e.g. `20220921101204`. That's what will go in the first `!` line of the configuration entry you'll add to this project. +1. run `grep REMARKABLE_RELEASE_VERSION /usr/share/remarkable/update.conf | cut -d= -f2` on your reMarkable 2, it will output the version number of the device. The first line of the configuration you add to this project should be `!` followed by the version number. 2. Copy the file `/usr/bin/xochitl` from your reMarkable 2 onto your machine 3. Run Ghidra 4. Menu "File > New Project" ("Non-shared", pick any directory and name you want) @@ -87,8 +87,7 @@ Before starting this tutorial, [download and install Ghidra](https://www.ghidra- With the hex code offsets of all five functions, you can now create a new configuration entry. Example entry: ``` -!20220921101206 -version str 2.14.3.1047 +!2.14.3.1047 update addr 0x4bfb2c updateType str QRect create addr 0x4c2750 From 075964e5bf74f2d1a5ff44570c643479248b4732 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Thu, 23 May 2024 22:05:18 -0600 Subject: [PATCH 3/7] Run build on PR --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a36749..338feae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v*.*.*' + pull_request: jobs: build: @@ -18,6 +19,12 @@ jobs: run: | ./dist.sh + - uses: actions/upload-artifact@v4 + with: + name: build + path: dist/* + if-no-files-found: error + - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') From 424db0e9fc1bc55039fa8a5d35b472c30f286604 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Thu, 23 May 2024 22:06:48 -0600 Subject: [PATCH 4/7] Update actions/checkout --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 338feae..26b2e39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: container: ghcr.io/toltec-dev/qt steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Build run: | From 0e0ed68553aac4ad636b86f2474a2df059f9d7bc Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Thu, 23 May 2024 22:09:12 -0600 Subject: [PATCH 5/7] Update all other scripts --- rm2fb.pro | 8 ++++---- scripts/build.sh | 6 +++--- scripts/run.sh | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rm2fb.pro b/rm2fb.pro index 253c42b..e0ef16b 100755 --- a/rm2fb.pro +++ b/rm2fb.pro @@ -1,8 +1,8 @@ TEMPLATE = subdirs SUBDIRS = \ - src/loader \ # relative paths - src/server \ - src/client \ - src/xofb \ + src/loader \ # relative paths + src/server \ + src/client \ + src/xofb \ diff --git a/scripts/build.sh b/scripts/build.sh index 33c9b05..4cc308d 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,9 @@ qmake make mkdir -p dist/rm2fb -cp src/loader/librm2fb_demo.so.1.0.0 dist/rm2fb/ -cp src/server/librm2fb_server.so.1.0.0 dist/rm2fb/ -cp src/client/librm2fb_client.so.1.0.0 dist/rm2fb/ +cp src/loader/librm2fb_demo.so.1.1.0 dist/rm2fb/ +cp src/server/librm2fb_server.so.1.1.0 dist/rm2fb/ +cp src/client/librm2fb_client.so.1.1.0 dist/rm2fb/ cp scripts/run.sh dist/rm2fb/rm2fb.sh chmod +x dist/rm2fb/rm2fb.sh cd dist/ diff --git a/scripts/run.sh b/scripts/run.sh index 48c8216..394a574 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" systemctl stop xochitl -LD_PRELOAD=${DIR}/librm2fb_server.so.1.0.0 `which xochitl` & +LD_PRELOAD=${DIR}/librm2fb_server.so.1.1.0 `which xochitl` & pid=$! sleep 2 -LD_PRELOAD=${DIR}/librm2fb_client.so.1.0.0 $* +LD_PRELOAD=${DIR}/librm2fb_client.so.1.1.0 $* pid2=$! wait $pid2 kill -9 -${pid} From c8efb0c34e8de39287bc48c1af8111a21575fbfa Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 8 Sep 2024 21:43:06 -0600 Subject: [PATCH 6/7] Version 1.0.2 instead of 1.1.0 --- .gitignore | 1 + dist.sh | 9 +++++---- rm2fb.pro | 2 ++ scripts/build.sh | 7 ++++--- scripts/run.sh | 5 +++-- src/client/client.pro | 2 +- src/loader/loader.pro | 1 + src/server/server.pro | 2 +- src/xofb/xofb.pro | 2 +- version.pri | 1 + 10 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 version.pri diff --git a/.gitignore b/.gitignore index ffaae64..4ce1334 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ rm2-framebuffer *.so.* *.so dist +rm2fb*.tar.gz diff --git a/dist.sh b/dist.sh index 09753e0..1a4e520 100755 --- a/dist.sh +++ b/dist.sh @@ -1,7 +1,8 @@ qmake make mkdir -p ./dist -arm-linux-gnueabihf-strip ./src/client/librm2fb_client.so.1.1.0 -cp ./src/xofb/librm2fb_xofb.so.1.1.0 ./dist -cp ./src/server/librm2fb_server.so.1.1.0 ./dist -cp ./src/client/librm2fb_client.so.1.1.0 ./dist +version=$(grep VERSION= version.pri | cut -d= -f2) +arm-linux-gnueabihf-strip ./src/client/librm2fb_client.so.$version +cp ./src/xofb/librm2fb_xofb.so.$version ./dist +cp ./src/server/librm2fb_server.so.$version ./dist +cp ./src/client/librm2fb_client.so.$version ./dist diff --git a/rm2fb.pro b/rm2fb.pro index e0ef16b..17277a3 100755 --- a/rm2fb.pro +++ b/rm2fb.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs +include(version.pri) + SUBDIRS = \ src/loader \ # relative paths src/server \ diff --git a/scripts/build.sh b/scripts/build.sh index 4cc308d..1f21c6d 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,10 @@ qmake make mkdir -p dist/rm2fb -cp src/loader/librm2fb_demo.so.1.1.0 dist/rm2fb/ -cp src/server/librm2fb_server.so.1.1.0 dist/rm2fb/ -cp src/client/librm2fb_client.so.1.1.0 dist/rm2fb/ +version=$(grep VERSION= version.pri | cut -d= -f2) +cp src/loader/librm2fb_demo.so.$version dist/rm2fb/ +cp src/server/librm2fb_server.so.$version dist/rm2fb/ +cp src/client/librm2fb_client.so.$version dist/rm2fb/ cp scripts/run.sh dist/rm2fb/rm2fb.sh chmod +x dist/rm2fb/rm2fb.sh cd dist/ diff --git a/scripts/run.sh b/scripts/run.sh index 394a574..2ff9e4a 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" systemctl stop xochitl -LD_PRELOAD=${DIR}/librm2fb_server.so.1.1.0 `which xochitl` & +version=$(grep VERSION= version.pri | cut -d= -f2) +LD_PRELOAD=${DIR}/librm2fb_server.so.$version `which xochitl` & pid=$! sleep 2 -LD_PRELOAD=${DIR}/librm2fb_client.so.1.1.0 $* +LD_PRELOAD=${DIR}/librm2fb_client.so.$version $* pid2=$! wait $pid2 kill -9 -${pid} diff --git a/src/client/client.pro b/src/client/client.pro index 43063b9..6ef4404 100755 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -4,8 +4,8 @@ TEMPLATE = lib TARGET = rm2fb_client -VERSION = 1.1.0 INCLUDEPATH += . +include(../../version.pri) # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings diff --git a/src/loader/loader.pro b/src/loader/loader.pro index be39c46..e9edaf2 100755 --- a/src/loader/loader.pro +++ b/src/loader/loader.pro @@ -5,6 +5,7 @@ TEMPLATE = lib TARGET = rm2fb_demo INCLUDEPATH += . +include(../../version.pri) # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings diff --git a/src/server/server.pro b/src/server/server.pro index 92649a2..5fb5154 100755 --- a/src/server/server.pro +++ b/src/server/server.pro @@ -5,7 +5,7 @@ TEMPLATE = lib TARGET = rm2fb_server INCLUDEPATH += . -VERSION = 1.1.0 +include(../../version.pri) # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings diff --git a/src/xofb/xofb.pro b/src/xofb/xofb.pro index 7ec2d7f..1602522 100755 --- a/src/xofb/xofb.pro +++ b/src/xofb/xofb.pro @@ -5,7 +5,7 @@ TEMPLATE = lib TARGET = rm2fb_xofb INCLUDEPATH += . -VERSION = 1.1.0 +include(../../version.pri) # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings diff --git a/version.pri b/version.pri new file mode 100644 index 0000000..14ecfb0 --- /dev/null +++ b/version.pri @@ -0,0 +1 @@ +VERSION=1.0.2 From d6d4de24036b95bf6e459fc917e4c00191ede9ce Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 8 Sep 2024 21:51:36 -0600 Subject: [PATCH 7/7] Fallback to build date if unable to find version number --- src/shared/config.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/shared/config.cpp b/src/shared/config.cpp index 7e5dcd7..28b49d6 100644 --- a/src/shared/config.cpp +++ b/src/shared/config.cpp @@ -478,5 +478,26 @@ Config read_config() { } } + Config config = read_config(version); + + if (!config.empty()){ + return config; + } + +#ifdef DEBUG + std::cerr + << "Unable to find config for version number, looking for old build date instead" + << std::endl; +#endif + + std::ifstream version_file_buf{"/etc/version"}; + + if (!version_file_buf) { + std::cerr << "/etc/version - " << std::strerror(errno) << "\n"; + std::exit(-1); + } + + std::getline(version_file_buf, version); + return read_config(version); }