From bc0b0f98fc7f714dc597a264873ac0ac38d6c8d3 Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:14:08 -0500 Subject: [PATCH 1/8] Update bootstrap.sh --- bootstrap.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index a60554cff1b..d5e5238e0a0 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,7 +1,7 @@ #!/bin/sh PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" -# curl https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/Navid_2022_10_26Test/bootstrap.sh | bash +# curl https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/VerifyVM_Test/bootstrap.sh | bash <--- Only tested this way echo echo "Bootstrapping the menu - Navid200" @@ -11,17 +11,18 @@ sudo apt-get update sudo apt-get -y install wget bash sudo apt-get -y install dialog sudo apt-get install -y git python gcc g++ make +sudo apt-get -y install netcat -cd /tmp clear -dialog --msgbox "Shortly after you proceed, the server will\n\ +dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ +Shortly after you proceed, the server will\n\ automatically reboot and an expected error\n\ message will appear.\n\ Please wait 30 seconds before clicking on\n\ "Retry" to reconnect.\n\n\ After this, every time you open a terminal,\n\ a menu will offer all the available options.\n\n\ -To proceed, press Enter." 15 48 +To proceed, press Enter." 17 48 clear cd / @@ -37,7 +38,7 @@ fi cd /tmp sudo rm update_scripts.sh -#wget https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/Navid_2022_10_26Test/update_scripts.sh # Navid's +#wget https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/VerifyVM_Test/update_scripts.sh # Navid's wget https://raw.githubusercontent.com/jamorham/nightscout-vps/vps-1/update_scripts.sh # Main if [ ! -s update_scripts.sh ] then @@ -70,5 +71,8 @@ alias menu="/xDrip/scripts/menu.sh" EOF fi -# Reboot +source ~/.bashrc +# Bring up the status page +/xDrip/scripts/Status.sh sudo reboot + From 506460fc22c02d539f4dd51496b06a646928fa15 Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:15:13 -0500 Subject: [PATCH 2/8] Update Status.sh --- Status.sh | 81 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 21 deletions(-) diff --git a/Status.sh b/Status.sh index d258321fe00..6f0d19ce993 100644 --- a/Status.sh +++ b/Status.sh @@ -1,26 +1,65 @@ #!/bin/bash # Show a summary of parameters. - Navid200 +clear +echo "Please be patient (30 seconds)" +echo " " +echo " " -cd /tmp -echo " Developed by the xDrip team " > tmp -echo " " >> tmp -echo "--------------------------------------------------" >> tmp -lsb_release -a | sed -n 2p >> tmp -echo " " >> tmp -echo "--------------------------------------------------" >> tmp -free -h | sed -n 3p >> tmp -echo " " >> tmp -echo "--------------------------------------------------" >> tmp -df -m . >> tmp -echo " " >> tmp -echo "--------------------------------------------------" >> tmp -echo "MongoDB" >> tmp -mongod --version | sed -n 1p >> tmp -echo " " >> tmp -echo "--------------------------------------------------" >> tmp -echo "Nightscout process" >> tmp -ps -ef | grep SCREEN | grep root | fold --width=40 | sed -n 1p >> tmp - -dialog --colors --textbox tmp 25 50 +Ram=$(free -m | sed -n 2p | awk '{print $2}') +unit="M" +Ramsize="$Ram"$unit +if [ $Ram -gt 1000 ] +then +Ramsize="\Zb\Z1 $Ram$unit \Zn" +fi + +disk="\Z1\ZbBalanced\Zn" +if [ $(cat /sys/block/sda/queue/rotational) -eq 1 ] +then +disk="Standard" +fi + +disksz="$(df -h | sed -n 2p | awk '{print $2}')" +if [ ! "$disksz" = "29G" ] +then +disksz="\Zb\Z1$(df -h | sed -n 2p | awk '{print $2}')\Zn" +fi + +swap="$(free -h | sed -n 3p | awk '{print $2}')" + +ubuntu="$(lsb_release -a | sed -n 2p | awk '{print $3, $4}')" +if [ ! "$ubuntu" = "20.04.5 LTS" ] +then +ubuntu="\Zb\Z1$(lsb_release -a | sed -n 2p | awk '{print $3, $4}')\Zn" +fi + +current=$(wget -q -O - http://checkip.dyndns.org|sed s/[^0-9.]//g) +nc -zvw10 $current 80 2> /tmp/http +grep 'timed out' /tmp/http > /tmp/http2 +nc -zvw10 $current 443 2> /tmp/https +grep 'timed out' /tmp/https > /tmp/https2 +http="Open" +if [ -s /tmp/http2 ] || [ -s /tmp/https2 ] +then +http="\Zb\Z1Closed\Zn" +fi + + +mongo="$(mongod --version | sed -n 1p)" +ns="$(ps -ef | grep SCREEN | grep root | fold --width=40 | sed -n 1p)" + +dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ + \Zb Status \Zn \n\\n + \ZbVirtual Machine\Zn \n\ +RAM: $Ramsize \n\ +Disk type: "$disk" \n\ +Disk size: $disksz \n\ +Ubuntu: $ubuntu \n\ +HTTP & HTTPS: $http \n\n\ +------------------------------------------ \n\ +Swap: $swap \n\ +Mongo: $mongo \n\ +NS proc: $ns \n\ + " 21 50 From 9b8fa7759105589f05f410790dd7cf4bd2416c61 Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:20:17 -0500 Subject: [PATCH 3/8] Update update_scripts.sh --- update_scripts.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/update_scripts.sh b/update_scripts.sh index 9a54127b6bf..d5edfb80e3b 100644 --- a/update_scripts.sh +++ b/update_scripts.sh @@ -18,7 +18,7 @@ sudo git clone https://github.com/jamorham/nightscout-vps.git # Clone the instal cd nightscout-vps # Main #cd cgm-remote-monitor # Navid's sudo git checkout vps-1 # Main -#sudo git checkout Navid_2022_10_26Test # Navid's +#sudo git checkout VerifyVM_Test # Navid's sudo git pull sudo chmod 755 *.sh # Change premissions to allow execution by all. sudo mv -f *.sh /xDrip/scripts # Overwrite the scripts in the scripts directory with the new ones. @@ -26,7 +26,7 @@ cd .. sudo rm -r nightscout-vps # Delete the temporary pull directory. # Main #sudo rm -r cgm-remote-monitor # Delete the temporary pull directory. # Navid's -dialog --msgbox "In a new, or restored, terminal,\n\ -the updated scripts will be in effect." 7 43 +dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ +Updated scripts will be in effect in a new window." 8 43 clear From bfa0d7fba8d0dbb20e539daa198ec48c7325a837 Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:49:34 -0500 Subject: [PATCH 4/8] Update bootstrap.sh --- bootstrap.sh | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index d5e5238e0a0..bdde28efbb3 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -8,23 +8,20 @@ echo "Bootstrapping the menu - Navid200" echo sudo apt-get update +sudo apt-get install dialog +ubversion="$(cat /etc/issue | awk '{print $2}')" +if [[ ! "$ubversion" = "20.04"* ]] +then +clear +dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ +The Ubuntu version on the virtual machine is incorrect. You need to delete the virtual machine and create a new one. Please refer to the guide for the details." 10 50 +exit +fi + sudo apt-get -y install wget bash -sudo apt-get -y install dialog sudo apt-get install -y git python gcc g++ make sudo apt-get -y install netcat -clear -dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ -Shortly after you proceed, the server will\n\ -automatically reboot and an expected error\n\ -message will appear.\n\ -Please wait 30 seconds before clicking on\n\ -"Retry" to reconnect.\n\n\ -After this, every time you open a terminal,\n\ -a menu will offer all the available options.\n\n\ -To proceed, press Enter." 17 48 -clear - cd / if [ ! -s xDrip ] then @@ -38,8 +35,8 @@ fi cd /tmp sudo rm update_scripts.sh -#wget https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/VerifyVM_Test/update_scripts.sh # Navid's -wget https://raw.githubusercontent.com/jamorham/nightscout-vps/vps-1/update_scripts.sh # Main +wget https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/VerifyVM_Test/update_scripts.sh # Navid's +#wget https://raw.githubusercontent.com/jamorham/nightscout-vps/vps-1/update_scripts.sh # Main if [ ! -s update_scripts.sh ] then echo "UNABLE TO DOWNLOAD update_scripts SCRIPT! - cannot continue - please try again!" @@ -50,6 +47,11 @@ sudo chmod 755 update_scripts.sh sudo mv -f update_scripts.sh /xDrip/scripts # Updating the scripts +cat > /tmp/nodialog_update_scripts << EOF +Don't show dialog + +EOF + sudo /xDrip/scripts/update_scripts.sh # So that the menu comes up as soon as the user logs in (opens a terminal) @@ -71,8 +73,14 @@ alias menu="/xDrip/scripts/menu.sh" EOF fi -source ~/.bashrc +clear +dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ +If any item is shown in red on the status page (shown next), it represents an incorrect parameter that could result in malfunction or cost. \ +Please take a note, delete the virtual machine, and create a new one. For more detail, please refer to the guide." 12 50 + # Bring up the status page /xDrip/scripts/Status.sh +dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ +Press enter to restart the server. This will result in an expected error message. Wait 30 seconds before clicking on retry to reconnect." 10 50 sudo reboot From ac36e3fe9c08b97014d41704c80a5a0f16df955f Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:50:44 -0500 Subject: [PATCH 5/8] Update update_scripts.sh --- update_scripts.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/update_scripts.sh b/update_scripts.sh index d5edfb80e3b..96ef5933bb5 100644 --- a/update_scripts.sh +++ b/update_scripts.sh @@ -6,27 +6,30 @@ echo cd /tmp -if [ -s ./nightscout-vps ] # Main -#if [ -s ./cgm-remote-monitor ] # Navid's +#if [ -s ./nightscout-vps ] # Main +if [ -s ./cgm-remote-monitor ] # Navid's then -sudo rm -r nightscout-vps # If the directory already exists in the tmp directory, delete it. Main -#sudo rm -r cgm-remote-monitor # If the directory already exists in the tmp directory, delete it. Navid's +#sudo rm -r nightscout-vps # If the directory already exists in the tmp directory, delete it. Main +sudo rm -r cgm-remote-monitor # If the directory already exists in the tmp directory, delete it. Navid's fi -sudo git clone https://github.com/jamorham/nightscout-vps.git # Clone the install repository. Main -#sudo git clone https://github.com/Navid200/cgm-remote-monitor.git # Clone the install repository. Navid's -cd nightscout-vps # Main -#cd cgm-remote-monitor # Navid's -sudo git checkout vps-1 # Main -#sudo git checkout VerifyVM_Test # Navid's +#sudo git clone https://github.com/jamorham/nightscout-vps.git # Clone the install repository. Main +sudo git clone https://github.com/Navid200/cgm-remote-monitor.git # Clone the install repository. Navid's +#cd nightscout-vps # Main +cd cgm-remote-monitor # Navid's +#sudo git checkout vps-1 # Main +sudo git checkout VerifyVM_Test # Navid's sudo git pull sudo chmod 755 *.sh # Change premissions to allow execution by all. sudo mv -f *.sh /xDrip/scripts # Overwrite the scripts in the scripts directory with the new ones. cd .. -sudo rm -r nightscout-vps # Delete the temporary pull directory. # Main -#sudo rm -r cgm-remote-monitor # Delete the temporary pull directory. # Navid's +#sudo rm -r nightscout-vps # Delete the temporary pull directory. # Main +sudo rm -r cgm-remote-monitor # Delete the temporary pull directory. # Navid's +if [ ! -s /tmp/nodialog_update_scripts ] +then dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\ Updated scripts will be in effect in a new window." 8 43 clear +fi From 151b1e30b75e9e10633ceb4c764bc3f36937bf4a Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:52:40 -0500 Subject: [PATCH 6/8] Update update_scripts.sh --- update_scripts.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/update_scripts.sh b/update_scripts.sh index 96ef5933bb5..546cb8fff35 100644 --- a/update_scripts.sh +++ b/update_scripts.sh @@ -6,25 +6,25 @@ echo cd /tmp -#if [ -s ./nightscout-vps ] # Main -if [ -s ./cgm-remote-monitor ] # Navid's +if [ -s ./nightscout-vps ] # Main +#if [ -s ./cgm-remote-monitor ] # Navid's then -#sudo rm -r nightscout-vps # If the directory already exists in the tmp directory, delete it. Main -sudo rm -r cgm-remote-monitor # If the directory already exists in the tmp directory, delete it. Navid's +sudo rm -r nightscout-vps # If the directory already exists in the tmp directory, delete it. Main +#sudo rm -r cgm-remote-monitor # If the directory already exists in the tmp directory, delete it. Navid's fi -#sudo git clone https://github.com/jamorham/nightscout-vps.git # Clone the install repository. Main -sudo git clone https://github.com/Navid200/cgm-remote-monitor.git # Clone the install repository. Navid's -#cd nightscout-vps # Main -cd cgm-remote-monitor # Navid's +sudo git clone https://github.com/jamorham/nightscout-vps.git # Clone the install repository. Main +#sudo git clone https://github.com/Navid200/cgm-remote-monitor.git # Clone the install repository. Navid's +cd nightscout-vps # Main +#cd cgm-remote-monitor # Navid's #sudo git checkout vps-1 # Main sudo git checkout VerifyVM_Test # Navid's sudo git pull sudo chmod 755 *.sh # Change premissions to allow execution by all. sudo mv -f *.sh /xDrip/scripts # Overwrite the scripts in the scripts directory with the new ones. cd .. -#sudo rm -r nightscout-vps # Delete the temporary pull directory. # Main -sudo rm -r cgm-remote-monitor # Delete the temporary pull directory. # Navid's +sudo rm -r nightscout-vps # Delete the temporary pull directory. # Main +#sudo rm -r cgm-remote-monitor # Delete the temporary pull directory. # Navid's if [ ! -s /tmp/nodialog_update_scripts ] then From 2f69d999c9bbe7b411e0587025b5dd8ee38472b3 Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:53:29 -0500 Subject: [PATCH 7/8] Update bootstrap.sh --- bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index bdde28efbb3..fef6fd40a01 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -35,8 +35,8 @@ fi cd /tmp sudo rm update_scripts.sh -wget https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/VerifyVM_Test/update_scripts.sh # Navid's -#wget https://raw.githubusercontent.com/jamorham/nightscout-vps/vps-1/update_scripts.sh # Main +#wget https://raw.githubusercontent.com/Navid200/cgm-remote-monitor/VerifyVM_Test/update_scripts.sh # Navid's +wget https://raw.githubusercontent.com/jamorham/nightscout-vps/vps-1/update_scripts.sh # Main if [ ! -s update_scripts.sh ] then echo "UNABLE TO DOWNLOAD update_scripts SCRIPT! - cannot continue - please try again!" From b068ea056dd30b0fde64e29e70abaa29f1f04103 Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:59:13 -0500 Subject: [PATCH 8/8] Update update_scripts.sh --- update_scripts.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update_scripts.sh b/update_scripts.sh index 546cb8fff35..e08db40ee90 100644 --- a/update_scripts.sh +++ b/update_scripts.sh @@ -17,8 +17,8 @@ sudo git clone https://github.com/jamorham/nightscout-vps.git # Clone the instal #sudo git clone https://github.com/Navid200/cgm-remote-monitor.git # Clone the install repository. Navid's cd nightscout-vps # Main #cd cgm-remote-monitor # Navid's -#sudo git checkout vps-1 # Main -sudo git checkout VerifyVM_Test # Navid's +sudo git checkout vps-1 # Main +#sudo git checkout VerifyVM_Test # Navid's sudo git pull sudo chmod 755 *.sh # Change premissions to allow execution by all. sudo mv -f *.sh /xDrip/scripts # Overwrite the scripts in the scripts directory with the new ones.