-
Notifications
You must be signed in to change notification settings - Fork 8
/
sabayondevkit-functions.sh
88 lines (76 loc) · 2.56 KB
/
sabayondevkit-functions.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
set -e
export BUILD_DIR="${BUILD_DIR:-/opt/sabayon-build/}"
check_docker_requirements(){
if [ "$(id -u)" != "0" ]; then
groups | grep -q docker || echo "--> If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker)"
fi
ps aux | grep -q '[d]ocker' || echo "--> Be sure to have the docker daemon running (sudo systemctl start docker) or configure it to run on boot (sudo systemctl enable docker). Trying to start it anyway" && systemctl start docker || true
}
die() { echo "$@" 1>&2 ; exit 1; }
build_sync() {
layman -S
emerge --sync
eix-update
pushd "${BUILD_DIR}"
git stash
git fetch --all || true
git checkout master || true
git reset --hard origin/master || true
popd
}
build_category() {
local SEARCH=$1
build_sync
for i in $(EIX_LIMIT=0 eix --only-names --pure-packages "$SEARCH/" | xargs echo | uniq);
do
echo "Building $i"
emerge ${EMERGE_DEFAULT_ARGS:---accept-properties=-interactive --verbose --oneshot --nospinner --noreplace --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg} $i || true
done
}
build_obsolete() {
build_sync
for i in $(EIX_LIMIT=0 eix-test-obsolete | grep '\[U\]' | awk '{ print $2 }' | xargs echo | uniq);
do
echo "Build $i"
emerge ${EMERGE_DEFAULT_ARGS:---accept-properties=-interactive -u --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg --noreplace} $i || true
done
}
build_category_installed() {
local SEARCH=$1
build_sync
for i in $(EIX_LIMIT=0 eix -I --only-names --pure-packages "$SEARCH/" | xargs echo | uniq);
do
echo "Building $i"
emerge ${EMERGE_DEFAULT_ARGS:---accept-properties=-interactive -u --newuse --noreplace --changed-use --update --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg} $i || true
done
}
build_all_availables() {
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
do
build_category "$i/"
done
}
rebuild_all() {
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
do
build_category_installed "$i/"
done
}
get_category() {
local CATEGORY=$1
local PACKS
for i in $(EIX_LIMIT=0 eix --only-names --pure-packages "$CATEGORY/" | xargs echo | uniq);
do
PACKS+="$i "
done
echo $PACKS
}
get_all_availables() {
local RES
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
do
RES+="$(get_category $i) "
done
echo $RES
}