Created
June 18, 2018 16:36
-
-
Save ilyaevseev/06fc25a8017e3a87dae248c2a07af9e3 to your computer and use it in GitHub Desktop.
Check, install, update OTRS package under CentOS 7. Requires lftp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
FPATH="$(lftp -e 'cls -q -1 -D --sort=date /pub/otrs/RPMS/rhel/7/otrs*.noarch.rpm; exit' http://ftp.otrs.org/ 2>&1 | tail -1)" | |
LATEST="${FPATH##*/}" #" | |
LATEST="${LATEST%.rpm}" | |
CURRENT="$(rpm -q otrs)" | |
case "$1" in | |
install|reinstall ) yum "$1" "http://ftp.otrs.org/$FPATH" ;; | |
geturl ) echo "http://ftp.otrs.org/$FPATH" ;; | |
update ) test "$LATEST" = "$CURRENT" && true || yum install "http://ftp.otrs.org/$FPATH" ;; | |
zbxcheck ) test "$LATEST" = "$CURRENT" && echo 0 || echo 1 ;; | |
* ) test "$LATEST" = "$CURRENT" && echo "$CURRENT is actual." || echo "$CURRENT can be updated to $LATEST" ;; | |
esac | |
## END ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment