Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo Update Script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
dinominant
Tux's lil' helper
Tux's lil' helper


Joined: 27 Oct 2006
Posts: 77

PostPosted: Sat Jun 18, 2016 5:31 am    Post subject: Gentoo Update Script Reply with quote

I've written a script which I use to automatically update my Gentoo systems. I thought it was time to publish it and see if anybody else will find it useful: https://github.com/nathanshearer/gentooupdate

Some of the key features I find most useful are:
  • E-Mail Notifications for successful updates, failures, and auditing
  • The ability to abort an update if there is unread news
  • Comprehensive updates with the preservedrebuild, depclean, and revdeprebuild phases

To install the script, copy it to /usr/bin and add this to /etc/cron.daily (don't forget to make it executable):
Code:
#!/bin/bash
/usr/bin/gentooupdate &


A config file can optionally be added at /etc/gentooupdate.conf to e-mail you details of the update:
Code:
EMAIL_ERROR="mail@example.com"
EMAIL_LOG="logs@example.com"


Example Output
Code:
Synopsis
  Automatically update Gentoo Linux in phases:
    sync
    update
    preservedrebuild
    depclean
    revdeprebuild

Usage:
  gentooupdate [options]

Options:
  -a true
    Abort if there is unread news or if emerge is already running.
  -d "--depclean"
    The arguments passed to emerge during the depclean phase.
  -e ""
    The arguments passed to revdep-rebuild during the revdeprebuild phase.
  -h
    Display this help message and exit.
  -n N
    Sets the niceness to N (default 0).
  -r "@preserved-rebuild"
    The arguments passed to emerge during the preservedrebuild phase.
  -s "--sync"
    The arguments passed to emerge during the sync phase.
  -u "-uDN --with-bdeps=y world"
    The arguments passed to emerge during the update phase.

Examples:
  gentooupdate -a false
  gentooupdate -n 20 -u "-uDN --with-bdeps=y --keep-going world"

Version:
  Gentoo Update 1.1.1.0
  Copyright (C) 2015 Nathan Shearer
  Licensed under GNU General Public License 2.0


Example E-Mail Message:
Code:
This update was aborted because there is unread news:

News items:
  [1]      2016-01-08  Some dhcpcd hooks are now examples
  [2]      2016-04-02  KDE Plasma 5 Upgrade
  [3]      2016-04-24  Changes in default VIDEO_CARDS
  [4]   N  2016-06-19  L10N USE_EXPAND variable replacing LINGUAS

_________________
BTC: 18wdrw8sLtruvdwr5kB3RxbbxzjDeXUpRh
LTC: LYynwaSeBLb4gHaMnkB7NQ27H6wF3Fjyxo


Last edited by dinominant on Sun Nov 06, 2016 10:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
jonathan183
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 271

PostPosted: Sat Jun 18, 2016 12:10 pm    Post subject: Reply with quote

Thanks for sharing 8) ... I tend to keep news items so would use
Code:
eselect news count new
Back to top
View user's profile Send private message
frankenputer
n00b
n00b


Joined: 09 Mar 2016
Posts: 26

PostPosted: Fri Jul 08, 2016 1:51 pm    Post subject: Reply with quote

Spice it up with ebegin/eend and einfo functions.

Code:
source '/lib/gentoo/functions.sh'

__emerge() { sudo emerge "$@" ;}

rebuild() { __emerge --ask --update --deep --newuse --with-bdeps=y '@world' ;}

update() {
    einfo 'Running sync'
    __emerge --sync

    einfo 'Running emaint'
    sudo emaint --fix cleanresume

    einfo 'Running portage update'
    __emerge --oneshot --update portage

    einfo 'Running system update'
    rebuild

    einfo 'Running metadata regeneration'
    __emerge --regen --quiet

    sudo cp -r /var/cache/eix/{portage.eix,previous.eix}
    einfo 'Running eix update'
    sudo eix-update
    eix-diff

    einfo 'Running external kernel modules rebuild'
    __emerge '@module-rebuild'

    einfo 'Running preserved libs rebuild'
    preserved-rebuild

    einfo 'Running Reverse Dep. Rebuilder'
    revdep
;}

preserved-rebuild() { __emerge '@preserved-rebuild' ;}

revdep() { sudo revdep-rebuild ;}
Back to top
View user's profile Send private message
Ordinateur91
n00b
n00b


Joined: 25 Oct 2016
Posts: 15

PostPosted: Mon Oct 31, 2016 10:39 am    Post subject: Reply with quote

Thanks for sharing:)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum