4 |
# get a suitable environment |
# get a suitable environment |
5 |
source /etc/profile |
source /etc/profile |
6 |
|
|
7 |
|
PATH="/etc/mage-profile:${PATH}" |
8 |
|
|
9 |
MAGERC="/etc/mage.rc" |
MAGERC="/etc/mage.rc" |
10 |
MAGEPROFILE="alx-060" |
MAGEPROFILE="alx-060" |
11 |
NEW_MAGE_DISTRIBUTION="unstable" |
NEW_MAGE_DISTRIBUTION="unstable" |
95 |
grub-install --no-floppy "${bootdisk}" |
grub-install --no-floppy "${bootdisk}" |
96 |
} |
} |
97 |
|
|
98 |
|
# checks size of the mbr, if we are able to install grub2 |
99 |
|
check_mbr_size() |
100 |
|
{ |
101 |
|
local hdd="$1" |
102 |
|
local geometry_sectors |
103 |
|
local partition_start_sector |
104 |
|
local retval |
105 |
|
|
106 |
|
hdd="$(mount | grep '/dev/' | grep ' / ' | cut -d' ' -f1 | sed 's:\(.*\)[0-9].*:\1:')" |
107 |
|
|
108 |
|
if [[ -z ${hdd} ]] |
109 |
|
then |
110 |
|
echo "check_mbr_size(): No hdd given, aborting" |
111 |
|
return 1 |
112 |
|
fi |
113 |
|
|
114 |
|
# fix permissions |
115 |
|
chmod +x /etc/mage-profile/sfdisk > /dev/null |
116 |
|
|
117 |
|
# default retval is 0 |
118 |
|
retval=0 |
119 |
|
|
120 |
|
# check only if disk size is below 256mb |
121 |
|
if [[ $(sfdisk -s ${hdd}) -lt 257000 ]] |
122 |
|
then |
123 |
|
geometry_sectors=$(sfdisk -g ${hdd} | sed 's:.*,\ \([0-9].*\)\ sectors.*:\1:') |
124 |
|
partition_start_sector=$(sfdisk -d /dev/hda | grep /dev/hda1 | sed -e 's:.*start=\(.*\), size.*:\1:' -e 's:\ ::g') |
125 |
|
|
126 |
|
# check start_sector / geomtry > 1 then everything is fine, else abort setup as grub may not install! |
127 |
|
if [[ $(expr ${partition_start_sector} / ${geometry_sectors}) -gt 1 ]] |
128 |
|
then |
129 |
|
echo "Current partition setup is big enough, to install grub2 mbr to this disk." |
130 |
|
retval=0 |
131 |
|
else |
132 |
|
echo "Warning: Current partition setup to small, cannot install grub2 boot-sector to this disk." |
133 |
|
echo "Maybe this is a *RANGEE* with a flash-disk =<256MB. Please re-install this client." |
134 |
|
echo "Upgrade *not* supported!" |
135 |
|
retval=1 |
136 |
|
killall mage &> /dev/null |
137 |
|
killall update-alx &> /dev/null |
138 |
|
fi |
139 |
|
else |
140 |
|
echo "Current disk is big enough, to install grub2 mbr to this disk." |
141 |
|
retval=0 |
142 |
|
fi |
143 |
|
|
144 |
|
return "${retval}" |
145 |
|
} |
146 |
|
|
147 |
# fix mage.rc |
# fix mage.rc |
148 |
CONFIG="${MAGERC}" |
CONFIG="${MAGERC}" |
149 |
updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT |
updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT |
167 |
[[ -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root |
[[ -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root |
168 |
fi |
fi |
169 |
|
|
170 |
|
check_mbr_size || exit 1 |
171 |
|
|
172 |
# update mage3 -> mage4 |
# update mage3 -> mage4 |
173 |
if [[ -z $(magequery -n mage) ]] |
if [[ -z $(magequery -n mage) ]] |
174 |
then |
then |