7 |
# Niels Rogalla <niro@magellan-linux.de> |
# Niels Rogalla <niro@magellan-linux.de> |
8 |
# |
# |
9 |
|
|
10 |
# ignore the environment |
# setup locales |
11 |
LC_ALL=C |
TEXTDOMAIN=installer |
12 |
|
LC_MESSAGES=C |
13 |
|
|
14 |
# include dir |
# include dir |
15 |
INSTALLER_LIBDIR="%LIBDIR%" |
INSTALLER_LIBDIR="%LIBDIR%" |
16 |
|
|
110 |
fi |
fi |
111 |
} |
} |
112 |
|
|
113 |
dialog_setup_hdd_info() |
task_setup_system_menu() |
|
{ |
|
|
local SHDD="${HDD//\/dev\/}" |
|
|
|
|
|
messagebox -h $"[ Harddrive partitioning ]" \ |
|
|
$"\nPlease create 1 partition.\n\n\[ \Z3${SHDD}1\Zn ] type: \Z3linux\Zn with the whole diskspace\n\Please mark ${SHDD}1 \Z3bootable\Zn." |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_info_auto() |
|
|
{ |
|
|
local SHDD="${HDD//\/dev\/}" |
|
|
|
|
|
messagebox -h $"[ Harddrive partitioning ]" \ |
|
|
$"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${HDD}\Zn ] will be erased!" |
|
|
} |
|
|
|
|
|
dialog_setup_system_menu() |
|
114 |
{ |
{ |
115 |
local mode |
local mode |
116 |
local retval |
local retval |
117 |
|
|
118 |
mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \ |
mode="$(dialog_setup_system_menu)" |
|
$"1:Automatic setup (recommended)" \ |
|
|
":" \ |
|
|
$":\Z1Expert modes:\Zn" \ |
|
|
$"2:Common IDE-disk (manual setup)") |
|
119 |
retval=$? |
retval=$? |
120 |
[[ ${retval} -eq 1 ]] && return 1 |
[[ ${retval} -eq 1 ]] && return 1 |
121 |
if [[ ${retval} -eq 0 ]] |
if [[ ${retval} -eq 0 ]] |
123 |
case "${mode}" in |
case "${mode}" in |
124 |
"1") run_install_auto ;; |
"1") run_install_auto ;; |
125 |
"2") run_install_normal ;; |
"2") run_install_normal ;; |
126 |
"") dialog_setup_system_menu;; |
"") task_setup_system_menu;; |
127 |
esac |
esac |
128 |
fi |
fi |
129 |
} |
} |
162 |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
163 |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
164 |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
165 |
*) message+=$"\n \\ZnCommon device detected.\Zn" ;; |
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
166 |
esac |
esac |
167 |
if [[ ${FORMFACTOR} = laptop ]] |
if [[ ${FORMFACTOR} = laptop ]] |
168 |
then |
then |
169 |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
170 |
fi |
fi |
171 |
|
|
172 |
messagebox -y 15 -h $"Detected hardware:" "${message}" |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
173 |
} |
} |
174 |
|
|
175 |
dialog_setup_hdd_partitions_manual() |
task_setup_hdd_partitions_manual() |
176 |
{ |
{ |
177 |
local i |
local i |
178 |
local retval |
local retval |
193 |
fi |
fi |
194 |
} |
} |
195 |
|
|
196 |
dialog_setup_hdd_partitions_auto() |
task_setup_hdd_partitions_auto() |
197 |
{ |
{ |
198 |
local i |
local i |
199 |
local retval |
local retval |
228 |
return 0 |
return 0 |
229 |
} |
} |
230 |
|
|
231 |
dialog_main() |
task_main() |
232 |
{ |
{ |
233 |
local method=0 |
local method=0 |
234 |
local retval |
local retval |
235 |
|
|
236 |
while [[ ${method} -le 2 ]] |
while [[ ${method} -le 2 ]] |
237 |
do |
do |
238 |
method=$(menubox $"Configuration:" \ |
method=$(dialog_main) |
|
$"1:Install system" \ |
|
|
$"2:Show detected harddrives" \ |
|
|
$"3:Exit and reboot" \ |
|
|
$"4:Exit and drop into a shell") |
|
239 |
retval=$? |
retval=$? |
240 |
[[ ${retval} -eq 1 ]] && exit 1 |
[[ ${retval} -eq 1 ]] && exit 1 |
241 |
if [[ ${retval} -eq 0 ]] |
if [[ ${retval} -eq 0 ]] |
242 |
then |
then |
243 |
case ${method} in |
case ${method} in |
244 |
"1") dialog_setup_system_menu ;; |
"1") task_setup_system_menu ;; |
245 |
"2") dialog_hardware_detection ;; |
"2") dialog_hardware_detection ;; |
246 |
"3") install_do_reboot ;; |
"3") install_do_reboot ;; |
247 |
"4") /bin/bash --login -i ;; |
"4") /bin/bash --login -i ;; |
326 |
export ALL_CDROMS="$(get_hwinfo cdrom)" |
export ALL_CDROMS="$(get_hwinfo cdrom)" |
327 |
} |
} |
328 |
|
|
|
hdd_size_below_256mb() |
|
|
{ |
|
|
local hdd="$1" |
|
|
local size |
|
|
local retval |
|
|
[[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!" |
|
|
|
|
|
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
|
|
if [[ ${size} -le 257000000 ]] |
|
|
then |
|
|
retval="0" |
|
|
else |
|
|
retval="1" |
|
|
fi |
|
|
|
|
|
return "${retval}" |
|
|
} |
|
|
|
|
329 |
setup_hdd_partitions_auto() |
setup_hdd_partitions_auto() |
330 |
{ |
{ |
331 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
428 |
popd > /dev/null |
popd > /dev/null |
429 |
} |
} |
430 |
|
|
|
disabled_install_bootsector_chroot() |
|
|
{ |
|
|
local my_roothdd |
|
|
local grubconf="${INSTALLROOT}/boot/grub/grub.conf" |
|
|
local grub2conf="/boot/grub/grub.cfg" |
|
|
|
|
|
# check for grub2 |
|
|
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
|
|
then |
|
|
# needed by grub-mkconfig on the first run |
|
|
if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
|
|
then |
|
|
install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
|
|
fi |
|
|
|
|
|
# set kernelopts |
|
|
if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
|
|
then |
|
|
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
|
|
else |
|
|
CONFIG="${INSTALLROOT}/etc/conf.d/grub" |
|
|
clearconfig |
|
|
addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" |
|
|
fi |
|
|
CONFIG="${INSTALLROOT}/root/.installrc" |
|
|
clearconfig |
|
|
# only grub 1.99 |
|
|
addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap' |
|
|
addconfig "grub-install --no-floppy ${HDD} &> /dev/null" |
|
|
addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" |
|
|
addconfig "exit 0" |
|
|
|
|
|
# grub-legacy |
|
|
else |
|
|
source ${INSTALLROOT}/boot/kernelversion |
|
|
|
|
|
if [ -e ${INSTALLROOT}/etc/alx_version ] |
|
|
then |
|
|
OLD_ALXVER="${ALXVER}" |
|
|
source ${INSTALLROOT}/etc/alx_version |
|
|
KRNVER="ALX-${ALXVER}" |
|
|
ALXVER="${OLD_ALXVER}" |
|
|
fi |
|
|
|
|
|
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
|
|
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
|
|
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
|
|
|
|
|
# uuid support |
|
|
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
|
|
|
|
CONFIG="${grubconf}" |
|
|
clearconfig |
|
|
addconfig "default 0" |
|
|
addconfig "timeout 3" |
|
|
# using current root password |
|
|
addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" |
|
|
|
|
|
addconfig |
|
|
addconfig "# normal boot" |
|
|
addconfig "title ${KRNVER}" |
|
|
addconfig "root (hd0,0)" |
|
|
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" |
|
|
if is_initrd_supported |
|
|
then |
|
|
addconfig "initrd /boot/${KRNINITRD}" |
|
|
fi |
|
|
|
|
|
addconfig |
|
|
addconfig "# admin boot" |
|
|
addconfig "title ${KRNVER} - Re-run hardware-detection" |
|
|
addconfig "lock" |
|
|
addconfig "root (hd0,0)" |
|
|
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" |
|
|
if is_initrd_supported |
|
|
then |
|
|
addconfig "initrd /boot/${KRNINITRD}" |
|
|
fi |
|
|
|
|
|
addconfig |
|
|
addconfig "title ${KRNVER} - Reset *all* local settings" |
|
|
addconfig "lock" |
|
|
addconfig "root (hd0,0)" |
|
|
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" |
|
|
if is_initrd_supported |
|
|
then |
|
|
addconfig "initrd /boot/${KRNINITRD}" |
|
|
fi |
|
|
|
|
|
# bootsector schreiben chrooted schreiben (lfs/magellan) |
|
|
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
|
|
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
|
|
root (hd0,0) |
|
|
setup (hd0) |
|
|
quit |
|
|
EOF |
|
|
exit 0 |
|
|
CHROOTEOF |
|
|
fi |
|
|
|
|
|
# run installrc |
|
|
chrooted /bin/bash --rcfile /root/.installrc -i |
|
|
rm ${INSTALLROOT}/root/.installrc |
|
|
} |
|
|
|
|
|
disabled_install_initrd_chroot() |
|
|
{ |
|
|
# only generate initrds if the cmd exists |
|
|
is_initrd_supported || return 0 |
|
|
|
|
|
DISKMODS="sd_mod" |
|
|
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
|
|
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
|
|
SATAMODS="sata_via sata_sis sata_nv" |
|
|
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
|
|
OTHERMODS="" |
|
|
case ${SPECIALDEVICE} in |
|
|
zotac_intel) FBMODS=""; DRMMODS="i915" ;; |
|
|
zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;; |
|
|
rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards |
|
|
# not working with kms enabled drivers -> segfaults |
|
|
#maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
|
|
maxdata) FBMODS="" ;; |
|
|
*) FBMODS="uvesafb" ;; |
|
|
esac |
|
|
|
|
|
if [[ ${FORMFACTOR} = laptop ]] |
|
|
then |
|
|
OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
|
|
fi |
|
|
|
|
|
# install an appropriate uvesafb.conf |
|
|
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
|
|
CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf" |
|
|
clearconfig |
|
|
addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" |
|
|
|
|
|
# install an appropriate viafb.conf |
|
|
CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf" |
|
|
clearconfig |
|
|
addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" |
|
|
|
|
|
# install an appropriate i810fb.conf |
|
|
CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf" |
|
|
clearconfig |
|
|
addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
|
|
|
|
|
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
|
|
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
|
|
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
|
|
exit 0 |
|
|
CHROOTEOF |
|
|
|
|
|
# run installrc |
|
|
chrooted /bin/bash --rcfile /root/.installrc -i |
|
|
rm ${INSTALLROOT}/root/.installrc |
|
|
} |
|
|
|
|
431 |
install_system_settings() |
install_system_settings() |
432 |
{ |
{ |
433 |
local CONFIG |
local CONFIG |
481 |
{ |
{ |
482 |
dialog_hardware_detection |
dialog_hardware_detection |
483 |
|
|
484 |
dialog_setup_hdd_partitions_manual |
task_setup_hdd_partitions_manual |
485 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
486 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
487 |
install_mount_rootfs |
install_mount_rootfs |
509 |
{ |
{ |
510 |
dialog_hardware_detection |
dialog_hardware_detection |
511 |
|
|
512 |
dialog_setup_hdd_partitions_auto |
task_setup_hdd_partitions_auto |
513 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
514 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
515 |
install_mount_rootfs |
install_mount_rootfs |
536 |
# set some proper traps |
# set some proper traps |
537 |
trap "trap_exit" SIGINT SIGQUIT |
trap "trap_exit" SIGINT SIGQUIT |
538 |
|
|
539 |
dialog_main |
task_main |
540 |
|
|
541 |
exit 0 |
exit 0 |