#!/bin/ash echo " *** Anfang copysys: macht Installierung incl. lilo *** " NAME="SYS" ; VERSION="0.23-r4+" # Wird ggf. von mkcdiso geaendert, oder besser manuell damit bei 'current' letzte Version echo " Name: " $NAME " Version: " $VERSION # Beispiel: NAME=SYS_Linux VERSION=0.20-rc3 VON1="" ## Ordner wo lzma -Datei ist ggf /xxx MD5CHK=0 # =1 falls md5 vom kompaktierten System testen DEVZERO="if=/dev/zero" mkdir -p /von ; mkdir -p /nach # sollte schon da sein, wird in mkdev gemountet, da Groesse fuer alles weitere noetig ist # 1. Einlesen der Install-Details von installinfo , insbesondere nach welcher Partition NACH auf Platte NACO0 installieren read TST SIZE NACH0 NACH VON KLEINER OLDSYS WINDOWS REST < installinfo echo " copysys Anfang: TST SIZE NACH0 NACH VON KLEINER OLDSYS WINDOWS: " echo $TST $SIZE $NACH0 $NACH $VON $KLEINER $OLDSYS $WINDOWS read FESTPLATTEN < festplatten echo "Festplatten: " $FESTPLATTEN for I0 in hda hdb hdc hdd sda sdb sdc sdd uba ubb ubc ubd ; do if test /dev/$I0 = $NACH0 ; then NACH00=/$I0 ; fi ; done echo " Eingabe von copysys: " echo "neue Partition: Platte: " $NACH0 " Platte ohne /dev: " $NACH00 " Name : " $NACH echo " altes System: " $OLDSYS " Windows: " $WINDOWS echo " Install-Platte: " $NACH0 " Install-Partition: " $NACH " Groesse: " $SIZE ls -l $NACH echo " Partitionen: " #/sbin/parted -s $NACH0 unit s print /sbin/fdisk -lu $NACH0 echo "***" ; echo "*** was in /dev/disk gefunden wurde: " ; echo "***" DEV1="" ; DEV2="" ; DEV3="" ; DEV4="" read DEV1 DEV2 DEV3 DEV4 REST < devs echo " Geraete: " $DEV1 $DEV2 $DEV3 $DEV4 PART1="" ; PART2="" ; PART3="" ; PART4="" ; PART5="" ; PART6="" ; PART7="" ; PART8="" read PART1 PART2 PART3 PART4 PART5 PART6 PART7 PART8 REST < parts echo " Partitionen: " $PART1 $PART2 $PART3 $PART4 $PART5 $PART6 $PART7 $PART8 echo "*** Install- CD: " $VON " gemountet nach /von " # 3. kompaktiertes System SYS_Linux.ext3.lmza in device VON (/von$VON1) nach Partition NACH deskompaktieren / kopieren cd /von$VON1 ls *.ext3.lzma > /scr # Achtung wir sind auf read-only FS vom CD/DVD = /von , schreiben also nach /... #ls *.ext3.lrz > /scr # lzo, lzr ist nicht in busybox read NV REST < /scr # NV ist meist SYS_Linux[-Version].ext3.lzma . Ggf Art .lzma , .bz2 abspalten, nachf. nutzen echo " Auf CD/DVD kompaktierte Datei: " $NV " gefunden. " /von/$NV " wird nach Partition " $NACH " geschrieben " cd / # wieder beschreibbar echo "Inhalt des CDs:" ls -l /von ls -l /von$VON1 # Hier sollte die kompaktierte Installation sein echo "***" ; echo "kopiert wird " /von$VON1/$NV " nach " $NACH " :" ; echo "***" ls -l /von$VON1/$NV ; ls -l $NACH # Quelle und Ziel der Installation # Test ob md5 vom .lzma richtig ist (dauert 3 Min.) if test $MD5CHK = 1 ; then md5sum /von$VON1/$NV > /scr ; read MD5IST REST < /scr ; read MD5SOLL REST < /von$VON1/$NV.md5 echo "md5 vom .lzma: " $MD5IST ; echo " soll sein: " $MD5SOLL if test $MD5IST != $MD5SOLL ; then echo " Problem Install-CD " ; echo "20 Install-CD defekt, md5 falsch" > rescue ; exit ; fi ; fi ; umount $NACH # Falls mit chroot gestartet, muss Partition auch ausserhalb umount sein, sonst Probleme mit resize echo "vor dd if=/dev/zero of=nach : " ; ls -l $NACH dd $DEVZERO of=$NACH bs=100k count=5 ; sync sleep 3 #/bin/dd if=/von$VON1/SYS_Linux.ext3 of=$NACH # falls normal kopiert #/bin/bunzip2 -c /von$VON1/SYS_Linux.ext3.bz2 > $NACH # falls kompaktiert mit bzip2 -9 -fck $VON > /SYS_linux.ext3.bz2 echo "lzcat von / nach: " /von$VON1/$NV $NACH ; ls -l /von$VON1/$NV ; ls -l $NACH ; sync echo "Zeit Beginn/Ende lzcat:" date /usr/bin/lzcat < /von$VON1/$NV > $NACH # ACHTUNG lzmacat v. busybox geht nicht richtig, Ende Datei fehlt # " lzma -7 -fk date sleep 10 # ... und Decoder Error bedeutet, das DVD kann nicht gelesen werden #killall -HUP sleep ; killall -HUP sleep # externer Dialog: wait stoppen, letztes wait stoppen sync #sync ; kill -HUP `lsof -t $NACH` >> logfile 2>&1 #hdparm -fF $NACH0 >> logfile 2>&1 ; hdparm -z $NACH0 >> logfile 2>&1 echo "Kopieren fertig" tune2fs -i 0 -c 0 $NACH # damit selbst bei sehr altem Install-DVD kein check da letzter mount aelter als 30 Tage #tune2fs -m 0 $NACH echo "vor resize : " ; ls -l $NACH echo "resize:" echo " " > rs echo " \Z1 Redimensionar / Vergroessern : " $NACH " \Zn" >> rs #echo " \Z1 para / zu " ... " \Zn" >> rs echo " " >> rs echo "Zeit Beginn/Ende resize:" date resize2fs -fpF $NACH >> rs ; RESIZERR=$? # Manchmal geht resize nicht. Wir geben etwas mehr Zeit um lzcat ganz zu beenden, und alles zu flushen, danach ggf in shell if test $RESIZERR != 0 ; then sleep 30 ; sync ; tune2fs -i 0 -c 0 $NACH ; mount $NACH /nach ; df | grep -v "tmpfs" ; umount $NACH ; resize2fs -fp $NACH ; RESIZERR=$? if test $RESIZERR != 0 ; then hdparm -fF $NACH0 ; hdparm -z $NACH0 ; sync ; resize2fs -fpF $NACH >> rs ; RESIZERR=$? ; fi ; fi ; date #sync echo "resize fertig " >> rs echo "resize fertig " $RESIZERR #killall -HUP sleep ; rm -f rs ; killall -HUP sleep # externer Dialog: wait stoppen und def. rs ausgeben; rs loeschen; letztes wait stoppen mv -f rs tmp/resize.copysys ; rm -f rs # damit's auch sicher weg ist #echo "check" #e2fsck -fy $NACH # ĂberflĂĽssig wenn erstelltes Install-CD gut, ggf beim ersten Gebrauch machen #e2fsck -y $NACH # 2. mal nur noch wenn unclean sync echo "kopiertes System mounten:" echo "vor mount : " ; ls -l $NACH /bin/mount $NACH /nach ; if test $? -ne 0 ; then echo " Problem Install-Ziel " ; echo "1 Ziel-Disk nicht oeffenbar" > rescue ; fi ; echo "System nach " $NACH " kopiert und als /nach gemountet: " df | grep -v "tmpfs" /bin/ls -l /nach echo "ggf. vhd. leere Platzhalter-Datei /nach/leer loeschen um auch bei fehlgeschlagenem resize ein konfigurierbares System zu haben: " rm -f /nach/leer # kann bei Erstellen des .lzma schon nach resize -M aber vor lzma-Packen, geloescht werden date cp -a $NACH /nach/dev ; cp -a $NACH0 /nach/dev ; cp -a $NACH0* /nach/dev # sicherheitshalber Eintraege in /dev fuer Ziel dorthin kopieren chroot /nach /bin/mount proc /proc -t proc echo " was jetzt alles gemountet ist: " ; /bin/mount ; sync # installlog schon mal soweit kopieren, falls spaeter Absturz mkdir -p /nach/var/log rm -f /nach/var/log/SYS_Linux.install.log cp -f /logfile /nach/var/log/SYS_Linux.install.log ; echo "nach installiertem System mounten: logfile gerettet nach /var/log/SYS_Linux.install.log" cp -f /logfile /nach/SYS_Linux.install.log ; echo "nach installiertem System mounten: logfile gerettet nach /SYS_Linux.install.log" ln -sf /var/log/SYS_Linux.install.log /nach/etc/SYS/SYS_Linux.install.log echo -e "\n logfile gerettet" sync # 3.1. Korrekturen / ZusĂtze . fĂr .lzma und .config Skripte bezogen auf / der Installation, nicht auf Inst-Prog !!! # 3.1.1 Pakete upgraden / installieren # 3.1.1.1 Pakete im Ordner tgz installieren # Von HIER aus, da Zielsystem leer sein kann (ganz paketmaesige Instalierung) oder rpm-System ohne pkgtools installiert date echo "Pakete .tgz zusaetzlich installieren:" ; ls /von/to_install/*.tgz #mv /var/log/packages /var/log/packages0 #ln -s /nach/var/log/packages /var/log/packages # da Problem: pkg-Liste unter /nach wird hier nicht gefunden #ls /var/log/packages > /nach/var/log/SYS_Linux.install.packages # spaeter raus #cd /sbin ; ROOT=/nach upgradepkg --install-new --reinstall /von/to_install/*.tgz ; cd - # in Ordner gehen wo pkgtools sind cd /sbin ; installpkg -root /nach /von/to_install/*.tgz cd - # in Ordner gehen wo pkgtools sind #### :( :( aus irgendwelchen bescheuerten Gruenden geht trotzalldem upgrade nicht, #### nur install aber kein remove der alten Pakete :( :( #### Daher statt der beiden obigen Anweisungen, ggf. in to_upgrade tun, also ins installierte System chrooten und dort upgraden , #### dabei ist man darauf angewiesen dass dort pkgtool installiert ist, und dass die Pakete dort on-the-fly ersetzbar sind :( ### Falls hier ein neuer Kernel ist und/da lilo nicht geht, ein lilo.conf mit beiden Kerneln ### und mit append = ...aber ohne root = hinzufuegen, root wird dann unten eingesetzt und lilo danach gestartet # Achtung ! Bei anderem Kernel als des Install-Progs, oder Aenderung des Kernels - besser, ueberhaupt - alle # Kernel -Versions-abhaengigen Sachen beim ersten Laufen des Systemes upgraden (fuse, ndiskwrapper, madwifi, ntfs-3g) !! df | grep -v "tmpfs" echo "nach Pakete .tgz zusaetzlich installieren: lilo: " ; ls -l /nach/etc/lilo.conf mkdir -p /nach/tmp/tgz cp -faR /von/to_upgrade/*.tgz /von/to_upgrade/*.txt /von/to_upgrade/*.asc /von/to_upgrade/*.md5 /nach/tmp/tgz echo "Pakete .tgz zusaetzlich installieren/upgraden:" ; ls -lR /nach/tmp/tgz/*.tgz chroot /nach upgradepkg --install-new --reinstall /tmp/tgz/*.tgz rm -r /nach/tmp/tgz # Zum Test mal nicht loeschen, erst speaeter wenns funktioniert # 3.1.1.2 Pakete im Ordner rpm installieren # Ein .rpm-System hängt extrem von der Version des rpm-Progs und der Datenbank (db3, db4) ab, und geht bei Inkompatiblitaeten # schnell hops. Ausserdem ist das rpm-Programm elefantĂs. Daher chroot in das installierte System und ausfĂĽhrenDORT date mkdir -p /nach/tmp/rpm ; cp -faR /von/to_upgrade/*.rpm /nach/tmp/rpm echo "Pakete .rpm zusaetzlich installieren/upgraden:" ; ls -lR /nach/tmp/rpm/*.rpm chroot /nach rpm -Uhv --replacepkgs --replacefiles --nodeps /tmp/rpm/*.rpm rm -r /nach/tmp/rpm # Zum Test erst mal nicht loeschen # Wenn der Kernel upgedatet wird, unter Kopieren ein /etc/lilo.conf tun !! echo "nach Pakete .tgz, .rpm zusaetzlich upgraden: lilo: " ; ls -l /nach/etc/lilo.conf # 3.1.1.3 Kopieren was firstrun upgedated wird mkdir -p /nach/tmp/upgrade ; cp -faR /von/to_upgrade_firstrun/* /nach/tmp/upgrade echo "Pakete kopiert um bei erstem Gebrauch zu upgraden:" ; ls -lR /nach/tmp/upgrade # 3.1.2 Alles im Ordner copy , ĂĽber die Installation kopieren: erst direkt, dann nochmal mit chroot echo "direkt kopieren: " ; ls -l /von/to_copy/* cp -fdRpP /von/to_copy/* /nach # direktes kopieren echo "nach Dateien zusaetzlich direkt-kopieren: lilo: " ; ls -l /nach/etc/lilo.conf mkdir -p /nach/tmp/copy ; cp -fdRpP /von/to_copy/* /nach/tmp/copy # erst mal in leeren Ordner in Ziel kopieren, da ash doof ist echo -e "\n einfach zu kopierende Korrekturen an Installation anbringen: " ; ls -lR /nach/tmp/copy chroot /nach cp -fdRpP /tmp/copy/* / # im Ziel mit bash kopieren, denn mit ash und cp in initrd geht manches nicht rm -r /nach/tmp/copy sync df | grep -v "tmpfs" echo "nach Dateien zusaetzlich chroot-kopieren: lilo: " ; ls -l /nach/etc/lilo.conf # 3.2 Korrekturen des .lzma -Files / gepackter Installation # 3.2.1 Skript .corrections ausfĂĽhren, .firstrun vorbereiten sodass beim ersten booten benutzt date mkdir -p /nach/etc/SYS cp -f /von/$NV.corrections /nach/etc/SYS/corrections # Korrekturen des .lzma die beim nĂchsten nicht mehr nĂtig, ausgef. postinstall cp -f /von/$NV.firstrun /nach/etc/SYS/firstrun # zusĂtzl. Konfig zu dem unten, zBsp distroabhängig. ausgef. nach rc.local cp -f /von/SYS*.pdf /von/SYS*.rtf /nach # aktuelle Beschreibung von SYS falls auf Install-.iso cp -f /von/*.txt /von/*LIESMICH* /von/*README* /von/*.png /von/mkbootcd* /von/mkcdiso* /von/auto.SlackBuild* \ /von/mkpackage* /von/vorbereitung /nach/etc/SYS chmod +x /nach/etc/SYS/firstrun ; chmod +x /nach/etc/SYS/corrections echo "Korrekturen jetzt / bei erster Anwendung:" ; ls -lR /nach/etc/SYS # corrections hier gleich ausfĂĽhren echo "mv /etc/SYS/corrections /etc/SYS/corrections.gemacht " >> /nach/etc/SYS/corrections # Skript soll sich, nachdem 1x durchlaufen, desaktivieren chroot /nach /etc/SYS/corrections # Konfigs die vom Ziel- Rechner abhaengen, auch nach direktem Kopieren # des Systemes anzubringen sind, daher ggf zu eigenem Unterprogramm machen # Einige bestaendige Korrekturen an rc.local, vor den firstrun-Zusaetzen # 3.2.2 zu Laufzeit firstrun am Schluss von rc.local ausfĂĽhren, anschliessend einen Aufruf in rc.local lĂschen und # sich selbst in firstrun.gemacht umbenennen # vor SYS_Linux...firstrun , Pakete in /to_upgrade_firstrun installieren ## Diese firstrun-Sachen demnaechst mal in ein eigenes skript schreiben was kpl ## an rc.local angehaengt wird # screensaver ausschalten waehrend firstrun-update und definitiv date echo "/bin/setterm -powersave off -blank 0 # auf Konsole schicken, nicht umleiten" >> /nach/etc/rc.d/rc.local ### rc.local wie es fuer installiertes System verwendet wird, retten nach rc.local.war , Zusaetze sind nur fuer firstrun an dessem # Schluss dann rc.local zurueckkopiert wird cat /nach/etc/rc.d/rc.local > /nach/etc/rc.d/rc.local.war ; chmod +x /nach/etc/rc.d/rc.local ### Zusaetze was bei firstrun auszufuehren ist. # Zuerst online-resize versuchen, falls resize waehrend Installation nicht ging weil Kernel neue Partitions-Tabelle nicht updaten wollte if test $RESIZERR != 0 ; then echo "resize2fs -fpF $NACH " >> /nach/etc/rc.d/rc.local ; fi ; # online-resize / beim firstrun echo "rm -r /install 2> /dev/zero " >> /nach/etc/rc.d/rc.local # Reste von Debian-Kram von Korr. zur Installationszeit echo "mv /SYS_Linux.install.log /var/log/SYS_Linux.install.log.dup 2> /dev/zero " >> /nach/etc/rc.d/rc.local echo "echo " >> /nach/etc/rc.d/rc.local ; echo "df " >> /nach/etc/rc.d/rc.local ; echo "echo " >> /nach/etc/rc.d/rc.local echo "echo === ; echo === " >> /nach/etc/rc.d/rc.local echo "echo === atualizacao de pacotes-do-ultimo-instante adicionados no DVD ... " >> /nach/etc/rc.d/rc.local echo "echo === last-minute Pakete vom Install-DVD upgraden ... " >> /nach/etc/rc.d/rc.local echo "echo === upgrade last-minute packages added to the install-DVD ... " >> /nach/etc/rc.d/rc.local echo "echo === ; echo === " >> /nach/etc/rc.d/rc.local echo "upgradepkg --install-new --reinstall /tmp/upgrade/*.tgz 2> /dev/zero " >> /nach/etc/rc.d/rc.local #echo "rm -r /install 2> /dev/zero " >> /nach/etc/rc.d/rc.local # Reste von Debian-Kram echo "rpm -Uhv --replacepkgs --replacefiles --nodeps /tmp/upgrade/*.rpm 2> /dev/zero " >> /nach/etc/rc.d/rc.local echo "rm -r /install 2> /dev/zero " >> /nach/etc/rc.d/rc.local # Reste von Debian-Kram loeschen echo "rm -r /tmp/upgrade 2> /dev/zero " >> /nach/etc/rc.d/rc.local # Teil von firstrun der auf Install-DVD war, vor Konfiguration zBsp korrigierte driver, config files, links noetig zur Konfig echo "/etc/SYS/firstrun 2> /dev/zero " >> /nach/etc/rc.d/rc.local echo "echo === reinstalar LILO ..." >> /nach/etc/rc.d/rc.local echo "/sbin/lilo -b $NACH0 " >> /nach/etc/rc.d/rc.local # lilo nochmal installieren, falls SYS nicht gebootet hat und indirekt gestartet # Minimal-Konfiguration video / sound bei firstrun (noch nicht jetzt, da firstrun update von Paketen / Programmen moeglich) echo "echo === " >> /nach/etc/rc.d/rc.local echo "cat /root/.kde/share/apps/kdesktop/IconPositions.add >> /root/.kde/share/apps/kdesktop/IconPositions" >> /nach/etc/rc.d/rc.local echo "echo === adaptar som ..." >> /nach/etc/rc.d/rc.local echo "echo === Sound einstellen ..." >> /nach/etc/rc.d/rc.local echo "echo === adapt sound ..." >> /nach/etc/rc.d/rc.local echo "echo === " >> /nach/etc/rc.d/rc.local echo "/usr/sbin/alsaconfauto > /etc/SYS/alsaconf.log 2>&1 ; mv /usr/sbin/alsaconfauto /usr/sbin/alsaconfauto.fertig" >> /nach/etc/rc.d/rc.local echo "echo === Falls kein sound hoerbar, Volumen regeln mit kmix " >> /nach/etc/rc.d/rc.local echo "echo === Se nao se ouvir nenhum som, regula-o com kmix " >> /nach/etc/rc.d/rc.local echo "echo === " >> /nach/etc/rc.d/rc.local echo "echo === testar a grafica, procurar o melhor driver ..." >> /nach/etc/rc.d/rc.local echo "echo === Grafik testen, Treiber waehlen ..." >> /nach/etc/rc.d/rc.local echo "echo === test the grafics and select the best driver ..." >> /nach/etc/rc.d/rc.local echo "echo === " >> /nach/etc/rc.d/rc.local echo "/etc/X11/sysxtest 2> /etc/SYS/sysxtest.log 1>&2 ; mv /etc/X11/sysxtest /etc/X11/sysxtest.fertig " >> /nach/etc/rc.d/rc.local # xorg.conf waehlen # 1x duchlaufen, eigenes umbenennen / loeschen echo "cat /etc/rc.d/rc.local > /etc/SYS/rc.local.firstrun " >> /nach/etc/SYS/firstrun echo "cat /etc/rc.d/rc.local.war > /etc/rc.d/rc.local ; chmod +x /nach/etc/rc.d/rc.local " >> /nach/etc/SYS/firstrun echo "mv /etc/SYS/firstrun /etc/SYS/firstrun.gemacht " >> /nach/etc/SYS/firstrun sync date cp -f /logfile /nach/var/log/SYS_Linux.install.log ; echo "nach Erzeugen vom firstrun rc.local: logfile gerettet nach /var/log/SYS_Linux.install.log" cp -f /logfile /nach/SYS_Linux.install.log ; echo "nach Erzeugen vom firstrun rc.local: logfile gerettet nach /SYS_Linux.install.log" # installlog schon mal soweit kopieren, falls spaeter Absturz sync echo -e "\n Alle Korrekturen der Instalation angebracht" # Konfiguration # 4. fstab , lilo.conf der Installierung anpassen, lilo im MBR von Platte NACH0 installieren echo " 4. lilo.conf und fstab auf " $NACH " einrichten: Partition-Nr mit altem System: " $OLDSYS " Windows: " $WINDOWS cd /nach/etc # 4.1. fstab machen #mkdir -p /nach/"$NACH00"1 ; mkdir -p /nach/"$NACH00"2 ; mkdir -p /nach/"$NACH00"3 ; mkdir -p /nach/"$NACH00"4 # haengt davon ab ob in Ziel-Computer NACH00=sdX oder hdX ist # Nur Partitionen/ Systeme auf derjenigen Festplatte betrachten wo wir SYS installieren, nicht auf anderen #mkdir -p /nach/hda1 ; mkdir -p /nach/hda2 ; mkdir -p /nach/hda3 ; mkdir -p /nach/hda4 #mkdir -p /nach/sda1 ; mkdir -p /nach/sda2 ; mkdir -p /nach/sda3 ; mkdir -p /nach/sda4 cat fstab > fstab.old echo $NACH " / auto defaults 0 1 " > fstab cp -f /nach/root/.kde/share/apps/kdesktop/IconPositions /nach/root/.kde/share/apps/kdesktop/IconPositions.alt rm /nach/root/Desktop/Windows.desktop test $WINDOWS = - ; if test $? -ne 0 ; then # Desktop-Icon fuer Windows machen echo -e "\n[Desktop Entry] \nEncoding=UTF-8 \nIcon=unknown \nType=Link \nURL=/Windows " > /nach/root/Desktop/Windows.desktop echo -e "\n[IconPosition::Windows.desktop] \nXabs=314 \nXabs_1024x768=314 \nYabs=503 \nYabs_1024x768=503" >> /nach/root/.kde/share/apps/kdesktop/IconPositions mkdir -p /nach/Windows ; echo $WINDOWS " /Windows ntfs-3g defaults 0 0 " >> fstab # ntfs-3g muss in SYS vhd sein fi ; echo "Desktop Icon fuer Windows gemacht : " $WINDOWS rm /nach/root/Desktop/OldSystem.desktop test $OLDSYS = $WINDOWS ; if test $? -ne 0 ; then test $OLDSYS = - ; if test $? -ne 0 ; then echo -e "\n[Desktop Entry] \nEncoding=UTF-8 \nIcon=unknown \nType=Link \nURL=/OldSystem " > /nach/root/Desktop/OldSystem.desktop echo -e "\n[IconPosition::OldSystem.desktop] \nXabs=326 \nXabs_1024x768=326 \nYabs=582 \nYabs_1024x768=582" >> /nach/root/.kde/share/apps/kdesktop/IconPositions mkdir -p /nach/OldSystem ; echo $OLDSYS " /OldSystem auto defaults 0 0 " >> fstab fi ; echo "Desktop Icon fuer OldSystem gemacht : " $OLDSYS fi ; cp -f /nach/root/.kde/share/apps/kdesktop/IconPositions /nach/root/.kde/share/apps/kdesktop/IconPositions.neu echo "Festplatten: " $FESTPLATTEN for J0 in 1 2 3 4 5 ; do echo $NACH0$J0 $NACH00$J0 " auto defaults 0 0 " >> fstab # Part. 1-5 von Ziel-Disk in /etc/fstab eintragen mkdir -p /nach/$NACH00$J0 # in /nach leere Ordner /sda1,2,3,4 bzw /hda1,2,3,4 machen rm -f /nach/system$J0 ; ln -s $NACH00$J0 /nach/system$J0 # ... dorthin links sodass Systeme system1 ,system2 heissen fuer desktop-icons / -fenster for I0 in $FESTPLATTEN ; do # besser PARTITIONEN nehmen if test /dev/$I0 != $NACH0 ; then mkdir -p /nach/$I0$J0 ; echo /dev/$I0$J0 $I0$J0 " auto defaults 0 0 " >> fstab ; fi ; done done grep -v " / " fstab.old >> fstab # Ausser Zeile fuer root, das ganze alte fstab anhaengen sodass ale Bezeichnungen usw erhalten bleiben echo " *** fstab : ***" cat /nach/etc/fstab date cp -f /logfile /nach/var/log/SYS_Linux.install.log ; echo "nach Erzeugen von konfig, vor lilo: logfile gerettet nach /var/log/SYS_Linux.install.log" cp -f /logfile /nach/SYS_Linux.install.log ; echo "nach Erzeugen von konfig, vor lilo: logfile gerettet nach /SYS_Linux.install.log" # installlog schon mal soweit kopieren, falls spaeter Absturz sync # 4.2. lilo.conf , lilo ls -l /nach/boot echo "vhd. Kernel: " ; ls -l /nach/boot/vmlinuz* echo "vhd. Init-Ramdisk: " ; ls -l /nach/boot/initrd* /sbin/rdev /nach/boot/vmlinuz $NACH ; /sbin/rdev -R /nach/boot/vmlinuz 1 # geht nur wenn link vmlinuz / initrd.gz zu genauem Name vhd /sbin/rdev /nach/boot/initrd.cpio.gz $NACH ; /sbin/rdev -R /nach/boot/initrd.cpio.gz 1 echo " lilo.conf / lilo auf " $NACH " mit boot-device " $NACH0 " einrichten : " cat lilo.conf > lilo.conf.old echo " boot = " $NACH0 " " > lilo.conf # neue boot-Zeile echo " root = " $NACH " " >> lilo.conf # neue root-Zeile echo " menu-title = \"*** SYS $VERSION System Start ***\" " >> lilo.conf grep -v "/dev/" lilo.conf.old >> lilo.conf # Kopie von lilo.conf OHNE alter boot / root -Zeile if test $WINDOWS != - ; then echo "#other = " $WINDOWS >> lilo.conf ; echo "# label = Windows " >> lilo.conf ; fi ; echo " *** lilo.conf aus Installierung, angepasst: ***" cat /nach/etc/lilo.conf chroot /nach /bin/mount proc /proc -t proc # lilo auf dem Install-Geraet machen ... chroot /nach /sbin/lilo -v 3 -b $NACH0 # letzteres weg falls Probleme . Falls device-Fehler, fehlt ihr Knoten in /dev if test $? -ne 0 ; then cd /nach/boot # damit alles relativ zur root des Install-Systemes ausgegeben wird # Hier werden nur vmlinuz- ... und initrd.cpio.gz- ... toleriert ls vmlinuz-* > tmp0 sort -n tmp0 > tmp2 # den letzten Kernel nehmen (aber: Problem m.Kernel ohne rc/git) Achtung, Variable tmp nicht benutzen, ist hier System-Ordner read KERNEL REST < tmp2 # kernel-Name mit /boot ls initrd.cpio.gz-* > tmp1 sort -r tmp1 > tmp2 read INITRD REST < tmp2 echo "Fuer lilo nehmen, in /boot gefunden: kernel / initrd : " $KERNEL $INITRD cd /nach ( echo -e "append=" \\c ; echo -e '"' \\c ; echo -e "devfs=nomount edd=off rootwait noapic nolapic acpi=off splash=silent irqpoll " \\c ; echo -e '"' ) > tmp1 # ggf noisapnp echo " boot = $NACH0 root = $NACH prompt menu-scheme=Wb timeout = 50 change-rules reset " >> tmp1 # konstanter Teil fĂr Versuche fuer lilo.conf # Erst genauen Kernel-Namen versuchen, falls erfolglos, vmlinuz / initrd cat tmp1 > /nach/etc/lilo.conf # $KERNEL=vmlinuz-2.6.24-rc3-git1-i486-1mn echo " image = /boot/$KERNEL initrd = /boot/$INITRD label = SYS read-only " >> /nach/etc/lilo.conf ( echo -e "append=" \\c ; echo -e '"' \\c ; echo -e "devfs=nomount edd=off rootwait noapic nolapic acpi=off splash=silent irqpoll " \\c ; echo -e '"' ) >> /nach/etc/lilo.conf echo " image = /boot/$KERNEL initrd = /boot/$INITRD label = failsafe read-only " >> /nach/etc/lilo.conf ( echo -e "append=" \\c ; echo -e '"' \\c echo -e "devfs=nomount edd=off rootwait noapic nolapic acpi=off splash=silent initcall_debug hwprobe=-isapnp usbcore.autosuspend=-1 sysrq_always_enabled=1 irqpoll " \\c ; echo -e '"' ) >> /nach/etc/lilo.conf chroot /nach /sbin/lilo -v 3 -b $NACH0 # Falls nachfolgendes nicht da, ist Lilo schon installiert #if test $? -ne 0 ; then #cat tmp1 > etc/lilo.conf #echo " #image = /boot/vmlinuz #initrd = /boot/initrd.cpio.gz # label = SYS0 # read-only # " >> etc/lilo.conf #chroot /nach /sbin/lilo -b $NACH0 #fi ; fi ; # Aus komischen Gruenden muesstenen die lilos fuer sonstige Geraete eigentlich zuerst gemacht werden weil sie sonst lilo auf dem # Install-Geraet aendern echo " *** lilo.conf definitiv: ***" ls -l /nach/etc/lilo.conf cat /nach/etc/lilo.conf echo "Geraete in devices:" echo " *** " echo " *** LILO auf alle Festplatten schreiben ausser der der Installation" echo " *** " #echo " Momentan abgestellt" # Bei Installierung auf USB-Geraeten / Asus EEEPC muss lilo auf der eingebauten \festplatte o.ae. installiert werden. # Sicherheitshalber installieren wir es mal auf allen denkbaren Geraeten # test lilo -b $NACH0 | grep "is not on the first disk" = 0 unzuverlaessig wenn von USB-key installiert wird # Da auf Install-device keine Geraete bekannt sind usw, von hier aus #cat /nach/etc/lilo.conf > /etc/lilo.conf # ; cat /nach/boot/map > /boot/map map neu erzeugen cp -f /logfile /nach/var/log/SYS_Linux.install.log ; cp -f /logfile /nach/SYS_Linux.install.log sync echo "other = "$NACH0 > /nach/etc/lilo.other.conf ; echo " label = "$NACH0 >> /nach/etc/lilo.other.conf # echo " boot-as = 0x80" >> /nach/etc/lilo.other.conf # der chainloader haengt von weniger Krams ab ... echo " lilo.other.conf :" ; cat /nach/etc/lilo.other.conf # Bei manchen Geraeten startet die Installierung von lilo nicht, bleibt haengen, oder wartet, damit das nicht die ganze Installierung # kaputtmacht, machen wir das im Hintergrund ... ( echo "Festplatten: " $FESTPLATTEN for I0 in $FESTPLATTEN ; do # Nur auf FESTPLATTEN, nicht auf USB-keys usw. Ggf statt info in devices, hdparm aufrufen echo " *** LILO schreiben auf weiteres Geraet ausser dem der Installation: " $I0 " :" cp -a /dev/$I0 /nach/dev ; cp -a /dev/$I0* /nach/dev # sicherheitshalber Eintraege in /dev fuer Ziel dorthin kopieren #if test $NACH0 != /dev/$I0 ; then cp -a /dev/$I0 /nach/dev ; /nach/sbin/lilo -C /nach/etc/lilo.conf -m /nach/boot/map -v 3 -b /dev/$I0 ; fi ; if test $NACH0 != /dev/$I0 ; then cp -a /dev/$I0 /nach/dev ; chroot /nach /sbin/lilo -C /etc/lilo.other.conf -m /boot/map.other.$I0 -s . -v 3 -b /dev/$I0 ; fi ; done rm /nach/etc/lilo.other.conf boot.* ) & sleep 5 # lilo startet dann oft nicht, daher im Hauptprogramm eine Warnung in BIOS Install-Geraet als 1.Boot-Geraet einstellen # Ggf besser HIER nichts zu aendern fuer Nicht-Install-Disk, so dass sie unveraendert bleibt und booten von ihr wie vorher geht, # also Umstellung / Wahl nur via bios echo " *** " echo " *** LILO fertig" echo " *** " chroot /nach sync rm tmp1 ; rm tmp2 #echo " lilo auf erzeugter Part. nach chroot, vergleiche mit oben" #chroot /nach ls -l /sbin/lilo date cp -f /logfile /nach/var/log/SYS_Linux.install.log ; echo "nach lilo: logfile gerettet nach /var/log/SYS_Linux.install.log" cp -f /logfile /nach/SYS_Linux.install.log ; echo "nach lilo: logfile gerettet nach /SYS_Linux.install.log" # installlog schon mal soweit kopieren, falls spaeter Absturz # 4.3. udev -Regeln ausschalten die Zuordnen von GerĂten verhindern ## Diejenige 'Initialisierung'/Saeuberung die auch vor Erstellen des DVDs ## oder nach Kopieren des Systemes in einen anderen Computer geboten ist, ## demnaechst mal als eigenes skript schreiben rm -f /nach/etc/udev/rules.d/70-persistent-net-rules # sonst werden eth0 etc. nicht gefunden rm -f /nach/etc/udev/rules.d/70-gpsd-rules # sonst werden eth0 etc. nicht gefunden rm -f /nach/etc/udev/rules.d/75-network-devices.rules # sonst werden eth0 etc. nicht gefunden rm -f /nach/etc/udev/rules.d/75-optical-devices.rules # sonst werden eth0 etc. nicht gefunden rm -fR /nach/etc/bluetooth/passkeys/* # sonst geht bluetooth nicht rm -fR /nach/var/lib/bluetooth/* rm -f /nach/dev/disk/by-id/* rm -f /nach/dev/disk/by-uuid/* rm -f /nach/dev/disk/by-path/* rm -fR /nach/dev/.udev/names/disk* rm -fR /nach/dev/.udev/names/input* # 4.4. einige Vorbesetzungen ### /dev/dvd=/dev/cdrom=Install-DVD-Drive, nicht bei Install von USB-key oder .iso read DEVCDROM REST < /devcdrom rm -rf /nach/dev/dvd ; rm -rf /nach/dev/cdrom if test $DEVCDROM != - ; then cp -af $DEVCDROM /nach/dev ln -sf $DEVCDROM /nach/dev/dvd ; ln -sf $DEVCDROM /nach/dev/cdrom # /dev/dvd , /dev/cdrom als drive vorbesetzen von wo install. wird echo " /dev/cdrom und /dev/dvd : " $DEVCDROM ls -l /nach$DEVCDROM ; ls -l /nach/dev/dvd ; ls -l /nach/dev/cdrom # ... ausser bei Install von USB-key fi ; # 5. Konfiguration free > /scr ; grep "Mem:" /scr > /scr0 ; read UNW MEM REST < /scr0 df /nach | grep -v "tmpfs" > /scr ; grep "/nach" /scr > /scr0 ; read UNW1 UNW2 UNW3 PLATZ REST < /scr0 echo " Speicher des Rechners: " $MEM " , freier Platz auf /nach: " $PLATZ " k" if test $MEM -lt 530000 ; then SWP=512000 ; if test $PLATZ -lt 1024000 ; then SWP=$(( $PLATZ / 2 )) ; fi SWP=$(( SWP / 1024)) ; echo $SWP " MB swap-File /swp.1 einrichten" tune2fs -m 0 $NACH # um mehr Platz zu kriegen dd $DEVZERO of=/nach/swp.1 bs=1M count=$SWP echo "mkswap /swp.1 ; swapon /swp.1 " >> /nach/etc/rc.d/rc.local.war echo "mkswap /swp.1 ; swapon /swp.1 " >> /nach/etc/rc.d/rc.local fi ; grep "bogomips" /proc/cpuinfo > /scr ; read UNW1 UNW2 CPUFRQ REST < /scr CPUFRQ=${CPUFRQ%%.*} ; echo "CPU-Staerke: " $CPUFRQ " bogomips" if test $CPUFRQ -lt 4000 ; then echo "Adaptionen fuer schwache Rechner durchfuehren, bei Bedarf revertieren ..." # ggf weitere Programme die schwache Rechner aufhaengen, ausschalten echo "fc-cache ausschalten .." ; chmod -x /nach/usr/bin/fc-cache echo "gam-server ausschalten .." ; chmod -x /nach/usr/libexec/gam_server echo "tripwire ausschalten .." ; chmod -x /nach/usr/sbin/tripwire fi ; echo " *** Alle sonstigen / komplizierteren / persoenlichen Konfigs im Zielsystem machen : KDE Control Center" echo " *** Faca as configuracoes pessoais no sistema instalado : KDE Control Center" cd / echo "0 Ende copysys" > /rescue #echo "0 in rescue geschrieben" #echo "Inhalt von rescue: " ; cat /rescue sync # /bin/umount /von echo " *** Ende copysys " echo $NAME" "$VERSION > /nach/etc/SYS-version # Dies dient zur Abfrage / Entscheidung ob diese Version SYS schon installiert # spaeter noch hinzu device-Name und zeitl. Rang bei mehreren SYS-Inst. echo " copysys Ende: TST SIZE NACH0 NACH VON KLEINER OLDSYS WINDOWS: " echo $TST $SIZE $NACH0 $NACH $VON $KLEINER $OLDSYS $WINDOWS echo $TST $SIZE $NACH0 $NACH $VON $KLEINER $OLDSYS $WINDOWS > installinfo date cp -f /logfile /nach/var/log/SYS_Linux.install.log ; echo "Ende copysys / installieren, konfigurieren: logfile gerettet nach /var/log/SYS_Linux.install.log" cp -f /logfile /nach/SYS_Linux.install.log ; echo "Ende copysys / installieren, konfigurieren: logfile gerettet nach /SYS_Linux.install.log" sync exit