diff options
author | Clément Bénier <clement.benier@iot.bzh> | 2018-10-01 11:51:47 +0200 |
---|---|---|
committer | Clément Bénier <clement.benier@iot.bzh> | 2018-10-01 11:57:48 +0200 |
commit | 2e17a524738982174794370a2bb609872608a5ac (patch) | |
tree | 91eda98e97032493cf614a8a35a262500c916d99 /scripts/package-update/getXdsServerPackage | |
parent | 95293a7ee22cfff9c49a19bd7ae205529d812fa9 (diff) |
update xds-server package in dockersandbox/benierc/xds-server-update-pkg
scripts/package-update: bash scripts to update xds-server package in docker
monitor updates: default time is 24h, a update is tried at startup
api/v1: 2 new requests:
- get(updates): return various information about xds-server packages
- post(updates): update xds-server packages
Change-Id: I34613be916bb29c2cce13ca1cce1e384365872f7
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Diffstat (limited to 'scripts/package-update/getXdsServerPackage')
-rwxr-xr-x | scripts/package-update/getXdsServerPackage | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/package-update/getXdsServerPackage b/scripts/package-update/getXdsServerPackage new file mode 100755 index 0000000..e54d09e --- /dev/null +++ b/scripts/package-update/getXdsServerPackage @@ -0,0 +1,31 @@ +#!/bin/bash + +XDSSERVER="xds-server" +PACKAGE_NAME="agl-${XDSSERVER}" + +#test if sudoers with NOPASSWD +sudo -l | grep NOPASSWD &> /dev/null +if [ ! $? -eq 0 ]; then + exit 1 +fi + +function getUpdateDebian() { + local policy="/tmp/policy" + sudo apt-get update &> /dev/null + apt-cache policy ${PACKAGE_NAME} > ${policy} + cat $policy | grep "Installed" + cat $policy | grep "Candidate" + rm -f $policy +} + +if [ -f /etc/os-release ]; then + source /etc/os-release +fi + +case $ID in + "debian") + getUpdateDebian;; + *) + exit 1;; +esac + |