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" |
12 |
NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" |
#NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" |
13 |
NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" |
#NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" |
14 |
|
NEW_RSYNC="rsync://128.20.41.110/mage-alx-060" |
15 |
|
NEW_MIRRORS="http://128.20.41.110/magellan/alx-060" |
16 |
NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' |
NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' |
17 |
NEW_MAGE_UNINSTALL_TIMEOUT=0 |
NEW_MAGE_UNINSTALL_TIMEOUT=0 |
18 |
|
|
19 |
CONFIGRC="/etc/alxconfig-ng/config.rc" |
CONFIGRC="/etc/alxconfig-ng/config.rc" |
20 |
NEW_ALX_NETWORKING="dhcp" |
NEW_ALX_NETWORKING="dhcp" |
21 |
NEW_ALX_DHCP_PROG="/sbin/udhcpc" |
NEW_ALX_DHCP_PROG="/sbin/dhcpc" |
22 |
NEW_ALX_DHCP_START="-T 10 -t 5 -n -i" |
NEW_ALX_DHCP_START="-t 10" |
23 |
NEW_ALX_DHCP_STOP="" |
NEW_ALX_DHCP_STOP="-k" |
24 |
NEW_MIN_DISK_SPACE="85000" |
NEW_MIN_DISK_SPACE="85000" |
25 |
NEW_ALX_PLUGINS="/usr/lib/alxconfig-ng/plugins" |
NEW_ALX_PLUGINS="/usr/lib/alxconfig-ng/plugins" |
26 |
NEW_ALX_FUNCTIONS="/usr/lib/alxconfig-ng/functions" |
NEW_ALX_FUNCTIONS="/usr/lib/alxconfig-ng/functions" |
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 |
152 |
CONFIG="${CONFIGRC}" |
CONFIG="${CONFIGRC}" |
153 |
updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE ALX_PLUGINS ALX_FUNCTIONS |
updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE ALX_PLUGINS ALX_FUNCTIONS |
154 |
|
|
155 |
|
# fix eth0 config too |
156 |
|
CONFIG="/etc/conf.d/net.eth0" |
157 |
|
eval "NEW_DHCP_START=\"${NEW_ALX_DHCP_START}\"" # eval this twice |
158 |
|
eval "NEW_DHCP_START=\"${NEW_DHCP_START}\"" # to remove the \\ escapes |
159 |
|
updateconfig DHCP_START |
160 |
|
|
161 |
# fix profile |
# fix profile |
162 |
if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] |
if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] |
163 |
then |
then |
173 |
[[ -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root |
[[ -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root |
174 |
fi |
fi |
175 |
|
|
176 |
|
check_mbr_size || exit 1 |
177 |
|
|
178 |
# update mage3 -> mage4 |
# update mage3 -> mage4 |
179 |
if [[ -z $(magequery -n mage) ]] |
if [[ -z $(magequery -n mage) ]] |
180 |
then |
then |
295 |
|
|
296 |
if [[ -f /.dist-upgrade ]] |
if [[ -f /.dist-upgrade ]] |
297 |
then |
then |
298 |
|
# busybox gets installed before the new busybox initscripts |
299 |
|
# and the syslog daemon gets started at the wrong runlevels (rc3.d instead of rc.sysinit) |
300 |
|
# these runlevel symlinks will be deleted by the prune-orphaned-files script |
301 |
|
# and syslogd will be left never started. so add syslogd here |
302 |
|
rc-config add syslogd |
303 |
|
|
304 |
# array of wireless opts |
# array of wireless opts |
305 |
WIRELESS_OPTS=( WIRELESS_BITRATE WIRELESS_CHANNEL WIRELESS_ESSID WIRELESS_FREQUENCY WIRELESS_MODE WIRELESS_NICK WIRELESS_AUTH_MODE WIRELESS_KEY_LENGTH WIRELESS_KEY WIRELESS_KEY_ASCII WIRELESS_WPA_DRIVER ) |
WIRELESS_OPTS=( WIRELESS_BITRATE WIRELESS_CHANNEL WIRELESS_ESSID WIRELESS_FREQUENCY WIRELESS_MODE WIRELESS_NICK WIRELESS_AUTH_MODE WIRELESS_KEY_LENGTH WIRELESS_KEY WIRELESS_KEY_ASCII WIRELESS_WPA_DRIVER ) |
306 |
|
|
340 |
# install an appropriate uvesafb.conf |
# install an appropriate uvesafb.conf |
341 |
install -d /etc/modprobe.d || die |
install -d /etc/modprobe.d || die |
342 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die |
343 |
|
# install an appropriate viafb.conf |
344 |
|
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > /etc/modprobe.d/viafb.conf || die |
345 |
|
# install an appropriate i810fb.conf |
346 |
|
echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" > /etc/modprobe.d/i810fb.conf || die |
347 |
# create an updated initrd |
# create an updated initrd |
348 |
DISKMODS="sd_mod" |
DISKMODS="sd_mod" |
349 |
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
350 |
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
351 |
SATAMODS="sata_via sata_sis sata_nv" |
SATAMODS="sata_via sata_sis sata_nv" |
352 |
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
353 |
FBMODS="uvesafb" |
if [ -x /usr/sbin/alx-hwdetection ] |
354 |
|
then |
355 |
|
case $(/usr/sbin/alx-hwdetection system) in |
356 |
|
zotac) FBMODS="" ;; |
357 |
|
rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards |
358 |
|
maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb framebuffer |
359 |
|
standard) FBMODS="uvesafb" ;; |
360 |
|
# unknown, use nothing to be safe |
361 |
|
*) FBMODS="" ;; |
362 |
|
esac |
363 |
|
else |
364 |
|
# unknown, use nothing to be safe |
365 |
|
FBMODS="" |
366 |
|
fi |
367 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
368 |
kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::') |
kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::') |
369 |
|
# run depmod before |
370 |
|
depmod -aF /boot/System.map-${kernelver} |
371 |
mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver} |
mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver} |
372 |
# update grub bootloader |
# update grub bootloader |
373 |
updategrub2 |
updategrub2 |
375 |
|
|
376 |
if [[ -f /.dist-upgrade ]] |
if [[ -f /.dist-upgrade ]] |
377 |
then |
then |
378 |
echo "preparing a reboot in 60 seconds ..." |
if [[ ${NOREBOOT} != 1 ]] |
379 |
# reboot via cronjob |
then |
380 |
[[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs |
echo "preparing for a reboot in 60 seconds ..." |
381 |
# setup a proper cronjob |
# reboot via cronjob |
382 |
tmp=$(mktemp) |
[[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs |
383 |
echo "* * * * * crontab -r && reboot -f" > ${tmp} |
# setup a proper cronjob |
384 |
crontab ${tmp} |
tmp=$(mktemp) |
385 |
[[ -f ${tmp} ]] && rm -f ${tmp} |
:> ${tmp} |
386 |
# start cron daemon in background |
# fake mageupgrade to fix annoying error messages |
387 |
crond -b -S |
if [[ ! -x /sbin/mageupgrade ]] |
388 |
|
then |
389 |
|
echo '#!/bin/sh' > /sbin/mageupgrade |
390 |
|
echo 'exit 0' >> /sbin/mageupgrade |
391 |
|
chmod +x /sbin/mageupgrade |
392 |
|
echo "* * * * * rm /sbin/mageupgrade" >> ${tmp} |
393 |
|
fi |
394 |
|
echo "* * * * * crontab -r && reboot -f" >> ${tmp} |
395 |
|
crontab ${tmp} |
396 |
|
[[ -f ${tmp} ]] && rm -f ${tmp} |
397 |
|
# start cron daemon in background |
398 |
|
crond -b -S |
399 |
|
fi |
400 |
|
|
401 |
rm -f /.dist-upgrade |
rm -f /.dist-upgrade |
402 |
fi |
fi |