View previous topic :: View next topic |
Author |
Message |
dinominant Tux's lil' helper
Joined: 27 Oct 2006 Posts: 102
|
Posted: Sat Jun 18, 2016 5:31 am Post subject: Gentoo Update Script |
|
|
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 |
Last edited by dinominant on Sun Nov 06, 2016 10:01 pm; edited 1 time in total |
|
Back to top |
|
|
jonathan183 Guru
Joined: 13 Dec 2011 Posts: 318
|
Posted: Sat Jun 18, 2016 12:10 pm Post subject: |
|
|
Thanks for sharing ... I tend to keep news items so would use Code: | eselect news count new |
|
|
Back to top |
|
|
frankenputer n00b
Joined: 09 Mar 2016 Posts: 26
|
Posted: Fri Jul 08, 2016 1:51 pm Post subject: |
|
|
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 |
|
|
Ordinateur91 n00b
Joined: 25 Oct 2016 Posts: 15
|
Posted: Mon Oct 31, 2016 10:39 am Post subject: |
|
|
Thanks for sharing:) |
|
Back to top |
|
|
|