File: 99-cleanup

package info (click to toggle)
python-diskimage-builder 3.39.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,704 kB
  • sloc: sh: 7,474; python: 6,454; makefile: 37
file content (52 lines) | stat: -rwxr-xr-x 1,400 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash

if [[ ${DIB_DEBUG_TRACE:-0} -gt 0 ]]; then
    set -x
fi
set -eu
set -o pipefail

if mountpoint -q /dev/shm; then
    echo "/dev/shm found in /proc/self/mountinfo"
elif [[ -k /dev/shm ]]; then
    echo "/dev/shm exists and is stickied"
else
    fix_shm
fi

# sync if needed
[[ ! -e ${PORTDIR}/profiles ]] && emerge-webrsync

# make world consistent
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --update --changed-use --deep @world
# rebuild packages that might need it
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild
# remove unneeded packages
emerge --verbose=n --depclean
# rebuild packages that might have somehow depended on the unneeded packages
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild

# update config files
etc-update --automode -5

# clean up portage files
emerge --verbose=n --depclean
emaint all -f
eselect news read all

if [[ "${GENTOO_PORTAGE_CLEANUP}" != "False" ]]; then
    # remove the overlays
    if [[ ${GENTOO_OVERLAYS} != '' ]]; then
        for OVERLAY in ${GENTOO_OVERLAYS}; do
            layman -d "${OVERLAY}"
        done
    fi
fi

unfix_shm

# remove within the chroot since /var/run is a symlink
rm -Rf /var/run/* /run/*

# after updating, set profile to where PORTDIR actually is (varies by profile)
ln -sf ../.."$(env -u PORTDIR portageq get_repo_path / gentoo)/profiles/${GENTOO_PROFILE}" /etc/portage/make.profile