1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00

Merge pull request #3183 from holta/remoteit-louder-warning

templates/iiab-remoteit: Warn if /etc/remoteit/config.json exists...and try it if operator really wants to?
This commit is contained in:
A Holt 2022-04-18 13:24:15 -04:00 committed by GitHub
commit 46ec13757c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 5 deletions

View file

@ -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: 1. Run `sudo iiab-remoteit` to enable remote.it on your IIAB:
- Hit [Enter] <!-- (repeatedly if necessary, to accept all defaults) --> 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). 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` 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.* *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 after `sudo iiab-remoteit` completes, by jumping to Step 5. in OPTION #2.*
<!-- <!--
1. Connect your IIAB device to the Internet. 1. Connect your IIAB device to the Internet.

View file

@ -38,7 +38,7 @@ if [[ $KEY1 != "" ]]; then
echo -e "Removed remoteit_license_key line from /etc/iiab/local_vars.yml\n" echo -e "Removed remoteit_license_key line from /etc/iiab/local_vars.yml\n"
fi fi
# /etc/remoteit/registration consequences summarized on lines 80-85 # /etc/remoteit/registration consequences summarized on lines 114-119
if [ -s /etc/remoteit/registration ]; then # Non-zero size if [ -s /etc/remoteit/registration ]; then # Non-zero size
cp -p /etc/remoteit/registration /tmp/etc.remoteit.registration cp -p /etc/remoteit/registration /tmp/etc.remoteit.registration
echo -e "License key $(cat /etc/remoteit/registration) will be attempted." echo -e "License key $(cat /etc/remoteit/registration) will be attempted."
@ -48,9 +48,43 @@ elif [ -f /etc/remoteit/registration ]; then # Zero size, e.g. due to touch
echo -e "Empty /etc/remoteit/registration deleted, so claim code can be generated.\n" echo -e "Empty /etc/remoteit/registration deleted, so claim code can be generated.\n"
fi fi
echo -e "\nThis IIAB must be online to begin!\n" echo -e "\nThis IIAB must be online to begin!"
echo -en "\e[1mOptionally purge + install latest remote.it Device Package? [y/N]\e[0m " if [ -f /etc/remoteit/config.json ]; then
echo -en "\n\e[1mFor fresh registration let's remove /etc/remoteit/config.json, Ok? [Y/n]\e[0m "
read -n 1 -r ans < /dev/tty # Prompt for a single character
echo; echo
if [[ $ans = "n" || $ans = "N" ]]; then # Nearly the same as Lines 142-189
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
echo -e "\e[1m\nYou can now check for this IIAB device in your https://remote.it account."
echo -e "(IF your pre-existing /etc/remoteit/config.json was working in the past!)\e[0m\n"
echo -e "\e[1m1) Log in to https://remote.it or its Desktop Application on your own PC:\e[0m"
echo -e " https://remote.it/download/\n"
echo -e '\e[1m2) In the "Devices" section on the left, check that your IIAB is now present:\e[0m'
echo -e " https://docs.remote.it/software/device-package/installation#3.-claim-and-register-the-device\n"
echo -e "\e[1m3) Authorize services/ports (e.g. SSH, HTTP, etc) for your IIAB device:\e[0m"
echo -e " https://docs.remote.it/software/device-package/installation#4.-set-up-services-on-your-device\n"
exit 0
fi
fi
echo -en "\e[1m\nOptionally purge + install latest remote.it Device Package? [y/N]\e[0m "
read -n 1 -r ans < /dev/tty # Prompt for a single character read -n 1 -r ans < /dev/tty # Prompt for a single character
echo; echo echo; echo