7 |
# Niels Rogalla <niro@magellan-linux.de> |
# Niels Rogalla <niro@magellan-linux.de> |
8 |
# |
# |
9 |
|
|
10 |
|
# ignore the environment |
11 |
|
LC_ALL=C |
12 |
|
# include dir |
13 |
INSTALLER_LIBDIR="%LIBDIR%" |
INSTALLER_LIBDIR="%LIBDIR%" |
14 |
|
|
15 |
|
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
16 |
|
# -> now in images.conf |
17 |
|
CURRENTLINE=0 |
18 |
|
|
19 |
|
die() |
20 |
|
{ |
21 |
|
echo "Error: $@" |
22 |
|
exit 1 |
23 |
|
} |
24 |
|
|
25 |
# configuration |
# configuration |
26 |
if [ -e %SYSCONFDIR%/installer.conf ] |
if [ -e %SYSCONFDIR%/installer.conf ] |
27 |
then |
then |
30 |
die "/etc/installer.conf not found" |
die "/etc/installer.conf not found" |
31 |
fi |
fi |
32 |
|
|
33 |
#images: (get ${CDIMAGENAME}) |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
34 |
|
# -> now in images.conf |
35 |
|
CDIMAGENAME="" |
36 |
|
TOTALLINES="" |
37 |
|
CURRENTLINE=0 |
38 |
if [ -e /mnt/cdrom/system/images.conf ] |
if [ -e /mnt/cdrom/system/images.conf ] |
39 |
then |
then |
40 |
source /mnt/cdrom/system/images.conf |
source /mnt/cdrom/system/images.conf |
41 |
|
# check if all required variables are set |
42 |
|
[[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" |
43 |
|
[[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" |
44 |
else |
else |
45 |
die "/mnt/cdrom/system/images.conf not found" |
die "/mnt/cdrom/system/images.conf not found" |
46 |
fi |
fi |
52 |
VERSION="%VERSIONTAG%" |
VERSION="%VERSIONTAG%" |
53 |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
54 |
|
|
55 |
CDPATH="${DEFAULT_CDPATH}" |
CDROOT="${DEFAULT_CDROOT}" |
56 |
INSTALLPATH="${DEFAULT_INSTALLPATH}" |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
|
|
|
|
### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1 |
|
|
CURRENTLINE=0 |
|
|
#TOTALLINES=11072 # -> now in images.conf |
|
57 |
|
|
58 |
# standard kernel opts |
# standard kernel opts |
59 |
KERNELOPTS="quiet video=1024x768" |
KERNELOPTS="quiet video=1024x768" |
76 |
# DIALOG BOXEN # |
# DIALOG BOXEN # |
77 |
################################################# |
################################################# |
78 |
|
|
79 |
die() |
dialog_die() |
80 |
{ |
{ |
81 |
ERROR=$1 |
ERROR="$1" |
82 |
RETVAL=$? |
RETVAL="$?" |
83 |
dialog_install_failure |
dialog_install_failure |
84 |
exit 1 |
exit 1 |
85 |
} |
} |
86 |
|
|
87 |
dialog_warning() |
dialog_warning() |
88 |
{ |
{ |
89 |
dialog \ |
local retval |
90 |
--backtitle "${TITLE}" \ |
|
91 |
--colors \ |
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
92 |
--defaultno \ |
retval=$? |
93 |
--yesno "\Z1 !!! Achtung !!! \Zn\n\n\ |
if [[ ${retval} -eq 1 ]] |
|
Diese Festplatte wird unwiederruflich geloescht werden.\n\n\ |
|
|
Soll ich wirklich fortfahren ?" 10 70 |
|
|
RES=$? |
|
|
if [[ ${RES} -eq 1 ]] |
|
94 |
then |
then |
95 |
clear |
clear |
96 |
echo "Der Vorgang wurde abgebrochen." |
echo $"The process was aborted." |
97 |
exit 1 |
exit 1 |
98 |
fi |
fi |
99 |
} |
} |
164 |
then |
then |
165 |
case "${i}" in |
case "${i}" in |
166 |
"1") run_install_auto ;; |
"1") run_install_auto ;; |
167 |
"2") run_install_normal ;; |
"2") run_install_normal ;; |
168 |
"3") run_install_flash ;; |
"3") run_install_flash ;; |
169 |
"") dialog_setup_system_menu;; |
"") dialog_setup_system_menu;; |
170 |
esac |
esac |
176 |
local i |
local i |
177 |
local hwtmp |
local hwtmp |
178 |
|
|
179 |
if [ -x $(which mktemp &> /dev/null) ] |
if [ -x $(type -P mktemp) ] |
180 |
then |
then |
181 |
hwtmp="$(mktemp)" |
hwtmp="$(mktemp)" |
182 |
else |
else |
183 |
hwtmp="/tmp/hwtmp.sh" |
hwtmp="/tmp/hwtmp.sh" |
184 |
fi |
fi |
185 |
|
|
186 |
[[ ! -z ${installdevs} ]] && installdevs="" |
run_hardware_detection_disks |
187 |
|
|
188 |
echo "dialog \\" > ${hwtmp} |
echo "dialog \\" > ${hwtmp} |
189 |
echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp} |
echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp} |
193 |
echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp} |
echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp} |
194 |
echo " Festplatten:\n \\" >> ${hwtmp} |
echo " Festplatten:\n \\" >> ${hwtmp} |
195 |
|
|
196 |
if [[ ! -z ${scsidisks} ]] |
if [[ ! -z ${ALL_DISKS} ]] |
197 |
then |
then |
198 |
for i in ${scsidisks} |
for i in ${ALL_DISKS} |
199 |
do |
do |
200 |
if [[ ${i} != ${cdromdev} ]] |
echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
then |
|
|
echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
|
installdevs="${installdevs} ${i}" |
|
|
fi |
|
201 |
done |
done |
202 |
fi |
fi |
203 |
|
|
204 |
if [[ ! -z ${idedisks} ]] |
if [[ ! -z ${ALL_CDROMS} ]] |
205 |
then |
then |
206 |
for i in ${idedisks} |
echo " \n \\" >> ${hwtmp} |
207 |
|
echo " CDROM Laufwerke:\n \\" >> ${hwtmp} |
208 |
|
for i in ${ALL_CDROMS} |
209 |
do |
do |
210 |
if [[ ${i} != ${cdromdev} ]] |
echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
then |
|
|
echo " \\Z7IDE: \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
|
installdevs="${installdevs} ${i}" |
|
|
fi |
|
211 |
done |
done |
212 |
fi |
fi |
213 |
|
|
|
if [[ ! -z ${cdromdev} ]] |
|
|
then |
|
|
echo " \n \\" >> ${hwtmp} |
|
|
echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp} |
|
|
echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp} |
|
|
fi |
|
|
|
|
214 |
# other devices |
# other devices |
215 |
run_hardware_detection |
run_hardware_detection |
216 |
case "${SPECIALDEVICE}" in |
case "${SPECIALDEVICE}" in |
350 |
fi |
fi |
351 |
} |
} |
352 |
|
|
353 |
|
run_hardware_detection_disks() |
354 |
|
{ |
355 |
|
local bootdev |
356 |
|
|
357 |
|
# all disks but exclude ramdisks |
358 |
|
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
359 |
|
# remove the boot device from ALL_DISKS if it was an usbstick |
360 |
|
if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
361 |
|
then |
362 |
|
bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
363 |
|
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
364 |
|
fi |
365 |
|
export ALL_CDROMS="$(get_hwinfo cdrom)" |
366 |
|
} |
367 |
|
|
368 |
dialog_setup_hdd_create_partitions() |
dialog_setup_hdd_create_partitions() |
369 |
{ |
{ |
370 |
dialog \ |
dialog \ |
453 |
if [[ ${RES} -eq 0 ]] |
if [[ ${RES} -eq 0 ]] |
454 |
then |
then |
455 |
case ${METHOD} in |
case ${METHOD} in |
456 |
"1") dialog_setup_system_menu ;; |
"1") dialog_setup_system_menu ;; |
457 |
"2") dialog_hardware_detection ;; |
"2") dialog_hardware_detection ;; |
458 |
"3") install_do_reboot ;; |
"3") install_do_reboot ;; |
459 |
"4") /bin/bash --login -i ;; |
"4") /bin/bash --login -i ;; |
527 |
local hdd="$1" |
local hdd="$1" |
528 |
local size |
local size |
529 |
local retval |
local retval |
530 |
[[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!" |
[[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!" |
531 |
|
|
532 |
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
533 |
if [[ ${size} -le 257000000 ]] |
if [[ ${size} -le 257000000 ]] |
556 |
fi |
fi |
557 |
|
|
558 |
## delete disk |
## delete disk |
559 |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
560 |
|
|
561 |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
562 |
then |
then |
609 |
ROOTHDD="${HDD}3" |
ROOTHDD="${HDD}3" |
610 |
|
|
611 |
## hdds partitionieren manuell |
## hdds partitionieren manuell |
612 |
cfdisk ${HDD} || die |
cfdisk ${HDD} || dialog_die |
613 |
} |
} |
614 |
|
|
615 |
setup_hdd_partitions_manuell_flash() |
setup_hdd_partitions_manuell_flash() |
617 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
618 |
|
|
619 |
## hdds partitionieren manuell |
## hdds partitionieren manuell |
620 |
cfdisk ${HDD} || die |
cfdisk ${HDD} || dialog_die |
621 |
} |
} |
622 |
|
|
623 |
setup_hdd_format() |
setup_hdd_format() |
624 |
{ |
{ |
625 |
mkswap ${SWAPHDD} || die |
mkswap ${SWAPHDD} || dialog_die |
626 |
mke2fs -j -q ${BOOTHDD} || die |
mke2fs -j -q ${BOOTHDD} || dialog_die |
627 |
mke2fs -j -q ${ROOTHDD} || die |
mke2fs -j -q ${ROOTHDD} || dialog_die |
628 |
} |
} |
629 |
|
|
630 |
setup_hdd_format_flash() |
setup_hdd_format_flash() |
631 |
{ |
{ |
632 |
mke2fs -j -q ${ROOTHDD} || die |
mke2fs -j -q ${ROOTHDD} || dialog_die |
633 |
} |
} |
634 |
|
|
635 |
install_mount_rootfs() |
install_mount_rootfs() |
636 |
{ |
{ |
637 |
swapon ${SWAPHDD} || die |
swapon ${SWAPHDD} || dialog_die |
638 |
mount ${ROOTHDD} ${INSTALLPATH} || die |
mount ${ROOTHDD} ${INSTALLROOT} || dialog_die |
639 |
install -d ${INSTALLPATH}/boot || die |
install -d ${INSTALLROOT}/boot || dialog_die |
640 |
mount ${BOOTHDD} ${INSTALLPATH}/boot || die |
mount ${BOOTHDD} ${INSTALLROOT}/boot || dialog_die |
641 |
cd ${INSTALLPATH} || die |
cd ${INSTALLROOT} || dialog_die |
642 |
} |
} |
643 |
|
|
644 |
install_mount_rootfs_flash() |
install_mount_rootfs_flash() |
645 |
{ |
{ |
646 |
mount ${ROOTHDD} ${INSTALLPATH} || die |
mount ${ROOTHDD} ${INSTALLROOT} || dialog_die |
647 |
install -d ${INSTALLPATH}/boot || die |
install -d ${INSTALLROOT}/boot || dialog_die |
648 |
cd ${INSTALLPATH} || die |
cd ${INSTALLROOT} || dialog_die |
649 |
} |
} |
650 |
|
|
651 |
install_system_image() |
install_system_image() |
652 |
{ |
{ |
653 |
tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH} |
tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
654 |
} |
} |
655 |
|
|
656 |
install_bootsector_chroot() |
install_bootsector_chroot() |
657 |
{ |
{ |
658 |
local my_roothdd |
local my_roothdd |
659 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALLROOT}/boot/grub/grub.conf |
660 |
local grub2conf=/boot/grub/grub.cfg |
local grub2conf=/boot/grub/grub.cfg |
661 |
|
|
662 |
# check for grub2 |
# check for grub2 |
663 |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
664 |
then |
then |
665 |
# needed by grub-mkconfig on the first run |
# needed by grub-mkconfig on the first run |
666 |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
667 |
then |
then |
668 |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die |
install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
669 |
fi |
fi |
670 |
|
|
671 |
# set kernelopts |
# set kernelopts |
672 |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
673 |
then |
then |
674 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
675 |
else |
else |
676 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
677 |
fi |
fi |
678 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die |
679 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
680 |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
681 |
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die |
echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die |
682 |
|
|
683 |
# grub-legacy |
# grub-legacy |
684 |
else |
else |
685 |
### grubconf schreiben |
### grubconf schreiben |
686 |
source ${INSTALLPATH}/boot/kernelversion |
source ${INSTALLROOT}/boot/kernelversion |
687 |
|
|
688 |
#for alx only |
#for alx only |
689 |
if [ -e ${INSTALLPATH}/etc/alx_version ] |
if [ -e ${INSTALLROOT}/etc/alx_version ] |
690 |
then |
then |
691 |
OLD_ALXVER="${ALXVER}" |
OLD_ALXVER="${ALXVER}" |
692 |
source ${INSTALLPATH}/etc/alx_version |
source ${INSTALLROOT}/etc/alx_version |
693 |
KRNVER="ALX-${ALXVER}" |
KRNVER="ALX-${ALXVER}" |
694 |
ALXVER="${OLD_ALXVER}" |
ALXVER="${OLD_ALXVER}" |
695 |
fi |
fi |
706 |
my_roothdd="${ROOTHDD}" |
my_roothdd="${ROOTHDD}" |
707 |
fi |
fi |
708 |
|
|
709 |
: > ${grubconf} || die |
: > ${grubconf} || dialog_die |
710 |
echo "default 0" >> ${grubconf} || die |
echo "default 0" >> ${grubconf} || dialog_die |
711 |
echo "timeout 3" >> ${grubconf} || die |
echo "timeout 3" >> ${grubconf} || dialog_die |
712 |
# using current root password |
# using current root password |
713 |
echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die |
echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die |
714 |
|
|
715 |
echo >> ${grubconf} || die |
echo >> ${grubconf} || dialog_die |
716 |
echo "# normal boot" >> ${grubconf} || die |
echo "# normal boot" >> ${grubconf} || dialog_die |
717 |
echo "title ${KRNVER}" >> ${grubconf} || die |
echo "title ${KRNVER}" >> ${grubconf} || dialog_die |
718 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
719 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || dialog_die |
720 |
if is_initrd_supported |
if is_initrd_supported |
721 |
then |
then |
722 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
723 |
fi |
fi |
724 |
|
|
725 |
echo >> ${grubconf} || die |
echo >> ${grubconf} || dialog_die |
726 |
echo "# admin boot" >> ${grubconf} || die |
echo "# admin boot" >> ${grubconf} || dialog_die |
727 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || dialog_die |
728 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || dialog_die |
729 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
730 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || dialog_die |
731 |
if is_initrd_supported |
if is_initrd_supported |
732 |
then |
then |
733 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
734 |
fi |
fi |
735 |
|
|
736 |
echo >> ${grubconf} || die |
echo >> ${grubconf} || dialog_die |
737 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || dialog_die |
738 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || dialog_die |
739 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
740 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || dialog_die |
741 |
if is_initrd_supported |
if is_initrd_supported |
742 |
then |
then |
743 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
744 |
fi |
fi |
745 |
|
|
746 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
747 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
748 |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
749 |
root (hd0,0) |
root (hd0,0) |
750 |
setup (hd0) |
setup (hd0) |
754 |
CHROOTEOF |
CHROOTEOF |
755 |
fi |
fi |
756 |
|
|
757 |
## enters chroot |
## enter chroot |
758 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLROOT}/proc |
759 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLROOT}/sys |
760 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLROOT}/dev |
761 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
762 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLROOT}/proc |
763 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLROOT}/sys |
764 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLROOT}/dev |
765 |
rm ${INSTALLPATH}/root/.installrc |
rm ${INSTALLROOT}/root/.installrc |
766 |
} |
} |
767 |
|
|
768 |
is_initrd_supported() |
is_initrd_supported() |
769 |
{ |
{ |
770 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
771 |
[[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0 |
[[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0 |
772 |
return 1 |
return 1 |
773 |
} |
} |
774 |
|
|
799 |
fi |
fi |
800 |
|
|
801 |
# install an appropriate uvesafb.conf |
# install an appropriate uvesafb.conf |
802 |
install -d ${INSTALLPATH}/etc/modprobe.d || die |
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
803 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die |
804 |
|
|
805 |
# install an appropriate viafb.conf |
# install an appropriate viafb.conf |
806 |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die |
807 |
|
|
808 |
# install an appropriate i810fb.conf |
# install an appropriate i810fb.conf |
809 |
echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die |
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 |
810 |
|
|
811 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
812 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
813 |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
814 |
exit 0 |
exit 0 |
815 |
CHROOTEOF |
CHROOTEOF |
816 |
|
|
817 |
## enters chroot |
## enters chroot |
818 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLROOT}/proc |
819 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLROOT}/sys |
820 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLROOT}/dev |
821 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
822 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLROOT}/proc |
823 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLROOT}/sys |
824 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLROOT}/dev |
825 |
rm ${INSTALLPATH}/root/.installrc |
rm ${INSTALLROOT}/root/.installrc |
826 |
} |
} |
827 |
|
|
828 |
is_uuid_supported() |
is_uuid_supported() |
829 |
{ |
{ |
830 |
if [[ -x $(which busybox.mkinitrd &> /dev/null) ]] |
if [[ -x $(type -P busybox.mkinitrd) ]] |
831 |
then |
then |
832 |
# only detect uuids if supported |
# only detect uuids if supported |
833 |
if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] |
if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] |
846 |
local TYPE |
local TYPE |
847 |
|
|
848 |
local dev="$1" |
local dev="$1" |
849 |
[[ -z ${dev} ]] && die "no dev given" |
[[ -z ${dev} ]] && dialog_die "no dev given" |
850 |
|
|
851 |
# check if given device is already an UUID |
# check if given device is already an UUID |
852 |
if [[ ${dev/UUID=/}x != ${dev}x ]] |
if [[ ${dev/UUID=/}x != ${dev}x ]] |
863 |
# schreibe fstab |
# schreibe fstab |
864 |
if is_uuid_supported |
if is_uuid_supported |
865 |
then |
then |
866 |
echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die |
echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die |
867 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
868 |
else |
else |
869 |
echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die |
echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die |
870 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
871 |
fi |
fi |
872 |
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
873 |
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
874 |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
875 |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
876 |
|
|
877 |
# install network config skeleton |
# install network config skeleton |
878 |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die |
879 |
|
|
880 |
# intel framebufer quirk |
# intel framebufer quirk |
881 |
if [[ -e /proc/fb ]] |
if [[ -e /proc/fb ]] |
885 |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
886 |
if [[ ${fbdev} != 0 ]] |
if [[ ${fbdev} != 0 ]] |
887 |
then |
then |
888 |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
889 |
fi |
fi |
890 |
fi |
fi |
891 |
fi |
fi |
896 |
# schreibe fstab |
# schreibe fstab |
897 |
if is_uuid_supported |
if is_uuid_supported |
898 |
then |
then |
899 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die |
900 |
else |
else |
901 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die |
902 |
fi |
fi |
903 |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
904 |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
905 |
} |
} |
906 |
|
|
907 |
install_umount_rootfs() |
install_umount_rootfs() |
908 |
{ |
{ |
909 |
cd / |
cd / |
910 |
umount ${INSTALLPATH}/boot || die |
umount ${INSTALLROOT}/boot || dialog_die |
911 |
umount ${INSTALLPATH} || die |
umount ${INSTALLROOT} || dialog_die |
912 |
swapoff ${SWAPHDD} || die |
swapoff ${SWAPHDD} || dialog_die |
913 |
} |
} |
914 |
|
|
915 |
install_umount_rootfs_flash() |
install_umount_rootfs_flash() |
916 |
{ |
{ |
917 |
cd / |
cd / |
918 |
umount ${INSTALLPATH} || die |
umount ${INSTALLROOT} || dialog_die |
919 |
} |
} |
920 |
|
|
921 |
install_do_reboot() |
install_do_reboot() |