update-gentoo

#500
Raw
Author
winny
Created
June 8, 2022, 1:51 a.m.
Expires
Never
Size
1.3 KB
Hits
134
Syntax
Bash
Private
✗ No
#!/usr/bin/env bash
#
# How to use:
# 1. run `update-gentoo sync upgrade'
# 2. run `update-gentoo upgrade' if the upgrade did not complete, repeate ad infinitum
# 3. reboot and ensure everything works
# 4. run `update-gentoo rebooted' to clean up the system.
#
# note, you sohuld probably run `eix-test-obsolete' to verify all packages are referenced
# by an ebuild in a repository.  If not you will not be able to redeploy this particular
# package set elsewhere.

set -eu -o pipefail


for phase in "$@"; do
    case "$phase" in
        sync)
            emerge --sync
            ;;
        upgrade|update)
            emerge --ask \
                   --update \
                   --deep \
                   --changed-use \
                   --changed-deps \
                   @world
            dispatch-conf
            emerge --ask \
                   --exclude=sys-kernel/vanilla-kernel \
                   --depclean
            emerge -a \
                   --usepkg=n --getbinpkg=n \
                   --exclude=sys-kernel/vanilla-kernel \
                   @preserved-rebuild @module-rebuild
            ;;
        clean|rebooted)
            emerge -ac
            eclean-kernel -n 2
            eclean-dist -t 4m
            eclean-pkg -t 4m --changed-deps
    esac
done