blob: 79fb4246c9e8ecd9f9c76952bdcfc2a98b3d1203 (
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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#!/usr/bin/env bash
delmainporttree () {
einfo "I am removing Gentoo ebuild tree"
if [ -d ""$jailmainportpath"/.git" ] ; then
find "$jailmainportpath" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1
fi
}
deladdonporttree () {
einfo "I am removing Redcore ebuild tree"
if [ -d ""$jailaddonportpath"/.git" ] ; then
find "$jailaddonportpath" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1
fi
}
delportcfgtree () {
einfo "I am removing portage configuration"
rm ""$jailportcfgtarget"/make.conf" > /dev/null 2>&1
rm ""$jailportcfgtarget"/make.profile" > /dev/null 2>&1
rm "$jailportcfgtarget" > /dev/null 2>&1
rm -rf "$jailportvcspath" > /dev/null 2>&1
}
resetmode () {
checkifroot
delmainporttree
deladdonporttree
delportcfgtree
}
getmainportsrctree () {
if [ ! -d ""$jailmainportpath"/.git" ] ; then
einfo "I am injecting Gentoo ebuild tree"
cd "$jailmainportpath" && git init > /dev/null 2>&1
git remote add origin https://pagure.io/redcore/portage.git
git pull --depth=1 origin master
git branch -u origin/master master
rm -rf ""$jailmainportpath"/profiles/updates"
fi
}
getmainportbintree () {
if [ ! -d ""$jailmainportpath"/.git" ] ; then
einfo "I am injecting Gentoo ebuild tree"
cd "$jailmainportpath" && git init > /dev/null 2>&1
git remote add origin https://pagure.io/redcore/portage.git
git config core.sparsecheckout true
echo "profiles/*" >> .git/info/sparse-checkout
echo "metadata/*" >> .git/info/sparse-checkout
echo "eclass/*" >> .git/info/sparse-checkout
git pull --depth=1 origin master
git branch -u origin/master master
rm -rf ""$gentooportdir"/profiles/updates"
fi
}
getaddonportsrctree () {
if [ ! -d ""$jailaddonportpath"/.git" ] ; then
einfo "I am injecting Redcore ebuild tree"
cd "$jailaddonportpath" && git init > /dev/null 2>&1
git remote add origin https://pagure.io/redcore/redcore-desktop.git
git pull --depth=1 origin master
git branch -u origin/master master
fi
}
getaddonportbintree () {
if [ ! -d ""$jailaddonportpath"/.git" ] ; then
einfo "I am injecting Redcore ebuild tree"
cd "$jailaddonportpath" && git init > /dev/null 2>&1
git remote add origin https://pagure.io/redcore/redcore-desktop.git
git config core.sparsecheckout true
echo "profiles/*" >> .git/info/sparse-checkout
echo "metadata/*" >> .git/info/sparse-checkout
echo "eclass/*" >> .git/info/sparse-checkout
git pull --depth=1 origin master
git branch -u origin/master master
fi
}
getportcfgtree () {
pushd /opt > /dev/null 2>&1
einfo "I am injecting portage configuration"
git clone https://pagure.io/redcore/redcore-build.git
popd > /dev/null 2>&1
}
getsrctree () {
getmainportsrctree
getaddonportsrctree
getportcfgtree
}
getbintree () {
getmainportbintree
getaddonportbintree
getportcfgtree
}
setmakeconf () {
ln -sf "$jailportcfgsource" "$jailportcfgtarget"
ln -sf "$jailportcfgtarget"/make.conf.amd64-generic "$jailportcfgtarget"/make.conf
}
setmakeopts () {
einfo "I am setting portage to use $(getconf _NPROCESSORS_ONLN) jobs to compile packages"
# default MAKEOPTS value is -j64, but that's overkill for lower spec machines
# this will adjust MAKEOPTS to a value detected by $(getconf _NPROCESSORS_ONLN)
sed -i "s/\-j64/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/global.conf/makeopts.conf # global makeopts (exclude kernel)
sed -i "s/\-j64/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/env/makenoise.conf # kernel makeopts
}
setprofile () {
eselect profile set default/linux/amd64/17.0/hardened
env-update
. /etc/profile
}
setbinmode () {
resetmode
getbintree
setmakeconf
setmakeopts
setprofile
}
setsrcmode () {
resetmode
getsrctree
setmakeconf
setmakeopts
setprofiles
}
|