Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Script to keep a Gentoo system fully up-to-date and clean.
- # See http://pastebin.com/sAHz1FqH for oldlib-check.
- # Author: Marijn van Zon <marijn@suninet.org>
- function show_usage {
- echo "Usage: gentoo-update [options]"
- echo
- echo -e "\t--sync\t\tforce sync of portage tree"
- echo -e "\t--no-sync\tdo not sync portage tree"
- echo
- exit
- }
- sync=-1
- for i in $(seq 1 ${#}); do
- eval param="\${${i}}"
- case "${param}" in
- "--sync") sync=1 ;;
- "--no-sync") sync=0 ;;
- *) show_usage ;;
- esac
- done
- if [[ $sync -lt 0 ]]; then
- lastsync=$(grep 'Sync completed' /var/log/emerge.log |sed -n '$ s/:.*//p')
- current=$(date +%s)
- let diff="$current - $lastsync"
- if [[ $diff -lt 86400 ]]; then
- echo
- echo -n "Skipping sync, last sync was: "
- date -R -d @$lastsync
- sync=0
- else
- sync=1
- fi
- fi
- if [[ $sync -eq 1 ]]; then
- sync="eix-sync -v"
- else
- sync="echo -n"
- fi
- $sync && \
- emerge -uvDNa --with-bdeps=y @world && \
- etc-update && \
- emerge -ca && \
- /usr/local/sbin/oldlib-check && \
- revdep-rebuild && \
- eclean-dist --destructive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement