summaryrefslogtreecommitdiff
path: root/sys-apps/personal-utils/files/emergefix
blob: 84dde62b3107667c9e61b7fd2b7ff811eefe60e9 (plain)
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
#!/bin/sh
set -e

step() {
	echo -e '\e[1;34m==========' "$@" '==========\e[0m'
}

run() {
	"$@" || {
		echo -ne "\e[1;31mContinue?\e[0m "
		read
	}
}

#################################################################################

if [ "$(equery -q l -p sys-apps/portage | grep -vE sys-apps/portage-9999 | sort -Vr | head -1)" != "$(equery -q l sys-apps/portage)" ]; then
	step "Update portage"
	run emerge -1 sys-apps/portage
fi

step "Update packages"
run emerge -auDU --with-bdeps=y --keep-going @world "$@"

step "Rebuil packages"
run revdep-rebuild -- "$@"

step "Rebuild preserved ones"
run emerge --keep-going=y @preserved-rebuild

step "Clean packages"
run emerge --depclean -a "$@"

step "Clean distfiles"
run eclean distfiles

if eselect modules has fontconfig; then
	step "Enable all fonts"
	enable_all_fonts() {
		eselect fontconfig list | \
			awk 'NR > 1 && $3 != "*" { print substr($1,2,length($1)-2) }' | \
			while read -r font; do
				eselect fontconfig enable "$font"
			done
	}
	enable_all_fonts
fi