Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:akselmo
abuild-online-update
suse.de-abuild-online-update
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File suse.de-abuild-online-update of Package abuild-online-update
#!/bin/bash # General update script for (open)SUSE hosts # Author: Lars Vogdt # BSD4 License # # $Id$ # PATH=/bin:/usr/bin:/sbin:/usr/sbin umask 027 DISTCONFIG="/etc/sysconfig/abuild-online-update" ################################################## # Default/Fallback values # Don't change them here! Use $DISCONFIG instead ################################################## START_UPDATE="yes" LOGFILE="/var/log/systemupdate" EMAIL="root@localhost" ################################################## LOGDIR=$(dirname "$LOGFILE") LOGNAME="abuild-online-update" HOST=$(hostname -s) FQHOSTNAME=$(hostname -f) function cleanup_and_exit(){ test -n "$TMPFILE" -a -f "$TMPFILE" && rm "$TMPFILE" test -n "$LOG" -a -f "$LOG" && rm "$LOG" find /tmp -maxdepth 1 -name "zypp-online-update1-*" -size 0 -type f -user root -delete 2>/dev/null find /var/tmp/ -maxdepth 1 -type d -name "TmpDir.*" -user nagios -exec rm -rf {} \; 2>/dev/null find /var/tmp/ -maxdepth 1 -type d -name "zypp.*" -user nagios -exec rm -rf {} \; 2>/dev/null exit $1 } trap cleanup_and_exit 0 1 2 3 7 13 15 function LOG(){ local MESSAGE="$1" local LOG_DATE=$(date "+%b %d %H:%M:%S") if [ -z "$LOGFILE" ]; then echo "ERROR: LOGFILE is not defined" | $MAILX -s "[$LOGNAME] error on $FQHOSTNAME" $EMAIL cleanup_and_exit 1 fi if [ ! -d "$LOGDIR" ]; then mkdir -p "$LOGDIR" || exit 1 echo "$LOG_DATE $HOST $LOGNAME[$$]: function LOG created $LOGDIR" > "$LOGFILE" fi echo "$LOG_DATE $HOST $LOGNAME[$$]: $MESSAGE" >> $LOGFILE if [ "$DEBUG" = "yes" ]; then echo "DEBUG: $MESSAGE" fi } # source our config if [ -f "$DISTCONFIG" ]; then . "$DISTCONFIG" else echo "$DISTCONFIG not found - using defaults" >&2 LOG "$DISTCONFIG not found - using defaults" fi case "$START_UPDATE" in [yY]*) TMPFILE=$(mktemp /tmp/zypp-online-update1-XXXXXX) LOG=$(mktemp /tmp/zypp-online-update2-XXXXXX) HAS_OPT=`zypper patch --help 2> /dev/null | grep optional` if test -n "$HAS_OPT" ; then ZYPP_CALL="zypper --non-interactive --terse patch --no-confirm --skip-interactive --with-optional" else ZYPP_CALL="zypper --non-interactive --terse up --no-confirm -t patch --skip-interactive" fi if [ -x /usr/bin/zypper ]; then # SLES10 SP2 $ZYPP_CALL 2>"$TMPFILE" 1>/dev/null grep -v ^Restoring "$TMPFILE" | grep -v ^Loading | grep -v ^Parsing | grep -v ^Summary: | grep -v ^Nothing > "$LOG" elif [ -x /usr/bin/online_update ]; then # old SLES9 host # looks like SLES 9 has no option to skip interactive patches # so normally, we run only a check and don't install anything. # If you like to change this, remove the "--dry-run" option. online_update --check --dry-run >&2 >"$TMPFILE" grep -v "^No updates" "$TMPFILE" > "$LOG" else LOG "Binary for installing updates not found" echo "Binary for installing updates not found" >&2 cleanup_and_exit 1 fi LOG "Starting online-update" if [ -s "$LOG" ]; then cat "$LOG" >> "$LOGFILE" else LOG "Finished - no updates" fi cleanup_and_exit 0 ;; *) cleanup_and_exit 0 ;; esac cleanup_and_exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor