diff --git a/fill-disk.sh b/fill-disk.sh index fd3d3cbf405..2895f957e8b 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,11 +1,6 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin - -## -## In the beginning we want to have a minimalistic environment, built with -## dietlibc. -## +export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin:@busybox@/bin:@busybox@/sbin kernel=@kernel@ xawtv=@xawtv@ @@ -17,87 +12,23 @@ bootPath=@bootPath@ modutils=@modutils@ mingetty=@mingetty@ -echo mounting special filesystems - -mount -t proc proc /proc -mount -t sysfs sys /sys - -# make a complete /dev filesystem -# ripped permissions and everything from anaconda (loader2/devices.h) - -echo making device nodes - -# consoles - -#mknod -m 0600 /dev/console c 5 1 -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -mknod -m 0600 /dev/tty0 c 4 0 -mknod -m 0600 /dev/tty1 c 4 1 -mknod -m 0600 /dev/tty2 c 4 2 -mknod -m 0600 /dev/tty3 c 4 3 -mknod -m 0600 /dev/tty4 c 4 4 -mknod -m 0600 /dev/tty5 c 4 5 -mknod -m 0600 /dev/tty6 c 4 6 -mknod -m 0600 /dev/tty7 c 4 7 -mknod -m 0600 /dev/tty8 c 4 8 -mknod -m 0600 /dev/tty9 c 4 9 - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -mknod -m 0660 /dev/hdb b 3 64 -mknod -m 0660 /dev/hdb1 b 3 65 -mknod -m 0660 /dev/hdb2 b 3 66 -mknod -m 0660 /dev/hdb3 b 3 67 - -mknod -m 0660 /dev/hdc b 22 0 -mknod -m 0660 /dev/hdc1 b 22 1 -mknod -m 0660 /dev/hdc2 b 22 2 -mknod -m 0660 /dev/hdc3 b 22 3 - -mknod -m 0660 /dev/hdd b 22 64 -mknod -m 0660 /dev/hdd1 b 22 65 -mknod -m 0660 /dev/hdd2 b 22 66 -mknod -m 0660 /dev/hdd3 b 22 67 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -mknod -m 0600 /dev/initctl p - -echo starting emergency shell on tty2 - -exec ./ramdisk-login.sh /dev/tty2 & - echo formatting target device -targetdrive=/dev/hda -device=${targetdrive}1 +if test -e disklayout; then + source disklayout +else + echo no disk layout configuration present...exiting + exit 1 +fi + +# $targetdrive is also used by GRUB! +#targetdrive=/dev/hda +targetdrive=${TARGETDRIVE} +#device=${targetdrive}1 +device=${INSTALLDEVICE} mkfs.ext2 ${device} -swapdevice=${targetdrive}2 +#swapdevice=${targetdrive}2 +swapdevice=${SWAP} mkswap $swapdevice echo enabling swap @@ -428,7 +359,8 @@ umount /cdrom echo install done echo it\'s safe to turn off your machine +echo exiting install process -while true; do - sleep 60; -done +#while true; do + #sleep 60; +#done diff --git a/init.sh b/init.sh index 88ce09ccb2b..b17a6637f67 100644 --- a/init.sh +++ b/init.sh @@ -1,3 +1,79 @@ #! @bash@/bin/sh -e -exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log +export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin + +echo mounting special filesystems + +mount -t proc proc /proc +mount -t sysfs sys /sys + +# make a complete /dev filesystem +# ripped permissions and everything from anaconda (loader2/devices.h) + +echo making device nodes + +# consoles + +#mknod -m 0600 /dev/console c 5 1 +mknod -m 0600 /dev/ttyS0 c 4 64 +mknod -m 0600 /dev/ttyS1 c 4 65 +mknod -m 0600 /dev/ttyS2 c 4 66 +mknod -m 0600 /dev/ttyS3 c 4 67 + +# base UNIX devices +mknod -m 0600 /dev/mem c 1 1 +mknod -m 0666 /dev/null c 1 3 +mknod -m 0666 /dev/zero c 1 5 + +# tty +mknod -m 0600 /dev/tty c 5 0 +mknod -m 0600 /dev/tty0 c 4 0 +mknod -m 0600 /dev/tty1 c 4 1 +mknod -m 0600 /dev/tty2 c 4 2 +mknod -m 0600 /dev/tty3 c 4 3 +mknod -m 0600 /dev/tty4 c 4 4 +mknod -m 0600 /dev/tty5 c 4 5 +mknod -m 0600 /dev/tty6 c 4 6 +mknod -m 0600 /dev/tty7 c 4 7 +mknod -m 0600 /dev/tty8 c 4 8 +mknod -m 0600 /dev/tty9 c 4 9 + +mkdir -m 0755 /dev/pts +mknod -m 0666 /dev/ptmx c 5 2 + +# random + +mknod -m 0644 /dev/random c 1 8 +mknod -m 0644 /dev/urandom c 1 9 + +mknod -m 0660 /dev/hda b 3 0 +mknod -m 0660 /dev/hda1 b 3 1 +mknod -m 0660 /dev/hda2 b 3 2 +mknod -m 0660 /dev/hda3 b 3 3 + +mknod -m 0660 /dev/hdb b 3 64 +mknod -m 0660 /dev/hdb1 b 3 65 +mknod -m 0660 /dev/hdb2 b 3 66 +mknod -m 0660 /dev/hdb3 b 3 67 + +mknod -m 0660 /dev/hdc b 22 0 +mknod -m 0660 /dev/hdc1 b 22 1 +mknod -m 0660 /dev/hdc2 b 22 2 +mknod -m 0660 /dev/hdc3 b 22 3 + +mknod -m 0660 /dev/hdd b 22 64 +mknod -m 0660 /dev/hdd1 b 22 65 +mknod -m 0660 /dev/hdd2 b 22 66 +mknod -m 0660 /dev/hdd3 b 22 67 + +#mknod -m 0660 /dev/sda b 8 0 +#mknod -m 0660 /dev/sda1 b 8 1 +#mknod -m 0660 /dev/sda2 b 8 2 +#mknod -m 0660 /dev/sda3 b 8 3 + +mknod -m 0600 /dev/initctl p + +echo starting emergency shell on tty2 + +exec ./ramdisk-login.sh /dev/tty2 & +exec ./login.sh diff --git a/install.sh b/install.sh new file mode 100644 index 00000000000..88ce09ccb2b --- /dev/null +++ b/install.sh @@ -0,0 +1,3 @@ +#! @bash@/bin/sh -e + +exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log diff --git a/login.sh b/login.sh new file mode 100644 index 00000000000..c94a8e48d20 --- /dev/null +++ b/login.sh @@ -0,0 +1,15 @@ +#! @bash@/bin/sh -e + +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin:@busybox@/sbin + +#tty=$1 + +#exec < $tty > $tty 2>&1 + +echo +echo "=== Welcome to Nix! ===" + +export HOME=/ +cd $HOME + +exec @bash@/bin/sh diff --git a/make-disk.sh b/make-disk.sh index f10ac09c00d..0710bf4aee2 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -26,6 +26,7 @@ manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh ramdisk_login=$archivesDir/scripts/ramdisk-login.sh +login_script=$archivesDir/scripts/login.sh storePaths=$archivesDir/mystorepaths narStorePaths=$archivesDir/narstorepaths validatePaths=$archivesDir/validatepaths @@ -48,8 +49,8 @@ kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $ ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom -#$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts -$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +#$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts # Location of sysvinit? sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) @@ -212,9 +213,31 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@which\@^$which^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ + -e "s^@busybox\@^$busybox^g" \ < $ramdisk_login > $ramdisk_login.tmp $coreutils/bin/mv $ramdisk_login.tmp $ramdisk_login +$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ + -e "s^@bootPath\@^$bootPath^g" \ + -e "s^@NIX\@^$nix^g" \ + -e "s^@bash\@^$bash^g" \ + -e "s^@findutils\@^$findutils^g" \ + -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ + -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@utillinux\@^$utilLinux^g" \ + -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@modutils\@^$modutils^g" \ + -e "s^@grub\@^$grub^g" \ + -e "s^@kernel\@^$kernel^g" \ + -e "s^@kernelscripts\@^$kernelscripts^g" \ + -e "s^@gnugrep\@^$gnugrep^g" \ + -e "s^@which\@^$which^g" \ + -e "s^@gnutar\@^$gnutar^g" \ + -e "s^@mingetty\@^$mingettyWrapper^g" \ + -e "s^@busybox\@^$busybox^g" \ + < $login_script > $login_script.tmp +$coreutils/bin/mv $login_script.tmp $login_script + echo copying bootimage $coreutils/bin/mkdir ${archivesDir}/isolinux @@ -260,12 +283,14 @@ $coreutils/bin/rm -f ${initrd} #cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init $coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ $coreutils/bin/cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ +$coreutils/bin/cp ${archivesDir}/scripts/login.sh ${initdir}/ $coreutils/bin/cp ${archivesDir}/scripts/init.sh ${initdir}/init #ln -s ${bash}/bin/bash ${initdir}/bin/sh $coreutils/bin/cp ${bash}/bin/bash ${initdir}/bin/sh $coreutils/bin/chmod u+x ${initdir}/init $coreutils/bin/chmod u+x ${initdir}/fill-disk.sh $coreutils/bin/chmod u+x ${initdir}/ramdisk-login.sh +$coreutils/bin/chmod u+x ${initdir}/login.sh #cp -fau --parents ${utilLinux} ${initdir} #cp -fau --parents ${coreUtilsDiet} ${initdir} #cp -fau --parents ${modUtils} ${initdir}