Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.7.2 #1433

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

v0.7.2 #1433

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f35b4ff
Support for Debian Bullseye and aarch64 (Raspberry Pi OS/Bullseye 64 …
dcacklam Jun 19, 2022
7d53991
omit string formating in convert_bg (#1414)
mountrcg Jun 19, 2022
8881c7f
Improved handling of node installation (& miscellaneous improvements)…
ChanceHarrison Sep 10, 2022
2162018
TODO: revert before release; use dev/bin/openaps-packages.sh
scottleibrand Sep 10, 2022
3a730ed
check out the specified branch when cloning
scottleibrand Sep 10, 2022
a8ec51c
use golangversion=1.19.1 and go install to fix #1435
scottleibrand Sep 11, 2022
84f1011
symlink Go-mmtune to point to oref0-mmtune
scottleibrand Sep 18, 2022
151b1ab
Revert "symlink Go-mmtune to point to oref0-mmtune"
scottleibrand Sep 18, 2022
9c20dc6
install mmtune
scottleibrand Sep 18, 2022
e354807
symlink /usr/local/bin/Go-mmtune to point to /root/go/bin/mmtune
scottleibrand Sep 18, 2022
399e3d6
have to go install each medtronic command individually
scottleibrand Sep 18, 2022
fdb2a16
go install puts things in /root/go/bin/
scottleibrand Sep 18, 2022
d08c86f
have to comment out if clause if it has no uncommented contents
scottleibrand Sep 18, 2022
f6ac451
use ... to install all medtronic commands
scottleibrand Sep 18, 2022
4248d68
don't die if Go-mmtune symlink already exists
scottleibrand Sep 18, 2022
12d6024
fix path to openaps.jq
scottleibrand Sep 18, 2022
7c85d32
wget openaps.jq instead of symlinking to the 20210712211734 version
scottleibrand Sep 19, 2022
80493da
fix(lib/iob): Move value checks up to index.js
Oct 22, 2022
abf9c6b
Merge branch 'ChanceHarrison-chance/fix-1436' (#1437) into dev
scottleibrand Dec 9, 2022
1a25d53
Use compression for operations that go to nightscout. (#1443)
tzachi-dar Dec 29, 2022
673dbc6
convert_bg missing in many statements for rT (#1438)
mountrcg Jan 16, 2023
10f9e27
Revert "fix(lib/iob): Move value checks up to index.js"
scottleibrand Mar 5, 2023
9ac3910
wait upto45s and try preflight; if successful, refresh pumphistory, e…
scottleibrand Aug 20, 2023
bc37601
0.7.1
scottleibrand Jun 19, 2022
8cae7b3
fix missing declaration
hpeuscher Sep 14, 2023
9585e5a
Fixed NS perms checking
inventor96 Mar 25, 2024
c0578dc
Removed duplicate line
inventor96 Mar 25, 2024
edf8bf6
Fixed NS perms checking
inventor96 Mar 25, 2024
2595eca
Removed duplicate line
inventor96 Mar 25, 2024
9b57b06
Revert scope promotion
inventor96 Mar 26, 2024
3430f6b
rT.reason missing colons (:)
Jon-b-m Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/ns-upload-entries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi

# requires API_SECRET and NIGHTSCOUT_HOST to be set in calling environment (i.e. in crontab)
(
curl -m 30 -s -X POST --data-binary @${ENTRIES} \
curl --compressed -m 30 -s -X POST --data-binary @${ENTRIES} \
${API_SECRET_HEADER} -H "content-type: application/json" \
${REST_ENDPOINT}
) && ( test -n "${OUTPUT}" && touch ${OUTPUT} ; logger "Uploaded ${ENTRIES} to ${NIGHTSCOUT_HOST}" ) || logger "Unable to upload to ${NIGHTSCOUT_HOST}"
Expand Down
4 changes: 2 additions & 2 deletions bin/ns-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ fi
if [[ "${API_SECRET,,}" =~ "token=" ]]; then
REST_ENDPOINT="${REST_ENDPOINT}?${API_SECRET}"
(test "$ENTRIES" != "-" && cat $ENTRIES || cat )| (
curl -m 30 -s -X POST --data-binary @- \
curl --compressed -m 30 -s -X POST --data-binary @- \
-H "content-type: application/json" \
$REST_ENDPOINT
) && ( test -n "$OUTPUT" && touch $OUTPUT ; logger "Uploaded $ENTRIES to $NIGHTSCOUT_HOST" ) || ( logger "Unable to upload to $NIGHTSCOUT_HOST"; exit 2 )
else
(test "$ENTRIES" != "-" && cat $ENTRIES || cat )| (
curl -m 30 -s -X POST --data-binary @- \
curl --compressed -m 30 -s -X POST --data-binary @- \
-H "API-SECRET: $API_SECRET" \
-H "content-type: application/json" \
$REST_ENDPOINT
Expand Down
13 changes: 3 additions & 10 deletions bin/openaps-install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

BRANCH=${1:-master}
BRANCH=${1:-dev}
read -p "Enter your rig's new hostname (this will be your rig's "name" in the future, so make sure to write it down): " -r
myrighostname=$REPLY
echo $myrighostname > /etc/hostname
Expand Down Expand Up @@ -46,16 +46,9 @@ if cat /etc/os-release | grep 'PRETTY_NAME="Debian GNU/Linux 8 (jessie)"' &> /de
echo "Jubilinux 0.2.0, based on Debian Jessie, is no longer receiving security or software updates!"
fi

#Workaround for Jubilinux to install nodejs/npm from nodesource
if getent passwd edison &> /dev/null; then
#Use nodesource setup script to add nodesource repository to sources.list.d
curl -sL https://deb.nodesource.com/setup_8.x | bash -
fi

#dpkg -P nodejs nodejs-dev
# TODO: remove the `-o Acquire::ForceIPv4=true` once Debian's mirrors work reliably over IPv6
apt-get -o Acquire::ForceIPv4=true update && apt-get -o Acquire::ForceIPv4=true -y dist-upgrade && apt-get -o Acquire::ForceIPv4=true -y autoremove
apt-get -o Acquire::ForceIPv4=true update && apt-get -o Acquire::ForceIPv4=true install -y sudo strace tcpdump screen acpid vim python-pip locate ntpdate ntp
apt-get -o Acquire::ForceIPv4=true update && apt-get -o Acquire::ForceIPv4=true install -y sudo strace tcpdump screen acpid vim locate ntpdate ntp
#check if edison user exists before trying to add it to groups

grep "PermitRootLogin yes" /etc/ssh/sshd_config || echo "PermitRootLogin yes" >>/etc/ssh/sshd_config
Expand All @@ -73,7 +66,7 @@ sed -i "s/daily/hourly/g" /etc/logrotate.conf
sed -i "s/#compress/compress/g" /etc/logrotate.conf

curl -s https://raw.githubusercontent.com/openaps/oref0/$BRANCH/bin/openaps-packages.sh | bash -
mkdir -p ~/src; cd ~/src && ls -d oref0 && (cd oref0 && git checkout $BRANCH && git pull) || git clone https://github.com/openaps/oref0.git
mkdir -p ~/src; cd ~/src && ls -d oref0 && (cd oref0 && git checkout $BRANCH && git pull) || git clone https://github.com/openaps/oref0.git -b $BRANCH
echo "Press Enter to run oref0-setup with the current release ($BRANCH branch) of oref0,"
read -p "or press ctrl-c to cancel. " -r
cd && ~/src/oref0/bin/oref0-setup.sh
35 changes: 23 additions & 12 deletions bin/openaps-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4

apt-get install -y sudo
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y git python python-dev software-properties-common python-numpy python-pip watchdog strace tcpdump screen acpid vim locate lm-sensors || die "Couldn't install packages"
## Debian Bullseye (Raspberry Pi OS 64bit, etc) is python3 by default and does not support python2-pip.
if ! cat /etc/os-release | grep bullseye >& /dev/null; then
sudo apt-get install -y git python python-dev software-properties-common python-numpy python-pip watchdog strace tcpdump screen acpid vim locate lm-sensors || die "Couldn't install packages"
else
# Bullseye based OS. Get PIP2 from pypa and pip-install python packages rather than using the py3 ones from apt
# Also, install python-is-python2, to override the distro default of linking python to python3
sudo apt-get install -y git python-is-python2 python-dev-is-python2 software-properties-common watchdog strace tcpdump screen acpid vim locate lm-sensors || die "Couldn't install packages"
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2 || die "Couldn't install pip"
python2 -m pip install numpy || die "Couldn't pip install numpy"
fi

# We require jq >= 1.5 for --slurpfile for merging preferences. Debian Jessie ships with 1.4.
if cat /etc/os-release | grep 'PRETTY_NAME="Debian GNU/Linux 8 (jessie)"' &> /dev/null; then
Expand All @@ -21,18 +30,20 @@ else
sudo apt-get -y install jq || die "Couldn't install jq"
fi

# Install/upgrade to latest version of node (v10) using apt if neither node 8 nor node 10+ LTS are installed
if ! nodejs --version | grep -e 'v8\.' -e 'v1[02468]\.' &> /dev/null ; then
if getent passwd edison; then
# Only on the Edison, use nodesource setup script to add nodesource repository to sources.list.d, then install nodejs (npm is a part of the package)
curl -sL https://deb.nodesource.com/setup_8.x | bash -
sudo apt-get install -y nodejs=8.* || die "Couldn't install nodejs"
else
sudo apt-get install -y nodejs npm || die "Couldn't install nodejs and npm"
fi
# Install node using n if there is not an installed version of node >=8,<=19
# Edge case: This is not likely to work as expected if there *is* a version of node installed, but it is outside of the specified version constraints
if ! node --version | grep -q -e 'v[89]\.' -e 'v1[[:digit:]]\.'; then
echo "Installing node via n..." # For context why we don't install using apt or nvm, see https://github.com/openaps/oref0/pull/1419
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
# Install the latest compatible version of node
sudo bash n current
# Delete the local n binary used to boostrap the install
rm n
# Install n globally
sudo npm install -g n

# Upgrade npm to the latest version using its self-updater
sudo npm install npm@latest -g || die "Couldn't update npm"
# Upgrade to the latest supported version of npm for the current node version
sudo npm upgrade -g npm|| die "Couldn't update npm"

## You may also need development tools to build native addons:
## sudo apt-get install gcc g++ make
Expand Down
4 changes: 2 additions & 2 deletions bin/oref0-cron-every-minute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ if [[ ! -z "$BT_PEB" || ! -z "$BT_MAC" ]]; then
fi
fi

if [[ ! -z "$PUSHOVER_TOKEN" && ! -z "$PUSHOVER_USER" ]]; then
#if [[ ! -z "$PUSHOVER_TOKEN" && ! -z "$PUSHOVER_USER" ]]; then
#oref0-pushover $PUSHOVER_TOKEN $PUSHOVER_USER 2>&1 >> /var/log/openaps/pushover.log &
fi
#fi

# if disk has less than 10MB free, delete something and logrotate
cd /var/log/openaps/ && df . | awk '($4 < 10000) {print $4}' | while read line; do
Expand Down
2 changes: 2 additions & 0 deletions bin/oref0-get-ns-entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,14 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
headers["If-Modified-Since"] = lastDate.toISOString();
}

headers["User-Agent"] = 'openaps';
var uri = nsurl + '/api/v1/entries/sgv.json?count=' + records + tokenAuth;
var options = {
uri: uri
, json: true
, timeout: 90000
, headers: headers
, gzip : true
};

request(options, function(error, res, data) {
Expand Down
9 changes: 7 additions & 2 deletions bin/oref0-pump-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ function fail {
refresh_after_bolus_or_enact
echo "Incomplete oref0-pump-loop (pump suspended) at $(date)"
else
pumphistory_daily_refresh
maybe_mmtune
# wait upto45s and try preflight; if successful, refresh pumphistory, else mmtune
wait_for_silence $upto45s
if try_return preflight; then
pumphistory_daily_refresh
else
maybe_mmtune
fi
echo "If pump and rig are close enough, this error usually self-resolves. Stand by for the next loop."
echo Unsuccessful oref0-pump-loop at $(date)
fi
Expand Down
12 changes: 6 additions & 6 deletions bin/oref0-pushover.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash

source $(dirname $0)/oref0-bash-common-functions.sh || (echo "ERROR: Failed to run oref0-bash-common-functions.sh. Is oref0 correctly installed?"; exit 1)

Expand Down Expand Up @@ -87,7 +87,7 @@ fi
CURL_AUTH='-H api-secret:'${API_SECRET}
fi

if snooze=$(curl -s ${CURL_AUTH} ${URL} | jq '.[] | select(.snooze=="carbsReq") | select(.date>'$(date +%s -d "10 minutes ago")')' | jq -s .[0].date | noquotes | grep -v null); then
if snooze=$(curl --compressed -s ${CURL_AUTH} ${URL} | jq '.[] | select(.snooze=="carbsReq") | select(.date>'$(date +%s -d "10 minutes ago")')' | jq -s .[0].date | noquotes | grep -v null); then
#echo $snooze
#echo date -Is -d @$snooze; echo
touch -d $(date -Is -d @$snooze) monitor/pushover-sent
Expand All @@ -107,7 +107,7 @@ elif [[ $ONLYFOR =~ "insulin" ]] && ! cat $FILE | egrep "maxBolus" > /dev/null;
elif file_is_recent monitor/pushover-sent $SNOOZE; then
echo -n "Last pushover sent less than $SNOOZE minutes ago. "
else
curl -s -F token=$TOKEN -F user=$USER $SOUND_OPTION -F priority=$PRIORITY $PRIORITY_OPTIONS -F "message=$(jq -c "{bg, tick, carbsReq, insulinReq, reason}|del(.[] | nulls)" $FILE) - $(hostname)" https://api.pushover.net/1/messages.json | jq .status| grep 1 >/dev/null && touch monitor/pushover-sent && echo '{"date":'$(epochtime_now)',"device":"openaps://'$(hostname)'","snooze":"carbsReq"}' > /tmp/snooze.json && ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json /tmp/snooze.json >/dev/null && echo "carbsReq pushover sent."
curl ---compressed s -F token=$TOKEN -F user=$USER $SOUND_OPTION -F priority=$PRIORITY $PRIORITY_OPTIONS -F "message=$(jq -c "{bg, tick, carbsReq, insulinReq, reason}|del(.[] | nulls)" $FILE) - $(hostname)" https://api.pushover.net/1/messages.json | jq .status| grep 1 >/dev/null && touch monitor/pushover-sent && echo '{"date":'$(epochtime_now)',"device":"openaps://'$(hostname)'","snooze":"carbsReq"}' > /tmp/snooze.json && ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json /tmp/snooze.json >/dev/null && echo "carbsReq pushover sent."
echo
fi

Expand Down Expand Up @@ -152,7 +152,7 @@ else
touch $GLANCES && touch -r $GLANCES -d '-60 mins' $GLANCES
fi

if snooze=$(curl -s ${CURL_AUTH} ${URL} | jq '.[] | select(.snooze=="glance") | select(.date>'$(date +%s -d "$glanceDelay minutes ago")')' | jq -s .[0].date | noquotes | grep -v null); then
if snooze=$(curl --compressed -s ${CURL_AUTH} ${URL} | jq '.[] | select(.snooze=="glance") | select(.date>'$(date +%s -d "$glanceDelay minutes ago")')' | jq -s .[0].date | noquotes | grep -v null); then
#echo $snooze
#echo date -Is -d @$snooze; echo
touch -d $(date -Is -d @$snooze) $GLANCES
Expand Down Expand Up @@ -195,7 +195,7 @@ else
subtext="$carbsMsg${rate}U/h ${duration}m"

# echo "pushover glance text=${text} subtext=${subtext} delta=${delta} title=${title} battery percent=${battery}"
curl -s -F "token=$TOKEN" -F "user=$USER" -F "text=${text}" -F "subtext=${subtext}" -F "count=$bgNow" -F "percent=${battery}" -F "title=${title}" https://api.pushover.net/1/glances.json | jq .status| grep 1 >/dev/null && echo '{"date":'$(epochtime_now)',"device":"openaps://'$(hostname)'","snooze":"glance"}' > /tmp/snooze.json && ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json /tmp/snooze.json >/dev/null && echo "Glance uploaded and snoozed"
curl --compressed -s -F "token=$TOKEN" -F "user=$USER" -F "text=${text}" -F "subtext=${subtext}" -F "count=$bgNow" -F "percent=${battery}" -F "title=${title}" https://api.pushover.net/1/glances.json | jq .status| grep 1 >/dev/null && echo '{"date":'$(epochtime_now)',"device":"openaps://'$(hostname)'","snooze":"glance"}' > /tmp/snooze.json && ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json /tmp/snooze.json >/dev/null && echo "Glance uploaded and snoozed"
touch $GLANCES
else
echo -n "Pushover glance last updated less than $glanceDelay minutes ago @ "
Expand Down Expand Up @@ -223,7 +223,7 @@ if ! [ -z "$MAKER_KEY" ] && [[ "$MAKER_KEY" != "null" ]] && cat $FILE | egrep "a

echo $values > $ifttt

curl --request POST \
curl --compressed --request POST \
--header 'Content-Type: application/json' \
-d @$ifttt \
https://maker.ifttt.com/trigger/carbs-required/with/key/${key} && touch monitor/ifttt-sent
Expand Down
Loading