47 |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
48 |
|
|
49 |
CDPATH="${DEFAULT_CDPATH}" |
CDPATH="${DEFAULT_CDPATH}" |
50 |
INSTALLPATH="${DEFAULT_INSTALLPATH}" |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
51 |
|
|
52 |
# standard kernel opts |
# standard kernel opts |
53 |
KERNELOPTS="quiet video=1024x768" |
KERNELOPTS="quiet video=1024x768" |
637 |
install_mount_rootfs() |
install_mount_rootfs() |
638 |
{ |
{ |
639 |
swapon ${SWAPHDD} || dialog_die |
swapon ${SWAPHDD} || dialog_die |
640 |
mount ${ROOTHDD} ${INSTALLPATH} || dialog_die |
mount ${ROOTHDD} ${INSTALLROOT} || dialog_die |
641 |
install -d ${INSTALLPATH}/boot || dialog_die |
install -d ${INSTALLROOT}/boot || dialog_die |
642 |
mount ${BOOTHDD} ${INSTALLPATH}/boot || dialog_die |
mount ${BOOTHDD} ${INSTALLROOT}/boot || dialog_die |
643 |
cd ${INSTALLPATH} || dialog_die |
cd ${INSTALLROOT} || dialog_die |
644 |
} |
} |
645 |
|
|
646 |
install_mount_rootfs_flash() |
install_mount_rootfs_flash() |
647 |
{ |
{ |
648 |
mount ${ROOTHDD} ${INSTALLPATH} || dialog_die |
mount ${ROOTHDD} ${INSTALLROOT} || dialog_die |
649 |
install -d ${INSTALLPATH}/boot || dialog_die |
install -d ${INSTALLROOT}/boot || dialog_die |
650 |
cd ${INSTALLPATH} || dialog_die |
cd ${INSTALLROOT} || dialog_die |
651 |
} |
} |
652 |
|
|
653 |
install_system_image() |
install_system_image() |
654 |
{ |
{ |
655 |
tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH} |
tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
656 |
} |
} |
657 |
|
|
658 |
install_bootsector_chroot() |
install_bootsector_chroot() |
659 |
{ |
{ |
660 |
local my_roothdd |
local my_roothdd |
661 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALLROOT}/boot/grub/grub.conf |
662 |
local grub2conf=/boot/grub/grub.cfg |
local grub2conf=/boot/grub/grub.cfg |
663 |
|
|
664 |
# check for grub2 |
# check for grub2 |
665 |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
666 |
then |
then |
667 |
# needed by grub-mkconfig on the first run |
# needed by grub-mkconfig on the first run |
668 |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
669 |
then |
then |
670 |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || dialog_die |
install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
671 |
fi |
fi |
672 |
|
|
673 |
# set kernelopts |
# set kernelopts |
674 |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
675 |
then |
then |
676 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || dialog_die |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
677 |
else |
else |
678 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || dialog_die |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
679 |
fi |
fi |
680 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || dialog_die |
echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die |
681 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || dialog_die |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
682 |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || dialog_die |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
683 |
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || dialog_die |
echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die |
684 |
|
|
685 |
# grub-legacy |
# grub-legacy |
686 |
else |
else |
687 |
### grubconf schreiben |
### grubconf schreiben |
688 |
source ${INSTALLPATH}/boot/kernelversion |
source ${INSTALLROOT}/boot/kernelversion |
689 |
|
|
690 |
#for alx only |
#for alx only |
691 |
if [ -e ${INSTALLPATH}/etc/alx_version ] |
if [ -e ${INSTALLROOT}/etc/alx_version ] |
692 |
then |
then |
693 |
OLD_ALXVER="${ALXVER}" |
OLD_ALXVER="${ALXVER}" |
694 |
source ${INSTALLPATH}/etc/alx_version |
source ${INSTALLROOT}/etc/alx_version |
695 |
KRNVER="ALX-${ALXVER}" |
KRNVER="ALX-${ALXVER}" |
696 |
ALXVER="${OLD_ALXVER}" |
ALXVER="${OLD_ALXVER}" |
697 |
fi |
fi |
712 |
echo "default 0" >> ${grubconf} || dialog_die |
echo "default 0" >> ${grubconf} || dialog_die |
713 |
echo "timeout 3" >> ${grubconf} || dialog_die |
echo "timeout 3" >> ${grubconf} || dialog_die |
714 |
# using current root password |
# using current root password |
715 |
echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die |
echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die |
716 |
|
|
717 |
echo >> ${grubconf} || dialog_die |
echo >> ${grubconf} || dialog_die |
718 |
echo "# normal boot" >> ${grubconf} || dialog_die |
echo "# normal boot" >> ${grubconf} || dialog_die |
746 |
fi |
fi |
747 |
|
|
748 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
749 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
750 |
/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 |
751 |
root (hd0,0) |
root (hd0,0) |
752 |
setup (hd0) |
setup (hd0) |
757 |
fi |
fi |
758 |
|
|
759 |
## enter chroot |
## enter chroot |
760 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLROOT}/proc |
761 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLROOT}/sys |
762 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLROOT}/dev |
763 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
764 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLROOT}/proc |
765 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLROOT}/sys |
766 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLROOT}/dev |
767 |
rm ${INSTALLPATH}/root/.installrc |
rm ${INSTALLROOT}/root/.installrc |
768 |
} |
} |
769 |
|
|
770 |
is_initrd_supported() |
is_initrd_supported() |
771 |
{ |
{ |
772 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
773 |
[[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0 |
[[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0 |
774 |
return 1 |
return 1 |
775 |
} |
} |
776 |
|
|
801 |
fi |
fi |
802 |
|
|
803 |
# install an appropriate uvesafb.conf |
# install an appropriate uvesafb.conf |
804 |
install -d ${INSTALLPATH}/etc/modprobe.d || dialog_die |
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
805 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || dialog_die |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die |
806 |
|
|
807 |
# install an appropriate viafb.conf |
# install an appropriate viafb.conf |
808 |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || dialog_die |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die |
809 |
|
|
810 |
# install an appropriate i810fb.conf |
# install an appropriate i810fb.conf |
811 |
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 || dialog_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 |
812 |
|
|
813 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
814 |
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 |
815 |
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 |
816 |
exit 0 |
exit 0 |
817 |
CHROOTEOF |
CHROOTEOF |
818 |
|
|
819 |
## enters chroot |
## enters chroot |
820 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLROOT}/proc |
821 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLROOT}/sys |
822 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLROOT}/dev |
823 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
824 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLROOT}/proc |
825 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLROOT}/sys |
826 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLROOT}/dev |
827 |
rm ${INSTALLPATH}/root/.installrc |
rm ${INSTALLROOT}/root/.installrc |
828 |
} |
} |
829 |
|
|
830 |
is_uuid_supported() |
is_uuid_supported() |
865 |
# schreibe fstab |
# schreibe fstab |
866 |
if is_uuid_supported |
if is_uuid_supported |
867 |
then |
then |
868 |
echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die |
869 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
870 |
else |
else |
871 |
echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die |
872 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
873 |
fi |
fi |
874 |
# 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 |
875 |
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
876 |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
877 |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
878 |
|
|
879 |
# install network config skeleton |
# install network config skeleton |
880 |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || dialog_die |
install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die |
881 |
|
|
882 |
# intel framebufer quirk |
# intel framebufer quirk |
883 |
if [[ -e /proc/fb ]] |
if [[ -e /proc/fb ]] |
887 |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
888 |
if [[ ${fbdev} != 0 ]] |
if [[ ${fbdev} != 0 ]] |
889 |
then |
then |
890 |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || dialog_die |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
891 |
fi |
fi |
892 |
fi |
fi |
893 |
fi |
fi |
898 |
# schreibe fstab |
# schreibe fstab |
899 |
if is_uuid_supported |
if is_uuid_supported |
900 |
then |
then |
901 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die |
902 |
else |
else |
903 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die |
904 |
fi |
fi |
905 |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
906 |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
907 |
} |
} |
908 |
|
|
909 |
install_umount_rootfs() |
install_umount_rootfs() |
910 |
{ |
{ |
911 |
cd / |
cd / |
912 |
umount ${INSTALLPATH}/boot || dialog_die |
umount ${INSTALLROOT}/boot || dialog_die |
913 |
umount ${INSTALLPATH} || dialog_die |
umount ${INSTALLROOT} || dialog_die |
914 |
swapoff ${SWAPHDD} || dialog_die |
swapoff ${SWAPHDD} || dialog_die |
915 |
} |
} |
916 |
|
|
917 |
install_umount_rootfs_flash() |
install_umount_rootfs_flash() |
918 |
{ |
{ |
919 |
cd / |
cd / |
920 |
umount ${INSTALLPATH} || dialog_die |
umount ${INSTALLROOT} || dialog_die |
921 |
} |
} |
922 |
|
|
923 |
install_do_reboot() |
install_do_reboot() |