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

fail_ask() {
	echo -ne "\e[1;31mContinue?\e[0m "
	read
}

get_perl_version() {
	equery list -F '$version' dev-lang/perl
}

#################################################################################
perl_version="$(get_perl_version)"

echo -e '\e[1;34m========== Update packages ==========\e[0m'
emerge -auDN --with-bdeps=y --keep-going=y @world "$@" || fail_ask

if [ "$(get_perl_version)" != "$perl_version" ]; then
	echo -e '\e[1;34m========== Rebuil perl (cleaner) ==========\e[0m'
	perl-cleaner --all -- -1a --keep-going=y || fail_ask
fi

echo -e '\e[1;34m========== Rebuil packages ==========\e[0m'
revdep-rebuild -- "$@" || fail_ask

echo -e '\e[1;34m========== Rebuild preserved ones ==========\e[0m'
emerge --keep-going=y @preserved-rebuild || fail_ask

echo -e '\e[1;34m========== Clean packages ==========\e[0m'
emerge --depclean -a "$@"