diff options
Diffstat (limited to 'scripts/package-update')
-rwxr-xr-x | scripts/package-update/getXdsServerPackage | 31 | ||||
-rwxr-xr-x | scripts/package-update/restartXdsServer | 15 | ||||
-rwxr-xr-x | scripts/package-update/updateXdsServerPackage | 31 |
3 files changed, 77 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 + diff --git a/scripts/package-update/restartXdsServer b/scripts/package-update/restartXdsServer new file mode 100755 index 0000000..40dfee9 --- /dev/null +++ b/scripts/package-update/restartXdsServer @@ -0,0 +1,15 @@ +#!/bin/bash + +XDSSERVER="xds-server" + +function systemdRestartXdsServer() { + systemctl --user daemon-reload + systemctl --user restart ${XDSSERVER} + if [ ! $? -eq 0 ]; then + echo "Cannot restart $XDSSERVER" + exit 1 + fi +} + +systemdRestartXdsServer +exit 0
\ No newline at end of file diff --git a/scripts/package-update/updateXdsServerPackage b/scripts/package-update/updateXdsServerPackage new file mode 100755 index 0000000..4f638b8 --- /dev/null +++ b/scripts/package-update/updateXdsServerPackage @@ -0,0 +1,31 @@ +#!/bin/bash + +XDSSERVER="xds-server" +PACKAGE_NAME="agl-${XDSSERVER}" + +#test if sudoers with NOPASSWD +sudo -l | grep NOPASSWD +if [ ! $? -eq 0 ]; then + exit 1 +fi + + +function checkUpdateDebian() { + sudo apt-get update + apt list --upgradable | grep ${PACKAGE_NAME} + if [ $? -eq 0 ]; then + sudo apt-get install ${PACKAGE_NAME} + fi +} + +if [ -f /etc/os-release ]; then + source /etc/os-release +fi + +case $ID in + "debian") + res=$(checkUpdateDebian);; + *) + exit 1;; +esac + |