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 16 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
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
80 changes: 51 additions & 29 deletions bin/oref0-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,18 @@ function copy_go_binaries () {

function move_mmtune () {
request_stop_local_binary Go-mmtune
if [ -f /usr/local/bin/mmtune ]; then
mv /usr/local/bin/mmtune /usr/local/bin/Go-mmtune || die "Couldn't move mmtune to Go-mmtune"
if [ -f /root/go/bin/mmtune ]; then
ln -s /root/go/bin/mmtune /usr/local/bin/Go-mmtune
else
die "Couldn't move_mmtune() because /usr/local/bin/mmtune exists"
echo "Couldn't move_mmtune()"
fi
}

function install_or_upgrade_nodejs () {
# install/upgrade to latest node 8 if neither node 8 nor node 10+ LTS are installed
if ! nodejs --version | grep -e 'v8\.' -e 'v1[02468]\.' >/dev/null; then
echo Installing node 8
# Use nodesource setup script to add nodesource repository to sources.list.d
sudo bash -c "curl -sL https://deb.nodesource.com/setup_8.x | bash -" || die "Couldn't setup node 8"
# Install nodejs and npm from nodesource
sudo apt-get install -y nodejs=8.* || die "Couldn't install nodejs"
function check_nodejs_timing () {
# Redundant check that node is installed
# It is installed as part of openaps-packages.sh
if ! node --version | grep -q -e 'v[89]\.' -e 'v1[[:digit:]]\.'; then
die "No version of node (>=8,<=19) was found, which is an unexpected error (node installation should have been handled by previous installation steps)"
fi

# Check that the nodejs you have installed is not broken. In particular, we're
Expand All @@ -314,17 +311,39 @@ function install_or_upgrade_nodejs () {
echo "Your installed nodejs ($(node --version)) is very slow to start (took ${NODE_EXECUTION_TIME}s)"
echo "This is a known problem with certain versions of Raspberry Pi OS."

if prompt_yn "Install a new nodejs version using nvm?" Y; then
echo "Installing nvm and using it to replace the system-provided nodejs"

# Download nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Run nvm, adding its aliases to this shell
source ~/.nvm/nvm.sh
# Use nvm to install nodejs
nvm install 10.24.1
# Symlink node into /usr/local/bin, where it will shadow /usr/bin/node
ln -s ~/.nvm/versions/node/v10.24.1/bin/node /usr/local/bin/node
if prompt_yn "Confirm installation of replacement nodejs/npm versions?" Y; then
echo "Attempting to uninstall current nodejs/npm versions (apt-get remove)"
sudo apt-get -y remove nodejs npm
if [[ -n $NVM_DIR ]]; then
echo "Removing nvm ($NVM_DIR)..."
echo "(you may wish to optionally remove the nvm-related lines that still exist in ~/.bashrc; this script won't do it for you)"
rm -rf "$NVM_DIR"
fi

# Check that there node and npm are no longer available. If they are, warn the user.
nodePath=$(command -v node)
npmPath=$(command -v npm)
if [[ -e "$nodePath" ]]; then
echo "Note: A 'node' binary (located at '$nodePath') still exists and may interfere with the new installation of node"
fi
if [[ -e "$npmPath" ]]; then
echo "Note: A 'npm' binary (located at '$npmPath') still exists and may interfere with the new installation of npm"
fi

if [[ ! $(command -v n) ]]; then
echo "n already exists on the system, using it to install a new version of node..."
sudo n current
else
echo "Installing n and using it to replace the system-provided nodejs"
echo "Installing node via n..."
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
# Install the latest version of node that is supported on this platform
sudo bash n current
# Delete the local n binary used to boostrap the install
rm n
# Install n globally
sudo npm install -g n
fi

NEW_NODE_EXECUTION_TIME="$(\time --format %e node -e 'true' 2>&1)"
echo "New nodejs took ${NEW_NODE_EXECUTION_TIME}s to start"
Expand Down Expand Up @@ -730,7 +749,7 @@ if prompt_yn "" N; then
echo Running apt-get autoclean
sudo apt-get autoclean

install_or_upgrade_nodejs
check_nodejs_timing

# Attempting to remove git to make install --nogit by default for existing users
echo Removing any existing git in $directory/.git
Expand Down Expand Up @@ -796,11 +815,11 @@ if prompt_yn "" N; then
echo Checking oref0 installation
cd $HOME/src/oref0
if git branch | grep "* master"; then
npm list -g --depth=0 | egrep oref0@0.6.[0] || (echo Installing latest oref0 package && sudo npm install -g oref0)
npm list -g --depth=0 | egrep oref0@0.7.[0] || (echo Installing latest oref0 package && sudo npm install -g oref0)
elif [[ ${npm_option,,} == "force" ]]; then
echo Forcing install of latest oref0 from $HOME/src/oref0/ && cd $HOME/src/oref0/ && npm run global-install
else
npm list -g --depth=0 | egrep oref0@0.6.[1-9] || (echo Installing latest oref0 from $HOME/src/oref0/ && cd $HOME/src/oref0/ && npm run global-install)
npm list -g --depth=0 | egrep oref0@0.7.[1-9] || (echo Installing latest oref0 from $HOME/src/oref0/ && cd $HOME/src/oref0/ && npm run global-install)
fi

cd $directory || die "Can't cd $directory"
Expand Down Expand Up @@ -1191,7 +1210,7 @@ if prompt_yn "" N; then
# Install Golang
mkdir -p $HOME/go
source $HOME/.bash_profile
golangversion=1.12.5
golangversion=1.19.1
if go version | grep go${golangversion}.; then
echo Go already installed
else
Expand All @@ -1200,6 +1219,8 @@ if prompt_yn "" N; then
echo "Installing Golang..."
if uname -m | grep armv; then
cd /tmp && wget -c https://storage.googleapis.com/golang/go${golangversion}.linux-armv6l.tar.gz && tar -C /usr/local -xzvf /tmp/go${golangversion}.linux-armv6l.tar.gz
elif uname -m | grep aarch64; then
cd /tmp && wget -c https://storage.googleapis.com/golang/go${golangversion}.linux-arm64.tar.gz && tar -C /usr/local -xzvf /tmp/go${golangversion}.linux-arm64.tar.gz
elif uname -m | grep i686; then
cd /tmp && wget -c https://dl.google.com/go/go${golangversion}.linux-386.tar.gz && tar -C /usr/local -xzvf /tmp/go${golangversion}.linux-386.tar.gz
fi
Expand All @@ -1213,7 +1234,7 @@ if prompt_yn "" N; then
sed --in-place '/.*GOPATH*/d' $HOME/.bash_profile
echo 'GOPATH=$HOME/go' >> $HOME/.bash_profile
echo 'export GOPATH' >> $HOME/.bash_profile
echo 'PATH=$PATH:/usr/local/go/bin:$GOROOT/bin:$GOPATH/bin' >> $HOME/.bash_profile
echo 'PATH=$PATH:/usr/local/go/bin:$GOROOT/bin:$GOPATH/bin:/root/go/bin/' >> $HOME/.bash_profile
sed --in-place '/.*export PATH*/d' $HOME/.bash_profile
echo 'export PATH' >> $HOME/.bash_profile
fi
Expand Down Expand Up @@ -1246,8 +1267,9 @@ if prompt_yn "" N; then
esac

#Build Go binaries
go get -u -v -tags "$radiotags" github.com/ecc1/medtronic/... || die "Couldn't go get medtronic"
ln -sf $HOME/go/src/github.com/ecc1/medtronic/cmd/pumphistory/openaps.jq $directory/ || die "Couldn't softlink openaps.jq"
#go get -u -v -tags "$radiotags" github.com/ecc1/medtronic/... || die "Couldn't go get medtronic"
go install -v -tags "$radiotags" github.com/ecc1/medtronic/cmd/...@latest || die "Couldn't go get medtronic"
ln -sf /root/go/pkg/mod/github.com/ecc1/[email protected]/cmd/pumphistory/openaps.jq $directory/ || die "Couldn't softlink openaps.jq"
scottleibrand marked this conversation as resolved.
Show resolved Hide resolved
else
#TODO: write validate_ttyport and support non-SPI ports
die "Unsupported ttyport. Exiting."
Expand Down
2 changes: 1 addition & 1 deletion lib/determine-basal/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function convert_bg(value, profile)
{
if (profile.out_units === "mmol/L")
{
return round(value / 18, 1).toFixed(1);
return round(value / 18, 1);
}
else
{
Expand Down