Skip to content

Instantly share code, notes, and snippets.

@dpiessens
Last active July 14, 2016 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpiessens/e4b55c13a87e9738aaf5bd7eda51daf6 to your computer and use it in GitHub Desktop.
Save dpiessens/e4b55c13a87e9738aaf5bd7eda51daf6 to your computer and use it in GitHub Desktop.
OpenAPS Update Script
#!/bin/bash
sudo apt-get update
sudo apt-get install -y git python python-dev python-software-properties python-numpy python-pip nodejs-legacy npm watchdog libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev python-dbus && \
( curl -s https://bootstrap.pypa.io/ez_setup.py | sudo python ) && \
sudo npm install -g json && \
sudo easy_install -ZU setuptools && \
mkdir ~/src && \
git config --global user.name "Dan Piessens"
git config --global user.email "dan.piessens@gmail.com"
git config --global credential.helper store
cd ~/src && \
(
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.40.tar.xz && \
tar xf bluez-5.40.tar.xz && \
rm bluez-5.40.tar.xz && \
cd bluez-5.40 && \
./configure --disable-systemd && \
make && \
sudo make install && \
sudo cp ./src/bluetoothd /usr/local/bin/
)
test -d ~/update-openaps.sh || wget https://gist.githubusercontent.com/dpiessens/e4b55c13a87e9738aaf5bd7eda51daf6/raw/update-openaps.sh && \
bash ~/update-openaps.sh && \
sudo echo ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="8001", MODE="0664", GROUP="plugdev", SYMLINK+="mmeowlink" > /etc/udev/rules.d/90-mmeowlink.rules && \
sudo chmod 777 /dev/mmeowlink && \
sudo openaps-install-udev-rules && \
sudo activate-global-python-argcomplete && \
openaps --version
#!/bin/bash
# link = $1, dir = $2, branch = $3
function update_code {
echo Checking $2
local updated=0
if test -d $2; then
cd $2
local currentBranch=`git symbolic-ref --short HEAD`
if [ "$currentBranch" != "$3" ]; then
git checkout $3
fi
git fetch > /dev/null
local updateCount=`git rev-list HEAD...origin/$3 --count`
if [ $updateCount -gt 0 ]; then
echo Updating $2
git pull
updated=1
fi
else
echo Cloning $2
git clone -b $3 $1 $2
cd $2
updated=1
fi
# Build if updated
if [ "$updated" -eq "1" ] && [ -e setup.py ]; then
echo Rebuilding $2
sudo python setup.py develop
fi
echo Done
cd ..
return $updated
}
cd ~/src && \
(
update_code https://github.com/bewest/decoding-carelink.git decoding-carelink dev
update_code https://github.com/openaps/dexcom_reader.git dexcom_reader dev
update_code https://github.com/bewest/Adafruit_Python_BluefruitLE.git Adafruit_Python_BluefruitLE "wip/bewest/custom-gatt-profile"
update_code https://github.com/dpiessens/openxshareble.git openxshareble master
update_code https://github.com/oskarpearson/mmeowlink.git mmeowlink-source master
if [ $? -eq 1 ]; then
echo Rebuilding mmewolink-source
cd mmeowlink-source && \
git checkout master && \
sudo pip install -e . && \
cd ..
fi
update_code https://github.com/openaps/openaps.git openaps dev
update_code https://github.com/openaps/openaps-contrib.git openaps-contrib master
update_code https://github.com/openaps/oref0.git oref0 dev
if [ $? -eq 1 ]; then
echo rebuilding oref0
cd oref0 && \
npm install && \
sudo npm install -g && \
sudo npm link && \
sudo npm link oref0 && \
cd ..
fi
update_code https://github.com/openaps/oacids.git oacids master
if [ $? -eq 1 ]; then
echo Compiling service for oacids
cd oacids && \
./configure && make && sudo make install && \
cd ..
fi
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment