From 70cc74ac4731c00f1a0a165c3ab8be3b2d6d5734 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 18 Apr 2022 09:55:35 -0400 Subject: [PATCH 1/4] templates/iiab-remoteit: Warn if /etc/remoteit/config.json exists...and try it? --- roles/remoteit/templates/iiab-remoteit | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/roles/remoteit/templates/iiab-remoteit b/roles/remoteit/templates/iiab-remoteit index 94f04e27d..a13bf20ef 100755 --- a/roles/remoteit/templates/iiab-remoteit +++ b/roles/remoteit/templates/iiab-remoteit @@ -50,6 +50,28 @@ fi echo -e "\nThis IIAB must be online to begin!\n" +if [ -f /etc/remoteit/config.json ]; then + echo -en "For fresh registration let's remove /etc/remoteit/config.json, Ok? [Y/n] " + read -n 1 -r ans < /dev/tty # Prompt for a single character + echo; echo + + if [[ $ans != "y" && $ans != "Y" ]]; then + echo -e "Let's try to enable remote.it, with your existing /etc/remoteit/config.json...\n" + + systemctl enable connectd + systemctl restart connectd + systemctl enable schannel + + if grep -q '^remoteit_enabled:' /etc/iiab/local_vars.yml; then + sed -i "s/^remoteit_enabled:.*/remoteit_enabled: True/" /etc/iiab/local_vars.yml + else + echo "remoteit_enabled: True" >> /etc/iiab/local_vars.yml + fi + + exit 0 + fi +fi + echo -en "\e[1mOptionally purge + install latest remote.it Device Package? [y/N]\e[0m " read -n 1 -r ans < /dev/tty # Prompt for a single character echo; echo From e072c7027af9180c89be82ee0c84eb136ade3b6c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 Apr 2022 11:07:12 -0400 Subject: [PATCH 2/4] Fix iiab-remoteit + Cleaner instructions --- roles/remoteit/README.md | 8 ++++++-- roles/remoteit/templates/iiab-remoteit | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/roles/remoteit/README.md b/roles/remoteit/README.md index 489af24fb..9808235da 100644 --- a/roles/remoteit/README.md +++ b/roles/remoteit/README.md @@ -24,16 +24,20 @@ Prerequisite: Find any IIAB with `remoteit_installed: True` in `/etc/iiab/iiab_s 1. Run `sudo iiab-remoteit` to enable remote.it on your IIAB: - - Hit [Enter] if this is a fresh install, to quickly generate a claim code for your IIAB. + - Hit [Enter] (repeatedly if necessary, to accept all defaults) to quickly generate a claim code for your IIAB. The claim code must be used [within 24 hours](https://docs.remote.it/device-package/installation#2.-update-your-package-manager-and-install) (Step 2., below). Just FYI a copy is also put in: `/etc/remoteit/config.json` - - EXCEPTION: If a remote.it license key happens to be found in `/etc/iiab/local_vars.yml` or `/etc/remoteit/registration`, that will be tried first (prior to, and instead of generating a claim code). + - EXCEPTION #1: If a remote.it license key happens to be found in `/etc/iiab/local_vars.yml` or `/etc/remoteit/registration`, that will be tried first (prior to, and instead of generating a claim code). *If the license key works, you will not get a claim code (as the IIAB device auto-registers to your remote.it account) so jump to Step 5. in OPTION #2.* + - EXCEPTION #2: If you have an existing `/etc/remoteit/config.json` you will be given the option to try that (e.g. if you already registered the IIAB device to your remote.it account). + + *Verify that by jumping to Step 5. in OPTION #2.* +