refactor install process:
* user is dropped into a shell, where the user can run tools like fdisk to partition a disk * user needs to add a file called "disklayout" where it specifies SWAP, INSTALLDEVICE and TARGETDRIVE * depending on the values of these the installscript might need to be fixed to get the GRUB configuration right It's still somewhat inflexible, but it gives the user a bit more control than the old scheme svn path=/nixu/trunk/; revision=6271
This commit is contained in:
parent
65203abef4
commit
65742f6eb9
106
fill-disk.sh
106
fill-disk.sh
@ -1,11 +1,6 @@
|
|||||||
#! @bash@/bin/sh -e
|
#! @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
|
export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin:@busybox@/bin:@busybox@/sbin
|
||||||
|
|
||||||
##
|
|
||||||
## In the beginning we want to have a minimalistic environment, built with
|
|
||||||
## dietlibc.
|
|
||||||
##
|
|
||||||
|
|
||||||
kernel=@kernel@
|
kernel=@kernel@
|
||||||
xawtv=@xawtv@
|
xawtv=@xawtv@
|
||||||
@ -17,87 +12,23 @@ bootPath=@bootPath@
|
|||||||
modutils=@modutils@
|
modutils=@modutils@
|
||||||
mingetty=@mingetty@
|
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
|
echo formatting target device
|
||||||
|
|
||||||
targetdrive=/dev/hda
|
if test -e disklayout; then
|
||||||
device=${targetdrive}1
|
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}
|
mkfs.ext2 ${device}
|
||||||
swapdevice=${targetdrive}2
|
#swapdevice=${targetdrive}2
|
||||||
|
swapdevice=${SWAP}
|
||||||
mkswap $swapdevice
|
mkswap $swapdevice
|
||||||
|
|
||||||
echo enabling swap
|
echo enabling swap
|
||||||
@ -428,7 +359,8 @@ umount /cdrom
|
|||||||
|
|
||||||
echo install done
|
echo install done
|
||||||
echo it\'s safe to turn off your machine
|
echo it\'s safe to turn off your machine
|
||||||
|
echo exiting install process
|
||||||
|
|
||||||
while true; do
|
#while true; do
|
||||||
sleep 60;
|
#sleep 60;
|
||||||
done
|
#done
|
||||||
|
78
init.sh
78
init.sh
@ -1,3 +1,79 @@
|
|||||||
#! @bash@/bin/sh -e
|
#! @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
|
||||||
|
3
install.sh
Normal file
3
install.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#! @bash@/bin/sh -e
|
||||||
|
|
||||||
|
exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log
|
15
login.sh
Normal file
15
login.sh
Normal file
@ -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
|
29
make-disk.sh
29
make-disk.sh
@ -26,6 +26,7 @@ manifest=${archivesDir}/MANIFEST
|
|||||||
nixpkgs=/nixpkgs/trunk/pkgs
|
nixpkgs=/nixpkgs/trunk/pkgs
|
||||||
fill_disk=$archivesDir/scripts/fill-disk.sh
|
fill_disk=$archivesDir/scripts/fill-disk.sh
|
||||||
ramdisk_login=$archivesDir/scripts/ramdisk-login.sh
|
ramdisk_login=$archivesDir/scripts/ramdisk-login.sh
|
||||||
|
login_script=$archivesDir/scripts/login.sh
|
||||||
storePaths=$archivesDir/mystorepaths
|
storePaths=$archivesDir/mystorepaths
|
||||||
narStorePaths=$archivesDir/narstorepaths
|
narStorePaths=$archivesDir/narstorepaths
|
||||||
validatePaths=$archivesDir/validatepaths
|
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
|
### 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
|
### 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 $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 $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?
|
# Location of sysvinit?
|
||||||
sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -))
|
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^@which\@^$which^g" \
|
||||||
-e "s^@gnutar\@^$gnutar^g" \
|
-e "s^@gnutar\@^$gnutar^g" \
|
||||||
-e "s^@mingetty\@^$mingettyWrapper^g" \
|
-e "s^@mingetty\@^$mingettyWrapper^g" \
|
||||||
|
-e "s^@busybox\@^$busybox^g" \
|
||||||
< $ramdisk_login > $ramdisk_login.tmp
|
< $ramdisk_login > $ramdisk_login.tmp
|
||||||
$coreutils/bin/mv $ramdisk_login.tmp $ramdisk_login
|
$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
|
echo copying bootimage
|
||||||
|
|
||||||
$coreutils/bin/mkdir ${archivesDir}/isolinux
|
$coreutils/bin/mkdir ${archivesDir}/isolinux
|
||||||
@ -260,12 +283,14 @@ $coreutils/bin/rm -f ${initrd}
|
|||||||
#cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init
|
#cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init
|
||||||
$coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/
|
$coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/
|
||||||
$coreutils/bin/cp ${archivesDir}/scripts/ramdisk-login.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
|
$coreutils/bin/cp ${archivesDir}/scripts/init.sh ${initdir}/init
|
||||||
#ln -s ${bash}/bin/bash ${initdir}/bin/sh
|
#ln -s ${bash}/bin/bash ${initdir}/bin/sh
|
||||||
$coreutils/bin/cp ${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}/init
|
||||||
$coreutils/bin/chmod u+x ${initdir}/fill-disk.sh
|
$coreutils/bin/chmod u+x ${initdir}/fill-disk.sh
|
||||||
$coreutils/bin/chmod u+x ${initdir}/ramdisk-login.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 ${utilLinux} ${initdir}
|
||||||
#cp -fau --parents ${coreUtilsDiet} ${initdir}
|
#cp -fau --parents ${coreUtilsDiet} ${initdir}
|
||||||
#cp -fau --parents ${modUtils} ${initdir}
|
#cp -fau --parents ${modUtils} ${initdir}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user