1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Id$ |
# $Id$ |
3 |
|
|
4 |
|
# setup exit trap for reboot |
5 |
|
trap_exit() |
6 |
|
{ |
7 |
|
if [[ -f /.dist-upgrade ]] |
8 |
|
then |
9 |
|
rm -f /.dist-upgrade |
10 |
|
# force a reboot at this point here |
11 |
|
( sleep 3 && reboot -f & ); exit 0 |
12 |
|
fi |
13 |
|
} |
14 |
|
trap "trap_exit" EXIT |
15 |
|
|
16 |
|
# get a suitable environment |
17 |
|
source /etc/profile |
18 |
|
|
19 |
|
MAGERC="/etc/mage.rc" |
20 |
|
MAGEPROFILE="alx-060" |
21 |
|
NEW_MAGE_DISTRIBUTION="unstable" |
22 |
|
NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" |
23 |
|
NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" |
24 |
|
NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' |
25 |
|
NEW_MAGE_UNINSTALL_TIMEOUT=0 |
26 |
|
|
27 |
|
CONFIGRC="/etc/alxconfig-ng/config.rc" |
28 |
|
NEW_ALX_NETWORKING="dhcp" |
29 |
|
NEW_ALX_DHCP_PROG="/sbin/udhcpc" |
30 |
|
NEW_ALX_DHCP_START="-T 10" |
31 |
|
NEW_ALX_DHCP_STOP="" |
32 |
|
|
33 |
read_value() |
read_value() |
34 |
{ |
{ |
35 |
local file=$1 |
local file=$1 |
43 |
return 0 |
return 0 |
44 |
} |
} |
45 |
|
|
46 |
MAGERC="/etc/mage.rc" |
updateconfig() |
47 |
MAGEPROFILE="alx-060" |
{ |
48 |
NEW_MAGE_DISTRIBUTION="unstable" |
local variables="$@" |
49 |
NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" |
local value |
50 |
NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" |
local i |
|
NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' |
|
|
NEW_MAGE_UNINSTALL_TIMEOUT=0 |
|
51 |
|
|
52 |
# fix mage.rc |
if [[ -z ${CONFIG} ]] |
|
for i in RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT |
|
|
do |
|
|
value="$(eval echo \${NEW_${i}})" |
|
|
if [[ ! -z $(grep "^${i}=" ${MAGERC}) ]] |
|
53 |
then |
then |
54 |
echo "fixing $i -> ${value}" |
echo "You must define \$CONFIG varibale first!" |
55 |
sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${MAGERC} |
return 1 |
|
else |
|
|
echo "adding $i=${value}" |
|
|
echo "${i}=\"${value}\"" >> ${MAGERC} |
|
56 |
fi |
fi |
57 |
done |
|
58 |
|
for i in ${variables} |
59 |
|
do |
60 |
|
value="$(eval echo \${NEW_${i}})" |
61 |
|
if [[ ! -z $(grep "^${i}=" ${CONFIG}) ]] |
62 |
|
then |
63 |
|
echo "fixing ${i} -> ${value}" |
64 |
|
sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${CONFIG} |
65 |
|
else |
66 |
|
echo "adding ${i}=${value}" |
67 |
|
echo "${i}=\"${value}\"" >> ${CONFIG} |
68 |
|
fi |
69 |
|
done |
70 |
|
} |
71 |
|
|
72 |
|
# fix mage.rc |
73 |
|
CONFIG="${MAGERC}" |
74 |
|
updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT |
75 |
|
|
76 |
|
# fix config.rc |
77 |
|
CONFIG="${CONFIGRC}" |
78 |
|
updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP |
79 |
|
|
80 |
# fix profile |
# fix profile |
81 |
if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] |
if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] |
166 |
do |
do |
167 |
# excludes |
# excludes |
168 |
case ${i} in |
case ${i} in |
169 |
|
alxconfig-ng) continue ;; |
170 |
|
alxinstall-ng) continue ;; |
171 |
kernel-alx) continue ;; |
kernel-alx) continue ;; |
172 |
kernel26-alx) continue ;; |
kernel26-alx) continue ;; |
173 |
kernel-sources-alx) continue ;; |
kernel-sources-alx) continue ;; |
178 |
mage uninstall ${i} |
mage uninstall ${i} |
179 |
done |
done |
180 |
|
|
|
if [[ -f /.orphaned ]] |
|
|
then |
|
|
echo "Searching for orphaned files and directories ..." |
|
|
bash /etc/mage-profile/prune-orphaned-files |
|
|
rm -f /.orphaned |
|
|
fi |
|
|
|
|
181 |
if [[ -f /.dist-upgrade ]] |
if [[ -f /.dist-upgrade ]] |
182 |
then |
then |
183 |
# array of wireless opts |
# array of wireless opts |
208 |
done |
done |
209 |
rm -f ${i}.orig |
rm -f ${i}.orig |
210 |
done |
done |
211 |
|
# search modules files |
212 |
|
for i in $(find /etc/modules.d -name net.\*) |
213 |
|
do |
214 |
|
install -d /etc/modprobe.d |
215 |
|
mv ${i} /etc/modprobe.d/${i%.conf}.conf |
216 |
|
done |
217 |
fi |
fi |
218 |
|
|
219 |
if [[ -f /.dist-upgrade ]] |
if [[ -f /.orphaned ]] |
220 |
then |
then |
221 |
rm -f /.dist-upgrade |
echo "Searching for orphaned files and directories ..." |
222 |
# force a reboot at this point here |
bash /etc/mage-profile/prune-orphaned-files |
223 |
reboot -f |
rm -f /.orphaned |
224 |
fi |
fi |
225 |
|
|
226 |
|
#if [[ -f /.dist-upgrade ]] |
227 |
|
#then |
228 |
|
# rm -f /.dist-upgrade |
229 |
|
# # force a reboot at this point here |
230 |
|
# ( reboot -f & ); exit 0 |
231 |
|
#fi |