blob: 1baa18058f3767fb58569921bc72f0503c51c9bc (
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
#!/bin/bash
TMPDIR="$(portageq envvar PORTAGE_TMPDIR)"
PORTDIR="$(portageq envvar PORTDIR)"
# change to yes if you want to use DISTCC
if portageq envvar FEATURES | grep -q distcc ; then
export USE_DISTCC="yes"
else
export USE_DISTCC="no"
fi
#--- You shouldn't need to chane anything past this line ---
PORTAGE_REQ=">=sys-apps/portage-2.0.51-r9"
GCC_CONFIG_REQ=">=sys-devel/gcc-config-1.3.9"
DISTCC_REQ=">=sys-devel/distcc-2.18.3-r1"
EMUL_GLIBC_REQ=">=app-emulation/emul-linux-x86-glibc-2.3.4.20041102"
LINUX_HEADERS_REQ=">=sys-kernel/linux-headers-2.6.8.1-r3"
# When do we need to emerge sandbox instead of portage?
PORTAGE_NEEDSANDBOX=">sys-apps/portage-2.0.51.19"
SANDBOX_REQ="sys-apps/sandbox"
TMPDIR="${TMPDIR}/2005.0_upgrade"
if ! source /sbin/functions.sh ; then
echo "$0: Failed to source /sbin/functions.sh" >&2
exit 1
fi
mkdir -p ${TMPDIR} &> /dev/null
cd ${TMPDIR}
myDie() {
if [[ -f step5 ]] ; then
eerror "Upgrade failed in stage 6. We were unable to unmerge the"
eerror "emul-linux-x86-glibc package. This is the last step of the upgrade process."
elif [[ -f step4 ]] ; then
eerror "Upgrade failed in stage 5. This is the biggest step of the upgrade"
eerror "process. We were unable to build glibc for your system."
eerror "Try running:"
eerror "FEATURES=-sandbox emerge --oneshot sys-libs/glibc && touch ${TMPDIR}/step5"
elif [[ -f step3 ]] ; then
eerror "Upgrade failed in stage 4. The upgrade script failed to change"
eerror "your /etc/make.profile symlink to the 2005.0 profile. Did"
eerror "you intend to set PORTDIR to something other than ${PORTDIR}"
eerror "in the upgrade script? If so, set it and re-execute the script."
elif [[ -f step2 ]] ; then
eerror "Upgrade failed in stage 3. Your multilib configuration is"
eerror "probably broken, but 64bit applications will work fine while"
eerror "you debug the problem. If you wish to revert to a working"
eerror "2004.3 multilib system, then delete /lib32 and /usr/lib32"
eerror "and re-emerge your emul-* packages. This process might also"
eerror "fix whatever problem prevented the upgrade."
elif [[ -f step1 ]] ; then
eerror "Upgrade failed in stage 2. You still have a fully functional"
eerror "2004.3 system."
elif [[ -f step0 ]] ; then
eerror "Upgrade failed in stage 1. You still have a fully functional"
eerror "2004.3 system."
else
eerror "Upgrade failed updating portage. No changes have been made to"
eerror "your system by the upgrade process."
fi
echo
ewarn "You may safely re-execute this upgrade script after correcting any"
ewarn "any problems to resume the upgrade process."
echo
eerror "Please report the following error and any errors above if you file"
eerror "a bug at http://bugs.gentoo.org"
echo "${@}"
exit 1
}
if [[ ! -f step0 ]]; then
if [[ ( -d /lib32 && ! -L /lib32 ) || ( -d /usr/lib32 && ! -L /usr/lib32 ) ]] ; then
eerror "It looks like you have /lib32 or /usr/lib32 directories already."
eerror "Have you already begun a manual upgrade? If so, pleasse revert your"
eerror "changes and restart the script."
exit 1
fi
if [[ -x /usr/bin/readlink ]] && /usr/bin/readlink /etc/make.profile | grep -q 2005 ; then
eerror "Your /etc/make.profile symlink is not set to the 2004.3 profile. This script"
eerror "expects a 2004.3 environment to start the upgrade. If you have started manually"
eerror "upgrading your system, please revert the changes and start the script again."
exit 1
fi
if [[ "$(gcc -m32 -print-multi-directory)" != "32" ]]; then
eerror "Your compiler does not have multilib support."
eerror "Please emerge gcc with USE=multilib:"
eerror "FEATURES=-sandbox USE=multilib emerge gcc."
exit 1
fi
# Always install portage since current might not be multilib friendly
USE=multilib FEATURES=-sandbox emerge -v --oneshot ${PORTAGE_REQ} || \
myDie "emerge portage failed"
if portageq has_version / ${PORTAGE_NEEDSANDBOX} ; then \
USE=multilib FEATURES=-sandbox emerge -v --oneshot ${SANDBOX_REQ} || \
myDie "emerge sandbox failed"
fi
touch step0
fi
if [[ ! -f step1 ]]; then
if ! portageq has_version / ${GCC_CONFIG_REQ} ; then \
emerge -v --oneshot ${GCC_CONFIG_REQ} || \
myDie "emerge gcc-config failed"
fi
if ! portageq has_version / ${EMUL_GLIBC_REQ} ; then \
emerge -v --oneshot ${EMUL_GLIBC_REQ} || \
myDie "emerge emul-glibc failed"
fi
if [[ "${USE_DISTCC}" == "yes" ]]; then
if ! portageq has_version / ${DISTCC_REQ} ; then \
emerge -v --oneshot ${DISTCC_REQ} || \
myDie "emerge distcc failed"
fi
fi
touch step1
fi
if [[ ! -f step2 ]]; then
portageq has_version / linux26-headers && emerge unmerge linux26-headers
if ! portageq has_version / ${LINUX_HEADERS_REQ} ; then \
emerge -v --oneshot ${LINUX_HEADERS_REQ} || \
myDie "emerge linux headers failed"
fi
if ! [[ -f /etc/env.d/04multilib ]]; then
emerge -v --oneshot baselayout || myDie "emerge baselayout failed"
fi
if ! [[ -f /etc/env.d/04multilib ]]; then
myDie "baselayout did not create /etc/env.d/04multilib as expected."
fi
env-update || myDie "env-update failed"
touch step2
fi
if [[ ! -f step3 ]]; then
[ -L /lib32 ] && rm /lib32 && mkdir /lib32
[ -L /usr/lib32 ] && rm /usr/lib32 && mkdir /usr/lib32
[ -L /usr/X11R6/lib32 ] && rm /usr/X11R6/lib32 && mkdir /usr/X11R6/lib32
cp /emul/linux/x86/{usr/,}lib32/libsandbox.so* /usr/lib32 &> /dev/null
[[ -f /usr/lib32/libsandbox.so ]] || myDie "Failed to copy over 32bit libsandbox."
cp /emul/linux/x86/usr/lib32/libc.so /usr/lib32 || myDie "Failed to copy 32bit libc"
cp /emul/linux/x86/usr/lib32/libpthread.so /usr/lib32 || myDie "Failed to copy 32bit libpthread."
cp /emul/linux/x86/usr/lib32/*crt*.o /usr/lib32 || myDie "Failed to copy 32bit *crt*.o"
[ -d /emul/linux/x86/usr/lib32/nptl ] && mkdir /usr/lib32/nptl
[ -d /emul/linux/x86/usr/lib32/nptl ] && cp /emul/linux/x86/usr/lib32/nptl/libc.so /usr/lib32/nptl
[ -d /emul/linux/x86/usr/lib32/nptl ] && cp /emul/linux/x86/usr/lib32/nptl/libpthread.so /usr/lib32/nptl
env-update || myDie "env-update failed"
touch step3
fi
if [[ ! -f step4 ]]; then
if [[ -L /etc/make.profile ]] ; then
rm /etc/make.profile || myDie "rm of old profile failed"
fi
ln -s ${PORTDIR}/profiles/default-linux/amd64/2005.0 /etc/make.profile || \
myDie "link of new profile failed"
touch step4
fi
if [[ ! -f step5 ]]; then
emerge -v --oneshot glibc || myDie "emerge glibc failed"
touch step5
fi
if [[ ! -f step6 ]] ; then
emerge unmerge emul-linux-x86-glibc || myDie "emerge emul-glibc failed"
touch step6
fi
echo "-------------------------------------------------------------------"
echo "Congratulations, you're almost finished updating to 2005.0. Please"
echo "run 'emerge -upv system' followed by 'emerge -uv system' to finish."
rm -rf ${TMPDIR}
|