From 1fe622a27b87e37e6624fc220ee27970d9ceb2d7 Mon Sep 17 00:00:00 2001 From: Simon Struck Date: Sun, 20 Dec 2020 22:02:09 +0100 Subject: [PATCH] Update build scripts and readme --- Cargo.lock | 2 +- Cargo.toml | 2 +- Readme.md | 14 +++++++++----- build_pack.sh | 27 +++++++++------------------ build_push_run.sh | 38 ++++++++++++++++++++++++-------------- release/install.sh | 15 +++++++++------ 6 files changed, 53 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2877d6..7051759 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,7 +288,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pipes-and-rust" -version = "0.1.0" +version = "0.2.0" dependencies = [ "rust-embed", "simple-server", diff --git a/Cargo.toml b/Cargo.toml index b1f70dd..13afcf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pipes-and-rust" -version = "0.1.0" +version = "0.2.0" authors = ["simon "] edition = "2018" diff --git a/Readme.md b/Readme.md index b3f25e7..b5e1b7c 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,7 @@ # Pipes and Rust -Draw on a html canvas directly from your reMarkable 2. +A small program that runs on your reMarkable 2 that allows you to draw on a tiny website hosted on the tablet itself. +No need to install anything else. ![](images/wiriting_test_canvas.png) @@ -12,26 +13,29 @@ Draw on a html canvas directly from your reMarkable 2. # Requirements -1. SSH access to the reMarkable for installation -2. (when building from source) Rust +1. SSH access to the reMarkable 2 for installation (passwordless ssh-key recommended) +2. (when building from source) [Rust](https://rustup.rs/) +3. (when building from source) [Cross](https://github.com/rust-embedded/cross) # Installation (from Binary) 1. Download the [latest release](https://github.com/AnyTimeTraveler/pipes-and-rust/releases) 2. Set IP or hostname in `install.sh` -3. Run install.sh +3. Run `install.sh` as normal user # Installation (from Source) 1. Install [Rust](https://rustup.rs/) 2. Install [Cross](https://github.com/rust-embedded/cross) to build for armv7 3. Set hostname in `build_push_run.sh` -4. Run `build_push_run.sh` with either 'debug' or 'release' as parameter +4. Execute `build_push_run.sh` # Credits This work is based on [pipes-and-paper](https://gitlab.com/afandian/pipes-and-paper) by Joe Wass and uses his code to read the stylus coordinates. +Thank you to [MarkPash](https://github.com/MarkPash) for adding the eraser function. + # License MIT-License diff --git a/build_pack.sh b/build_pack.sh index fbad243..071223a 100755 --- a/build_pack.sh +++ b/build_pack.sh @@ -1,29 +1,20 @@ #!/usr/bin/env zsh -if [ $# -ne 1 ]; then - echo "parameter 'debug' or 'release' required" - exit -fi - -build_type="$1" arch="armv7-unknown-linux-musleabihf" #arch="armv7-unknown-linux-gnueabihf" echo "Compiling..." -if [ "$build_type" = "release" ]; then - cross build --target "$arch" --release -else - cross build --target "$arch" -fi +cross build --target "$arch" --release || exit 1 echo "Done" -# shellcheck disable=SC2181 -if [ $? -eq 0 ]; then - echo "Copying to directory..." - cp "./target/$arch/$build_type/pipes-and-rust" "release/pipes-and-rust" - echo "Done" -fi +echo "Copying to directory..." +cp "./target/$arch/release/pipes-and-rust" "release/pipes-and-rust" || exit 1 +echo "Done" version="$(grep 'version' Cargo.toml | head -n 1 | cut -d\" -f2)" -(cd release && zip "../pipes-and-rust-release-$version.zip" ./install.sh ./pipes-and-rust ./pipes-and-rust.service) +cd release || exit 1 +zip "../pipes-and-rust-release-$version.zip" \ +./install.sh \ +./pipes-and-rust \ +./pipes-and-rust.service diff --git a/build_push_run.sh b/build_push_run.sh index d75d57c..b9d6250 100755 --- a/build_push_run.sh +++ b/build_push_run.sh @@ -1,23 +1,33 @@ #!/usr/bin/env zsh -version="$1" host="remarkable" arch="armv7-unknown-linux-musleabihf" #arch="armv7-unknown-linux-gnueabihf" -echo "Compiling..." -if [ "$version" = "release" ]; then - cross build --target "$arch" --release -else - cross build --target "$arch" +echo "Checking if Docker is running..." +if ! systemctl status docker.service > /dev/null; then + echo "Done" + echo "Starting Docker..." + sudo systemctl start docker.service fi echo "Done" -# shellcheck disable=SC2181 -if [ $? -eq 0 ]; then - echo "Killing last process..." - ssh remarkable "killall pipes-and-rust" - echo "Done" - echo "Copying to device..." - scp "./target/$arch/$version/pipes-and-rust" "$host:/opt/pipes-and-rust" && echo "Done" && ssh "$host" "/opt/pipes-and-rust" -fi +echo "Compiling..." +cross build --target "$arch" --release || exit 1 +echo "Done" + +echo "Killing last process..." +ssh "$host" "killall pipes-and-rust" +echo "Done" + +echo "Checking if /opt/ directory exists in device..." +ssh "$host" "mkdir -p /opt/" || exit 1 +echo "Done" + +echo "Copying to device..." +scp "./target/$arch/release/pipes-and-rust" "$host:/opt/pipes-and-rust" || exit 1 +echo "Done" + +echo "Running..." +ssh "$host" "/opt/pipes-and-rust" || exit 1 +echo "Done" diff --git a/release/install.sh b/release/install.sh index 9add973..7389e2b 100755 --- a/release/install.sh +++ b/release/install.sh @@ -5,14 +5,17 @@ host="remarkable" -ssh "$host" "mkdir -p /opt/" +ssh "$host" "mkdir -p /opt/" || exit 1 +echo "Stopping previous version..." +ssh "$host" "systemctl stop pipes-and-rust.service" +ssh "$host" "killall pipes-and-rust" echo "Copying files to device..." -scp "./pipes-and-rust" "$host:/opt/pipes-and-rust" || exit -scp "./pipes-and-rust.service" "$host:/lib/systemd/system/pipes-and-rust.service" || exit +scp "./pipes-and-rust" "$host:/opt/pipes-and-rust" || exit 1 +scp "./pipes-and-rust.service" "$host:/lib/systemd/system/pipes-and-rust.service" || exit 1 echo "Done" echo "Installing service..." -ssh "$host" "systemctl daemon-reload" || exit -ssh "$host" "systemctl enable pipes-and-rust.service" || exit -ssh "$host" "systemctl start pipes-and-rust.service" || exit +ssh "$host" "systemctl daemon-reload" || exit 1 +ssh "$host" "systemctl enable pipes-and-rust.service" || exit 1 +ssh "$host" "systemctl start pipes-and-rust.service" || exit 1 echo "Done"