1 |
On Friday, September 24, 2010 12:01:21 Joakim Tjernlund wrote: |
2 |
> - make crossdev respect PORTAGE_CONFIGROOT. We use our own portage |
3 |
> tree for our pkgs, including the compiler, as we want to be able |
4 |
> to recreate/rebuild the same sw versions in the future. |
5 |
|
6 |
try this: |
7 |
diff --git a/crossdev b/crossdev |
8 |
index c35a2ed..a782d19 100755 |
9 |
--- a/crossdev |
10 |
+++ b/crossdev |
11 |
@@ -12,6 +12,8 @@ if [[ ${ROOT:-/} != "/" ]] ; then |
12 |
exit 2 |
13 |
fi |
14 |
|
15 |
+CONFIGROOT="${PORTAGE_CONFIGROOT}/etc/portage" |
16 |
+ |
17 |
source /etc/init.d/functions.sh || exit 1 |
18 |
esyslog() { :; } |
19 |
die() { |
20 |
@@ -265,9 +267,9 @@ uninstall() { |
21 |
|
22 |
[[ -d ${PORTDIR_OVERLAY}/cross-${CTARGET} ]] \ |
23 |
&& rm -r ${PORTDIR_OVERLAY}/cross-${CTARGET} |
24 |
- sed -i -e "/^cross-${CTARGET}$/d" /etc/portage/categories |
25 |
+ sed -i -e "/^cross-${CTARGET}$/d" "${CONFIGROOT}"/categories |
26 |
for f in package.{mask,keywords,use} ; do |
27 |
- f="/etc/portage/${f}" |
28 |
+ f="${CONFIGROOT}/${f}" |
29 |
if [[ -d ${f} ]] ; then |
30 |
rm -f "${f}"/cross-${CTARGET} |
31 |
rmdir "${f}" 2>/dev/null |
32 |
@@ -275,8 +277,8 @@ uninstall() { |
33 |
sed -i -e "/cross-${CTARGET}\//d" "${f}" |
34 |
fi |
35 |
done |
36 |
- rm -rf /etc/portage/env/cross-${CTARGET} |
37 |
- rmdir /etc/portage/env 2>/dev/null |
38 |
+ rm -rf "${CONFIGROOT}"/env/cross-${CTARGET} |
39 |
+ rmdir "${CONFIGROOT}"/env 2>/dev/null |
40 |
|
41 |
rmdir /var/db/pkg/cross-${CTARGET} 2>/dev/null |
42 |
if [[ -d /var/db/pkg/cross-${CTARGET} ]] ; then |
43 |
@@ -461,14 +463,15 @@ fi |
44 |
|
45 |
# grab user settings |
46 |
for v in ABI UCLIBC_CPU USE BVER GVER KVER LVER STAGE CFLAGS LDFLAGS ASFLAGS |
47 |
; do |
48 |
- if [[ -e /etc/portage/crossdev/${CTARGET}/${v} ]] ; then |
49 |
+ d="${CONFIGROOT}/crossdev/${CTARGET}" |
50 |
+ if [[ -e ${d}/${v} ]] ; then |
51 |
# yes, quotes are needed in this instance (export $var="...") |
52 |
- export ${v}="$(</etc/portage/crossdev/${CTARGET}/${v})" |
53 |
+ export ${v}="$(<"${d}"/${v})" |
54 |
einfo "Restoring user setting '${v}' to '${!v}'" |
55 |
fi |
56 |
- if [[ -e /etc/portage/crossdev/${CTARGET}/env ]] ; then |
57 |
+ if [[ -e ${d}/env ]] ; then |
58 |
einfo "Restoring generic user env settings" |
59 |
- source /etc/portage/crossdev/${CTARGET}/env |
60 |
+ source "${d}"/env |
61 |
fi |
62 |
done |
63 |
|
64 |
@@ -509,6 +512,7 @@ einfo "Extra: insight: DO IT" |
65 |
echo |
66 |
einfo "PORTDIR_OVERLAY: ${PORTDIR_OVERLAY}" |
67 |
einfo "PORT_LOGDIR: ${PORT_LOGDIR}" |
68 |
+einfo "PORTAGE_CONFIGROOT: ${PORTAGE_CONFIGROOT}" |
69 |
hr |
70 |
) >& "${PORT_LOGDIR}"/cross-${CTARGET}-info.log || exit 1 |
71 |
cat "${PORT_LOGDIR}"/cross-${CTARGET}-info.log |
72 |
@@ -616,15 +620,15 @@ set_portage() { |
73 |
set_env ${pkg} "${env}" |
74 |
} |
75 |
|
76 |
-mkdir -p /etc/portage |
77 |
-check_trailing_newline /etc/portage/categories |
78 |
-grep -qs "^cross-${CTARGET}$" /etc/portage/categories \ |
79 |
- || echo cross-${CTARGET} >> /etc/portage/categories |
80 |
-mkdir -p "${PORTDIR_OVERLAY}"/cross-${CTARGET} |
81 |
-cd /etc/portage |
82 |
+mkdir -p "${CONFIGROOT}" |
83 |
+check_trailing_newline "${CONFIGROOT}"/categories |
84 |
+grep -qs "^cross-${CTARGET}$" "${CONFIGROOT}"/categories \ |
85 |
+ || echo cross-${CTARGET} >> "${CONFIGROOT}"/categories |
86 |
+mkdir -p "${PORTDIR_OVERLAY}"/cross-${CTARGET} || exit 1 |
87 |
+cd "${CONFIGROOT}" |
88 |
for f in package.{keywords,mask,use} ; do |
89 |
[[ -f ${f} ]] && continue |
90 |
- mkdir -p ${f} |
91 |
+ mkdir -p ${f} || exit 1 |
92 |
rm -f ${f}/cross-${CTARGET} |
93 |
done |
94 |
|
95 |
-mike |