1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Id$ |
# $Id$ |
3 |
|
|
4 |
|
MAGERC="/etc/mage.rc" |
5 |
|
MAGEPROFILE="alx-060" |
6 |
|
NEW_MAGE_DISTRIBUTION="unstable" |
7 |
|
NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" |
8 |
|
NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" |
9 |
|
NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' |
10 |
|
NEW_MAGE_UNINSTALL_TIMEOUT=0 |
11 |
|
|
12 |
|
CONFIGRC="/etc/alxconfig-ng/config.rc" |
13 |
|
NEW_ALX_NETWORKING="dhcp" |
14 |
|
NEW_ALX_DHCP_PROG="/sbin/udhcpc" |
15 |
|
NEW_ALX_DHCP_START="-t 10" |
16 |
|
NEW_ALX_DHCP_STOP="" |
17 |
|
|
18 |
read_value() |
read_value() |
19 |
{ |
{ |
20 |
local file=$1 |
local file=$1 |
28 |
return 0 |
return 0 |
29 |
} |
} |
30 |
|
|
31 |
MAGERC="/etc/mage.rc" |
updateconfig() |
32 |
MAGEPROFILE="alx-060" |
{ |
33 |
NEW_MAGE_DISTRIBUTION="unstable" |
local variables="$@" |
34 |
NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" |
local value |
35 |
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 |
|
36 |
|
|
37 |
# 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}) ]] |
|
38 |
then |
then |
39 |
echo "fixing $i -> ${value}" |
echo "You must define \$CONFIG varibale first!" |
40 |
sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${MAGERC} |
return 1 |
|
else |
|
|
echo "adding $i=${value}" |
|
|
echo "${i}=\"${value}\"" >> ${MAGERC} |
|
41 |
fi |
fi |
42 |
done |
|
43 |
|
for i in ${variables} |
44 |
|
do |
45 |
|
value="$(eval echo \${NEW_${i}})" |
46 |
|
if [[ ! -z $(grep "^${i}=" ${CONFIG}) ]] |
47 |
|
then |
48 |
|
echo "fixing ${i} -> ${value}" |
49 |
|
sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${CONFIG} |
50 |
|
else |
51 |
|
echo "adding ${i}=${value}" |
52 |
|
echo "${i}=\"${value}\"" >> ${CONFIG} |
53 |
|
fi |
54 |
|
done |
55 |
|
} |
56 |
|
|
57 |
|
# fix mage.rc |
58 |
|
CONFIG="${MAGERC}" |
59 |
|
updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT |
60 |
|
|
61 |
|
# fix config.rc |
62 |
|
CONFIG="${CONFIGRC}" |
63 |
|
updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP |
64 |
|
|
65 |
# fix profile |
# fix profile |
66 |
if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] |
if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] |