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 |
|
|
29 |
${INSTALLER_LIBDIR}/functions/common.sh \ |
${INSTALLER_LIBDIR}/functions/common.sh \ |
30 |
${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ |
${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ |
31 |
${INSTALLER_LIBDIR}/functions/hwdetection.sh \ |
${INSTALLER_LIBDIR}/functions/hwdetection.sh \ |
32 |
|
${INSTALLER_LIBDIR}/functions/bootloader.sh \ |
33 |
|
${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ |
34 |
${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
35 |
do |
do |
36 |
if [ -e ${inc} ] |
if [ -e ${inc} ] |
72 |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
73 |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
74 |
|
|
75 |
################################################# |
|
76 |
# DIALOG BOXEN # |
### helper scripts ### |
|
################################################# |
|
77 |
|
|
78 |
trap_exit() |
trap_exit() |
79 |
{ |
{ |
87 |
exit 1 |
exit 1 |
88 |
} |
} |
89 |
|
|
90 |
dialog_die() |
install_meter() |
|
{ |
|
|
ERROR="$1" |
|
|
RETVAL="$?" |
|
|
dialog_install_failure |
|
|
exit 1 |
|
|
} |
|
|
|
|
|
dialog_warning() |
|
|
{ |
|
|
local retval |
|
|
|
|
|
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
|
|
retval=$? |
|
|
if [[ ${retval} -eq 1 ]] |
|
|
then |
|
|
clear |
|
|
echo $"The process was aborted." |
|
|
exit 1 |
|
|
fi |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_info() |
|
|
{ |
|
|
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() |
|
|
{ |
|
|
local mode |
|
|
local retval |
|
|
|
|
|
mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \ |
|
|
$"1:Automatic setup (recommended)" \ |
|
|
":" \ |
|
|
$":\Z1Expert modes:\Zn" \ |
|
|
$"2:Common IDE-disk (manual setup)") |
|
|
retval=$? |
|
|
[[ ${retval} -eq 1 ]] && return 1 |
|
|
if [[ ${retval} -eq 0 ]] |
|
|
then |
|
|
case "${mode}" in |
|
|
"1") run_install_auto ;; |
|
|
"2") run_install_normal ;; |
|
|
"") dialog_setup_system_menu;; |
|
|
esac |
|
|
fi |
|
|
} |
|
|
|
|
|
dialog_hardware_detection() |
|
|
{ |
|
|
local message |
|
|
|
|
|
run_hardware_detection_disks |
|
|
|
|
|
message+=$"Harddrives:\n" |
|
|
|
|
|
if [[ ! -z ${ALL_DISKS} ]] |
|
|
then |
|
|
for i in ${ALL_DISKS} |
|
|
do |
|
|
message+="\Z3${i}\Zn " |
|
|
done |
|
|
message+="\n" |
|
|
fi |
|
|
|
|
|
if [[ ! -z ${ALL_CDROMS} ]] |
|
|
then |
|
|
message+="\n" |
|
|
message+=$"Optical disk drives:\n" |
|
|
for i in ${ALL_CDROMS} |
|
|
do |
|
|
message+="\Z3${i}\Zn" |
|
|
done |
|
|
message+="\n" |
|
|
fi |
|
|
|
|
|
# other devices |
|
|
run_hardware_detection |
|
|
case "${SPECIALDEVICE}" in |
|
|
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
|
|
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
|
|
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
|
|
*) message+=$"\n \\ZnCommon device detected.\Zn" ;; |
|
|
esac |
|
|
if [[ ${FORMFACTOR} = laptop ]] |
|
|
then |
|
|
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
|
|
fi |
|
|
|
|
|
messagebox -y 15 -h $"Detected hardware:" "${message}" |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_partitions_manual() |
|
|
{ |
|
|
local i |
|
|
|
|
|
if [[ -z ${ALL_DISKS} ]] |
|
|
then |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--ok-label "Beenden" \ |
|
|
--msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 |
|
|
exit 1 |
|
|
else |
|
|
|
|
|
echo "dialog \\" > /tmp/hddtmp.sh |
|
|
echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--stdout \\" >> /tmp/hddtmp.sh |
|
|
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
|
|
|
|
|
for i in ${ALL_DISKS} |
|
|
do |
|
|
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
|
|
done |
|
|
echo -e "\n" >> /tmp/hddtmp.sh |
|
|
|
|
|
chmod a+x /tmp/hddtmp.sh |
|
|
HDD="$(/tmp/hddtmp.sh)" |
|
|
RES=$? |
|
|
[[ ${RES} -eq 1 ]] && return 1 |
|
|
if [[ ${RES} -eq 0 ]] |
|
|
then |
|
|
dialog_setup_hdd_info |
|
|
setup_hdd_partitions_manual |
|
|
fi |
|
|
fi |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_partitions_auto() |
|
|
{ |
|
|
local i |
|
|
|
|
|
if [[ -z ${installdevs} ]] |
|
|
then |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--ok-label "Beenden" \ |
|
|
--msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 |
|
|
exit 1 |
|
|
else |
|
|
|
|
|
echo "dialog \\" > /tmp/hddtmp.sh |
|
|
echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--stdout \\" >> /tmp/hddtmp.sh |
|
|
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
|
|
|
|
|
for i in ${installdevs} |
|
|
do |
|
|
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
|
|
done |
|
|
echo -e "\n" >> /tmp/hddtmp.sh |
|
|
|
|
|
chmod a+x /tmp/hddtmp.sh |
|
|
HDD="$(/tmp/hddtmp.sh)" |
|
|
RES=$? |
|
|
[[ ${RES} -eq 1 ]] && return 1 |
|
|
if [[ ${RES} -eq 0 ]] |
|
|
then |
|
|
dialog_setup_hdd_info_auto |
|
|
dialog_setup_hdd_create_partitions |
|
|
setup_hdd_partitions_auto |
|
|
fi |
|
|
fi |
|
|
} |
|
|
|
|
|
run_hardware_detection_disks() |
|
|
{ |
|
|
local bootdev |
|
|
|
|
|
# all disks but exclude ramdisks |
|
|
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
|
|
# remove the boot device from ALL_DISKS if it was an usbstick |
|
|
if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
|
|
then |
|
|
bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
|
|
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
|
|
fi |
|
|
export ALL_CDROMS="$(get_hwinfo cdrom)" |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_create_partitions() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Erstelle Disk Partitionen ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_format() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Erstelle Datei-Systeme ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_install_settings() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Speichere System-Einstellungen ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_install_system_image() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--gauge "Kopiere System-Image ..." 6 80 |
|
|
} |
|
|
|
|
|
dialog_install_meter() |
|
91 |
{ |
{ |
92 |
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
93 |
do |
do |
100 |
return 0 |
return 0 |
101 |
} |
} |
102 |
|
|
103 |
|
mount_rootfs() |
|
dialog_install_bootsector() |
|
104 |
{ |
{ |
105 |
dialog \ |
local retval |
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Schreibe den Bootsektor ..." 3 70 |
|
|
} |
|
106 |
|
|
107 |
dialog_install_successful() |
if is_mounted --location "${INSTALLROOT}" |
108 |
{ |
then |
109 |
dialog \ |
echo $"${INSTALLROOT} already mounted" >&2 |
110 |
--backtitle "${TITLE}" \ |
else |
111 |
--colors \ |
mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive'${ROOTHDD}' -> '${INSTALLROOT}'" |
112 |
--msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81 |
fi |
113 |
|
[[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
114 |
} |
} |
115 |
|
|
116 |
dialog_install_failure() |
umount_rootfs() |
117 |
{ |
{ |
118 |
dialog \ |
is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
119 |
--backtitle "${TITLE}" \ |
is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
|
--colors \ |
|
|
--msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\ |
|
|
Fehler bei ${ERROR}, RetVal: ${RETVAL} \ |
|
|
" 10 81 |
|
120 |
} |
} |
121 |
|
|
122 |
dialog_main() |
install_do_reboot() |
123 |
{ |
{ |
124 |
METHOD=0 |
reboot |
|
|
|
|
while [[ ${METHOD} -le 2 ]] |
|
|
do |
|
|
METHOD=$(dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--no-cancel \ |
|
|
--ok-label "Weiter" \ |
|
|
--stdout \ |
|
|
--menu "Konfiguration" 14 70 5 \ |
|
|
"1" "AutoSta_LX installieren" \ |
|
|
"2" "Uebersicht gefundener Laufwerke" \ |
|
|
"3" "Beenden und neustarten" \ |
|
|
"4" "Beenden und eine Shell starten") |
|
|
RES=$? |
|
|
[[ ${RES} -eq 1 ]] && exit 1 |
|
|
if [[ ${RES} -eq 0 ]] |
|
|
then |
|
|
case ${METHOD} in |
|
|
"1") dialog_setup_system_menu ;; |
|
|
"2") dialog_hardware_detection ;; |
|
|
"3") install_do_reboot ;; |
|
|
"4") /bin/bash --login -i ;; |
|
|
esac |
|
|
fi |
|
|
done |
|
125 |
} |
} |
126 |
|
|
|
################################################# |
|
|
# Install Komandos # |
|
|
################################################# |
|
127 |
run_hardware_detection() |
run_hardware_detection() |
128 |
{ |
{ |
129 |
local hwinfo |
local hwinfo |
130 |
|
|
131 |
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
132 |
|
|
133 |
# check for special devices/clients: |
## check for special devices/clients: |
134 |
# if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
135 |
local removable=0 |
#local removable=0 |
136 |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
#if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
137 |
then |
#then |
138 |
for i in /sys/block/[hs]d*/removable |
#for i in /sys/block/[hs]d*/removable |
139 |
do |
#do |
140 |
if [[ $(< ${i}) = 1 ]] |
#if [[ $(< ${i}) = 1 ]] |
141 |
then |
#then |
142 |
removable=1 |
#removable=1 |
143 |
fi |
#fi |
144 |
done |
#done |
145 |
|
## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
146 |
# only add this for grub legacy, grub2 detect these settings on its own |
|
147 |
export GRUBLEGACYOPTS="rootdelay=8" |
## only add this for grub legacy, grub2 detect these settings on its own |
148 |
# there are to zotac types in the wild, nvidia based gfx and intel |
#export GRUBLEGACYOPTS="rootdelay=8" |
149 |
if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
## there are to zotac types in the wild, nvidia based gfx and intel |
150 |
then |
#if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
151 |
export SPECIALDEVICE="zotac_nvidia" |
#then |
152 |
else |
#export SPECIALDEVICE="zotac_nvidia" |
153 |
export SPECIALDEVICE="zotac_intel" |
#else |
154 |
fi |
#export SPECIALDEVICE="zotac_intel" |
155 |
fi |
#fi |
156 |
|
#fi |
157 |
|
|
158 |
# check for special devices/clients: |
# check for special devices/clients: |
159 |
# if a rangee and disk ist smaller then 256mb move partion one block further ahead |
# if a rangee and disk ist smaller then 256mb move partion one block further ahead |
182 |
fi |
fi |
183 |
} |
} |
184 |
|
|
185 |
hdd_size_below_256mb() |
run_hardware_detection_disks() |
186 |
{ |
{ |
187 |
local hdd="$1" |
local bootdev |
|
local size |
|
|
local retval |
|
|
[[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!" |
|
188 |
|
|
189 |
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
# all disks but exclude ramdisks |
190 |
if [[ ${size} -le 257000000 ]] |
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
191 |
|
# remove the boot device from ALL_DISKS if it was an usbstick |
192 |
|
if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
193 |
then |
then |
194 |
retval="0" |
bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
195 |
else |
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
|
retval="1" |
|
196 |
fi |
fi |
197 |
|
export ALL_CDROMS="$(get_hwinfo cdrom)" |
|
return "${retval}" |
|
198 |
} |
} |
199 |
|
|
200 |
setup_hdd_partitions_auto() |
setup_hdd_partitions_auto() |
201 |
{ |
{ |
202 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
203 |
|
|
204 |
|
# sanity check - should not happen |
205 |
|
if is_mounted --device "${ROOTHDD}" |
206 |
|
then |
207 |
|
echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 |
208 |
|
umount "${ROOTHDD}" |
209 |
|
fi |
210 |
|
|
211 |
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
212 |
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
213 |
then |
then |
214 |
if hdd_size_below_256mb ${HDD} |
if device_minimum_size "${HDD}" 256 |
215 |
then |
then |
216 |
FDISKPARTIONBELOW256MB=1 |
FDISKPARTIONBELOW256MB=1 |
217 |
else |
else |
269 |
setup_hdd_partitions_manual() |
setup_hdd_partitions_manual() |
270 |
{ |
{ |
271 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
272 |
|
SWAPHDD="" |
273 |
## hdds partitionieren manual |
BOOTHDD="" |
274 |
cfdisk ${HDD} || dialog_die |
cfdisk ${HDD} || dialog_die |
275 |
} |
} |
276 |
|
|
277 |
setup_hdd_format() |
setup_hdd_format() |
278 |
{ |
{ |
279 |
mke2fs -j -q ${ROOTHDD} || dialog_die |
# sanity check - should not happen |
280 |
} |
if is_mounted --device "${ROOTHDD}" |
281 |
|
then |
282 |
|
echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
283 |
|
umount "${ROOTHDD}" |
284 |
|
fi |
285 |
|
|
286 |
install_mount_rootfs() |
mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die |
|
{ |
|
|
mount ${ROOTHDD} ${INSTALLROOT} || dialog_die |
|
|
install -d ${INSTALLROOT}/boot || dialog_die |
|
|
cd ${INSTALLROOT} || dialog_die |
|
287 |
} |
} |
288 |
|
|
289 |
install_system_image() |
install_system_image() |
290 |
{ |
{ |
291 |
|
pushd ${INSTALLROOT} > /dev/null |
292 |
tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
293 |
|
popd > /dev/null |
294 |
} |
} |
295 |
|
|
296 |
install_bootsector_chroot() |
install_system_settings() |
297 |
{ |
{ |
298 |
local my_roothdd |
local CONFIG |
|
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 |
|
299 |
|
|
300 |
# set kernelopts |
# write fstab |
301 |
if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
CONFIG="${INSTALLROOT}/etc/fstab" |
302 |
then |
clearconfig |
303 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" |
304 |
else |
addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
305 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" |
|
fi |
|
|
echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die |
|
|
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
|
|
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
|
|
echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die |
|
306 |
|
|
307 |
# grub-legacy |
# install network config skeleton |
308 |
else |
CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
309 |
### grubconf schreiben |
clearconfig |
310 |
source ${INSTALLROOT}/boot/kernelversion |
addconfig 'ONBOOT="yes"' |
311 |
|
addconfig 'NETWORKING="dhcp"' |
312 |
|
|
313 |
#for alx only |
# intel framebuffer quirk |
314 |
if [ -e ${INSTALLROOT}/etc/alx_version ] |
if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] |
315 |
|
then |
316 |
|
if [ -e /proc/fb ] |
317 |
then |
then |
318 |
OLD_ALXVER="${ALXVER}" |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
319 |
source ${INSTALLROOT}/etc/alx_version |
then |
320 |
KRNVER="ALX-${ALXVER}" |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
321 |
ALXVER="${OLD_ALXVER}" |
if [[ ${fbdev} != 0 ]] |
322 |
|
then |
323 |
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
324 |
|
fi |
325 |
|
fi |
326 |
fi |
fi |
327 |
|
fi |
328 |
|
} |
329 |
|
|
|
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
|
|
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
|
|
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
|
330 |
|
|
331 |
# uuid support |
### installer dialogs ### |
|
if is_uuid_supported |
|
|
then |
|
|
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
|
else |
|
|
my_roothdd="${ROOTHDD}" |
|
|
fi |
|
|
|
|
|
: > ${grubconf} || dialog_die |
|
|
echo "default 0" >> ${grubconf} || dialog_die |
|
|
echo "timeout 3" >> ${grubconf} || dialog_die |
|
|
# using current root password |
|
|
echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die |
|
|
|
|
|
echo >> ${grubconf} || dialog_die |
|
|
echo "# normal boot" >> ${grubconf} || dialog_die |
|
|
echo "title ${KRNVER}" >> ${grubconf} || dialog_die |
|
|
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
|
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || dialog_die |
|
|
if is_initrd_supported |
|
|
then |
|
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
|
|
fi |
|
332 |
|
|
333 |
echo >> ${grubconf} || dialog_die |
dialog_die() |
334 |
echo "# admin boot" >> ${grubconf} || dialog_die |
{ |
335 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || dialog_die |
ERROR="$1" |
336 |
echo "lock" >> ${grubconf} || dialog_die |
RETVAL="$?" |
337 |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
dialog_install_failure |
338 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || dialog_die |
exit 1 |
339 |
if is_initrd_supported |
} |
|
then |
|
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
|
|
fi |
|
340 |
|
|
341 |
echo >> ${grubconf} || dialog_die |
dialog_warning() |
342 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || dialog_die |
{ |
343 |
echo "lock" >> ${grubconf} || dialog_die |
local retval |
|
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
|
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || dialog_die |
|
|
if is_initrd_supported |
|
|
then |
|
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
|
|
fi |
|
344 |
|
|
345 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
346 |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
retval=$? |
347 |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
if [[ ${retval} -eq 1 ]] |
348 |
root (hd0,0) |
then |
349 |
setup (hd0) |
clear |
350 |
quit |
echo $"The process was aborted." |
351 |
EOF |
exit 1 |
|
exit 0 |
|
|
CHROOTEOF |
|
352 |
fi |
fi |
353 |
|
} |
354 |
|
|
|
## enter chroot |
|
|
mount -t proc proc ${INSTALLROOT}/proc |
|
|
mount -t sysfs sysfs ${INSTALLROOT}/sys |
|
|
mount -o bind /dev ${INSTALLROOT}/dev |
|
|
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
|
|
umount ${INSTALLROOT}/proc |
|
|
umount ${INSTALLROOT}/sys |
|
|
umount ${INSTALLROOT}/dev |
|
|
rm ${INSTALLROOT}/root/.installrc |
|
|
} |
|
|
|
|
|
is_initrd_supported() |
|
|
{ |
|
|
# only generate initrds if the cmd exists |
|
|
[[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0 |
|
|
return 1 |
|
|
} |
|
|
|
|
|
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 |
|
355 |
|
|
356 |
if [[ ${FORMFACTOR} = laptop ]] |
### installer tasks ### |
357 |
|
|
358 |
|
task_setup_system_menu() |
359 |
|
{ |
360 |
|
local mode |
361 |
|
local retval |
362 |
|
|
363 |
|
mode="$(dialog_setup_system_menu)" |
364 |
|
retval=$? |
365 |
|
[[ ${retval} -eq 1 ]] && return 1 |
366 |
|
if [[ ${retval} -eq 0 ]] |
367 |
then |
then |
368 |
OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
case "${mode}" in |
369 |
|
"1") run_install_auto ;; |
370 |
|
"2") run_install_normal ;; |
371 |
|
"") task_setup_system_menu;; |
372 |
|
esac |
373 |
fi |
fi |
374 |
|
} |
375 |
|
|
376 |
# install an appropriate uvesafb.conf |
task_hardware_detection() |
377 |
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
{ |
378 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die |
local message |
379 |
|
|
380 |
# install an appropriate viafb.conf |
run_hardware_detection_disks |
|
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die |
|
381 |
|
|
382 |
# install an appropriate i810fb.conf |
message+=$"Harddrives:\n" |
|
echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" > ${INSTALLROOT}/etc/modprobe.d/i810fb.conf || dialog_die |
|
383 |
|
|
384 |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
if [[ ! -z ${ALL_DISKS} ]] |
385 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
then |
386 |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
for i in ${ALL_DISKS} |
387 |
exit 0 |
do |
388 |
CHROOTEOF |
message+="\Z3${i}\Zn " |
389 |
|
done |
390 |
|
message+="\n" |
391 |
|
fi |
392 |
|
|
393 |
## enters chroot |
if [[ ! -z ${ALL_CDROMS} ]] |
394 |
mount -t proc proc ${INSTALLROOT}/proc |
then |
395 |
mount -t sysfs sysfs ${INSTALLROOT}/sys |
message+="\n" |
396 |
mount -o bind /dev ${INSTALLROOT}/dev |
message+=$"Optical disk drives:\n" |
397 |
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
for i in ${ALL_CDROMS} |
398 |
umount ${INSTALLROOT}/proc |
do |
399 |
umount ${INSTALLROOT}/sys |
message+="\Z3${i}\Zn" |
400 |
umount ${INSTALLROOT}/dev |
done |
401 |
rm ${INSTALLROOT}/root/.installrc |
message+="\n" |
402 |
} |
fi |
403 |
|
|
404 |
is_uuid_supported() |
# other devices |
405 |
{ |
run_hardware_detection |
406 |
if [[ -x $(type -P busybox.mkinitrd) ]] |
case "${SPECIALDEVICE}" in |
407 |
|
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
408 |
|
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
409 |
|
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
410 |
|
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
411 |
|
esac |
412 |
|
if [[ ${FORMFACTOR} = laptop ]] |
413 |
then |
then |
414 |
# only detect uuids if supported |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
|
if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] |
|
|
then |
|
|
return 0 |
|
|
fi |
|
415 |
fi |
fi |
416 |
|
|
417 |
return 1 |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
418 |
} |
} |
419 |
|
|
420 |
get_uuid() |
task_setup_hdd_partitions_manual() |
421 |
{ |
{ |
422 |
local UUID |
local i |
423 |
local SEC_TYPE |
local retval |
|
local TYPE |
|
|
|
|
|
local dev="$1" |
|
|
[[ -z ${dev} ]] && dialog_die "no dev given" |
|
424 |
|
|
425 |
# check if given device is already an UUID |
if [[ -z ${ALL_DISKS} ]] |
|
if [[ ${dev/UUID=/}x != ${dev}x ]] |
|
426 |
then |
then |
427 |
eval "${dev}" |
dialog_no_harddrive_found |
428 |
|
exit 1 |
429 |
else |
else |
430 |
eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') |
HDD=$(dialog_select_target_harddrive) |
431 |
|
retval=$? |
432 |
|
[[ ${retval} -eq 1 ]] && return 1 |
433 |
|
if [[ ${retval} -eq 0 ]] |
434 |
|
then |
435 |
|
dialog_setup_hdd_info |
436 |
|
setup_hdd_partitions_manual |
437 |
|
fi |
438 |
fi |
fi |
|
echo "${UUID}" |
|
439 |
} |
} |
440 |
|
|
441 |
install_system_settings() |
task_setup_hdd_partitions_auto() |
442 |
{ |
{ |
443 |
# schreibe fstab |
local i |
444 |
if is_uuid_supported |
local retval |
|
then |
|
|
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
else |
|
|
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
fi |
|
|
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
|
|
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
|
|
|
# install network config skeleton |
|
|
install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die |
|
445 |
|
|
446 |
# intel framebufer quirk |
if [[ -z ${ALL_DISKS} ]] |
|
if [[ -e /proc/fb ]] |
|
447 |
then |
then |
448 |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
dialog_no_harddrive_found |
449 |
|
exit 1 |
450 |
|
else |
451 |
|
HDD=$(dialog_select_target_harddrive) |
452 |
|
retval=$? |
453 |
|
[[ ${retval} -eq 1 ]] && return 1 |
454 |
|
if [[ ${retval} -eq 0 ]] |
455 |
then |
then |
456 |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
dialog_setup_hdd_info_auto |
457 |
if [[ ${fbdev} != 0 ]] |
dialog_setup_hdd_create_partitions |
458 |
then |
setup_hdd_partitions_auto |
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
|
|
fi |
|
459 |
fi |
fi |
460 |
fi |
fi |
461 |
} |
} |
462 |
|
|
463 |
install_umount_rootfs() |
task_main() |
464 |
{ |
{ |
465 |
cd / |
local method=0 |
466 |
umount ${INSTALLROOT}/boot || dialog_die |
local retval |
|
umount ${INSTALLROOT} || dialog_die |
|
|
} |
|
467 |
|
|
468 |
install_do_reboot() |
while [[ ${method} -le 2 ]] |
469 |
{ |
do |
470 |
reboot |
method=$(dialog_main) |
471 |
|
retval=$? |
472 |
|
[[ ${retval} -eq 1 ]] && exit 1 |
473 |
|
if [[ ${retval} -eq 0 ]] |
474 |
|
then |
475 |
|
case ${method} in |
476 |
|
"1") task_setup_system_menu ;; |
477 |
|
"2") task_hardware_detection ;; |
478 |
|
"3") install_do_reboot ;; |
479 |
|
"4") /bin/bash --login -i ;; |
480 |
|
esac |
481 |
|
fi |
482 |
|
done |
483 |
} |
} |
484 |
|
|
|
################################################# |
|
|
# Install Ablauf Scripte # |
|
|
################################################# |
|
|
|
|
485 |
run_install_normal() |
run_install_normal() |
486 |
{ |
{ |
487 |
dialog_hardware_detection |
task_hardware_detection |
488 |
|
|
489 |
dialog_setup_hdd_partitions_manual |
task_setup_hdd_partitions_manual |
490 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
491 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
492 |
install_mount_rootfs |
mount_rootfs |
493 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
494 |
|
|
495 |
dialog_install_settings |
dialog_install_settings |
496 |
sleep 1 |
sleep 1 |
497 |
install_system_settings |
install_system_settings |
498 |
install_initrd_chroot |
if is_initrd_supported |
499 |
|
then |
500 |
|
dialog_install_initrd |
501 |
|
initrd_config |
502 |
|
initrd_install |
503 |
|
fi |
504 |
|
|
505 |
dialog_install_bootsector |
dialog_install_bootsector |
506 |
install_bootsector_chroot |
bootloader_config |
507 |
|
bootloader_install |
508 |
|
|
509 |
install_umount_rootfs |
umount_rootfs |
510 |
dialog_install_successful |
dialog_install_successful |
511 |
} |
} |
512 |
|
|
513 |
run_install_auto() |
run_install_auto() |
514 |
{ |
{ |
515 |
dialog_hardware_detection |
task_hardware_detection |
516 |
|
|
517 |
dialog_setup_hdd_partitions_auto |
task_setup_hdd_partitions_auto |
518 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
519 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
520 |
install_mount_rootfs |
mount_rootfs |
521 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
522 |
|
|
523 |
dialog_install_settings |
dialog_install_settings |
524 |
sleep 1 |
sleep 1 |
525 |
install_system_settings |
install_system_settings |
526 |
install_initrd_chroot |
if is_initrd_supported |
527 |
|
then |
528 |
|
dialog_install_initrd |
529 |
|
initrd_config |
530 |
|
initrd_install |
531 |
|
fi |
532 |
|
|
533 |
dialog_install_bootsector |
dialog_install_bootsector |
534 |
install_bootsector_chroot |
bootloader_config |
535 |
|
bootloader_install |
536 |
|
|
537 |
install_umount_rootfs |
umount_rootfs |
538 |
dialog_install_successful |
dialog_install_successful |
539 |
} |
} |
540 |
|
|
541 |
# set some proper traps |
# set some proper traps |
542 |
trap "trap_exit" SIGINT SIGQUIT |
trap "trap_exit" SIGINT SIGQUIT |
543 |
|
|
544 |
dialog_main |
task_main |
545 |
|
|
546 |
exit 0 |
exit 0 |