All pastes #717441 Raw Edit

Unnamed

public shellscript v1 · immutable
#717441 ·published 2007-09-27 17:07 UTC
rendered paste body
#!/bin/env bash# Files in /usr/portage/distfiles that have not been useful since DISTFILES_MAX_AGE days will be deletedDISTFILES_MAX_AGE="7"# Recipient of system-software-update-report-mails ;) (can be any valid mail address)MAIL_TO="warpsychosis@free.fr"# The text you would like to see as the mail's subjectMAIL_SUBJECT="Weekly system software update report for $(hostname -f) and the week of $(date '+%B %d')"# If you want the list of packages to be encased in lines set this to '0', otherwise to your favorite numberSHOW_SPLITTERS=-1# In case you want to see all the USE flags this is '0' for you, otherwise any numberSHOW_USE_FLAGS=-1(echo -e "From: Localhost\n"echo -e "To: $MAIL_TO\n"echo -e "Subject: $MAIL_SUBJECT\n"echo -e "Body:\n"echo -e "This is the pretend-system-update script on $(hostname -f); $(date).\n"echo -n "Updating portage tree ... "emerge --sync &> /dev/null && echo "done" || echo "failed"cd /usr/portage/distfilesecho -n "Trashing out-dated distfiles ... $(du -sch dummy_file $(find -atime +${DISTFILES_MAX_AGE} -print | grep -vx ".") 2>&1 | tail -n 1 | sed -r 's/\s*total//g') to be deleted ... "find -atime +${DISTFILES_MAX_AGE} -delete && echo "done" || echo "failed"echo -e "\nThe script does _not_ install any packages; it just informs about available updates:"test ${SHOW_SPLITTERS} -eq 0 && echo -e "=======================================================================\n" || echotest ${SHOW_USE_FLAGS} -eq 0 && emerge -pvuDNq world || emerge -puDNq world; SUCCESS=$?test ${SHOW_SPLITTERS} -eq 0 && echo -e "\n======================================================================="if [ ${SUCCESS} -eq 0 ]; then	echo -e "\nTo install these package updates just type 'emerge -uDN world'.\n\n" else	echo -e "\nI'm sorry, something went wrong while calculating dependencies; propably some required packages are masked. You'll have to fix it manually. Please see http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3#doc_chap2 if you don't yet know how to handle this.\n\n"fiecho "Love & Kisses - Your pretend-system-update script") | nbsmtp