mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
get NixOS more towards an installable state. Stuff now actually gets installed on the disk itself. Missing is functionality to detect the right drive with
the install CD in it. svn path=/nixu/trunk/; revision=3531
This commit is contained in:
parent
c785eeaaec
commit
bc3ffa3458
39
fill-disk.sh
39
fill-disk.sh
@ -1,6 +1,6 @@
|
||||
#! @bash@/bin/sh -e
|
||||
|
||||
export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin
|
||||
export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin
|
||||
|
||||
sysvinitPath=@sysvinitPath@
|
||||
bootPath=@bootPath@
|
||||
@ -47,7 +47,22 @@ mknod -m 0666 /dev/ptmx c 5 2
|
||||
mknod -m 0644 /dev/random c 1 8
|
||||
mknod -m 0644 /dev/urandom c 1 9
|
||||
|
||||
echo "blaat"
|
||||
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/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
|
||||
|
||||
echo "dev"
|
||||
cd /dev; echo *
|
||||
|
||||
mkfs.ext2 /dev/hda1
|
||||
mkswap /dev/hda2
|
||||
|
||||
|
||||
#if ! test -n "$1"
|
||||
#then
|
||||
@ -58,6 +73,8 @@ echo "blaat"
|
||||
#fi
|
||||
|
||||
device=/dev/hda1
|
||||
#device=/dev/sda1
|
||||
|
||||
|
||||
make_dir() {
|
||||
mode=$1
|
||||
@ -88,6 +105,10 @@ cd /sys; echo *
|
||||
# mount --bind /mnt/cdrom1/nix /nix
|
||||
# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs
|
||||
|
||||
##
|
||||
## Create a directory tree on the installation disk.
|
||||
##
|
||||
|
||||
make_dir 00755 /bin
|
||||
make_dir 00755 /dev
|
||||
make_dir 00755 /proc
|
||||
@ -110,6 +131,10 @@ make_dir 00755 /mnt/host
|
||||
make_dir 00755 /home
|
||||
make_dir 00755 /home/root
|
||||
|
||||
##
|
||||
## Add a few devices to /dev on the install disk. This is by far complete.
|
||||
##
|
||||
|
||||
mknod $root/dev/null c 1 3
|
||||
|
||||
touch_file /etc/passwd
|
||||
@ -119,6 +144,12 @@ touch_file /etc/group
|
||||
rm -f $root/etc/mtab
|
||||
#ln -s /proc/mounts $root/etc/mtab
|
||||
|
||||
cat /proc/mounts
|
||||
|
||||
## Probe for CD device which contains our CD here and mount /nix and
|
||||
## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this.
|
||||
## Find out how Knoppix and SUSE do this...
|
||||
|
||||
export NIX_DATA_DIR=$root/nix/share
|
||||
export NIX_LOG_DIR=$root/nix/log/nix
|
||||
export NIX_STATE_DIR=$root/nix/var/nix
|
||||
@ -201,3 +232,7 @@ cp /etc/resolv.conf $root/etc
|
||||
rm -f $root/etc/hosts
|
||||
echo "127.0.0.1 localhost" >> $root/etc/hosts
|
||||
echo "192.168.150.1 uml" >> $root/etc/hosts
|
||||
|
||||
###
|
||||
### Do funky stuff with grub here.
|
||||
###
|
||||
|
203
init/fill-disk.sh
Executable file
203
init/fill-disk.sh
Executable file
@ -0,0 +1,203 @@
|
||||
#! @bash@/bin/sh -e
|
||||
|
||||
export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin
|
||||
|
||||
sysvinitPath=@sysvinitPath@
|
||||
bootPath=@bootPath@
|
||||
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sys /sys
|
||||
|
||||
#mount -t /dev/hdc /installimage
|
||||
|
||||
# make a complete /dev filesystem
|
||||
# ripped permissions and everything from anaconda (loader2/devices.h)
|
||||
|
||||
# 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
|
||||
|
||||
echo "blaat"
|
||||
|
||||
#if ! test -n "$1"
|
||||
#then
|
||||
# echo "need harddisk device for installing!"
|
||||
# exit
|
||||
#else
|
||||
# device=$1
|
||||
#fi
|
||||
|
||||
device=/dev/hda1
|
||||
|
||||
make_dir() {
|
||||
mode=$1
|
||||
name=$2
|
||||
echo creating $name...
|
||||
if ! test -d $root/$name; then mkdir $root/$name; fi
|
||||
chmod $mode $root/$name
|
||||
}
|
||||
|
||||
|
||||
touch_file() {
|
||||
name=$1
|
||||
echo touching $name...
|
||||
if ! test -d $root/$name; then touch $root/$name; fi
|
||||
}
|
||||
root=/tmp/mnt
|
||||
|
||||
mkdir -p /tmp/mnt
|
||||
|
||||
mount -t ext2 $device /tmp/mnt
|
||||
|
||||
cd /sys; echo *
|
||||
|
||||
# mkdir -p /nix
|
||||
# mkdir -p /nixpkgs/trunk/pkgs
|
||||
|
||||
# temporary hack
|
||||
# mount --bind /mnt/cdrom1/nix /nix
|
||||
# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs
|
||||
|
||||
make_dir 00755 /bin
|
||||
make_dir 00755 /dev
|
||||
make_dir 00755 /proc
|
||||
make_dir 01777 /tmp
|
||||
make_dir 00755 /etc # global non-constant configuration
|
||||
make_dir 00755 /etc-secret
|
||||
make_dir 00755 /var
|
||||
make_dir 00755 /nix
|
||||
make_dir 00755 /nix/store
|
||||
make_dir 00755 /nix/var
|
||||
make_dir 00755 /nix/var/nix
|
||||
make_dir 00755 /nix/var/nix/db
|
||||
make_dir 00755 /nix/var/nix/manifests
|
||||
make_dir 00755 /nix/var/log
|
||||
make_dir 00755 /nix/var/log/nix
|
||||
make_dir 00755 /nixpkgs
|
||||
make_dir 00755 /nixpkgs/trunk
|
||||
make_dir 00755 /mnt
|
||||
make_dir 00755 /mnt/host
|
||||
make_dir 00755 /home
|
||||
make_dir 00755 /home/root
|
||||
|
||||
mknod $root/dev/null c 1 3
|
||||
|
||||
touch_file /etc/passwd
|
||||
touch_file /etc/shadow
|
||||
touch_file /etc/group
|
||||
|
||||
rm -f $root/etc/mtab
|
||||
#ln -s /proc/mounts $root/etc/mtab
|
||||
|
||||
export NIX_DATA_DIR=$root/nix/share
|
||||
export NIX_LOG_DIR=$root/nix/log/nix
|
||||
export NIX_STATE_DIR=$root/nix/var/nix
|
||||
export NIX_CONF_DIR=$root/nix/etc
|
||||
NIX_CMD_PATH=@NIX_CMD_PATH@/bin
|
||||
|
||||
echo initialising Nix DB...
|
||||
#/nix/bin/nix-store --init
|
||||
$NIX_CMD_PATH/nix-store --init
|
||||
|
||||
echo verifying Nix DB...
|
||||
$NIX_CMD_PATH/nix-store --verify
|
||||
|
||||
echo copying nixpkgs...
|
||||
cp -fa ../pkgs $root/nixpkgs/trunk
|
||||
|
||||
make_dir 0755 /tmp/scripts
|
||||
cp -fa ../scripts $root/tmp
|
||||
|
||||
#echo adding manifest
|
||||
#$NIX_CMD_PATH/nix-pull $manifest
|
||||
|
||||
echo adding packages
|
||||
export NIX_ROOT=$root
|
||||
unset NIX_DATA_DIR
|
||||
unset NIX_LOG_DIR
|
||||
unset NIX_STATE_DIR
|
||||
unset NIX_CONF_DIR
|
||||
|
||||
#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -)
|
||||
#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -)
|
||||
#$NIX_CMD_PATH/nix-store -r $storeExpr
|
||||
#echo $storeExpr
|
||||
#storeExpr2=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $storeExpr))
|
||||
#echo storeExpr $storeExpr
|
||||
#echo $($NIX_CMD_PATH/nix-store -qR --include-outputs $storeExpr)
|
||||
|
||||
echo copying store
|
||||
|
||||
(while read storepaths; do
|
||||
cp -fa $storepaths $root/nix/store
|
||||
done) < /mnt/cdrom1/mystorepaths
|
||||
|
||||
#cp -fa ../nix/store/* $root/nix/store
|
||||
|
||||
#echo registering valid paths...
|
||||
#(while read storepath; do
|
||||
# echo PATH $storepath
|
||||
# if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then
|
||||
# (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath
|
||||
# $NIX_CMD_PATH/nix-store --validpath $storepath
|
||||
# fi
|
||||
#done) < /tmp/mystorepaths
|
||||
|
||||
#echo registering successors...
|
||||
#(while read line; do
|
||||
# echo SUCC $line
|
||||
# $NIX_CMD_PATH/nix-store --successor $line
|
||||
#done) < /tmp/mysuccessors
|
||||
|
||||
exit
|
||||
|
||||
echo setting init symlink...
|
||||
rm -f $root/init
|
||||
ln -s $sysvinitPath/sbin/init $root/init
|
||||
|
||||
echo setting up inittab...
|
||||
rm -f $root/etc/inittab
|
||||
echo "id:2:initdefault:" >> $root/etc/inittab
|
||||
echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab
|
||||
echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab
|
||||
echo "1:2345:respawn:$bootPath/bin/login.sh /dev/ttys/0" >> $root/etc/inittab
|
||||
#echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab
|
||||
|
||||
echo setting up networking information...
|
||||
make_dir 00755 /etc/networking
|
||||
echo 192.168.150.1 > $root/etc/networking/local-ip
|
||||
echo 192.168.150.3 > $root/etc/networking/gateway-ip
|
||||
cp /etc/resolv.conf $root/etc
|
||||
rm -f $root/etc/hosts
|
||||
echo "127.0.0.1 localhost" >> $root/etc/hosts
|
||||
echo "192.168.150.1 uml" >> $root/etc/hosts
|
@ -45,11 +45,13 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni
|
||||
|
||||
utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
|
||||
bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
(while read storepath; do
|
||||
cp -fa --parents ${storepath} ${archivesDir}
|
||||
@ -105,6 +107,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \
|
||||
-e "s^@findutils\@^$findutils^g" \
|
||||
-e "s^@coreutils\@^$coreutils^g" \
|
||||
-e "s^@utillinux\@^$utillinux^g" \
|
||||
-e "s^@e2fsprogs\@^$e2fsprogs^g" \
|
||||
< $fill_disk > $fill_disk.tmp
|
||||
mv $fill_disk.tmp $fill_disk
|
||||
|
||||
@ -136,6 +139,7 @@ chmod u+x ${initdir}/init
|
||||
cp -fau --parents ${bashdeps} ${initdir}
|
||||
cp -fau --parents ${utilLinux} ${initdir}
|
||||
cp -fau --parents ${coreUtils} ${initdir}
|
||||
cp -fau --parents ${e2fsProgs} ${initdir}
|
||||
|
||||
(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd}
|
||||
#(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd}
|
||||
|
5
pkgs.nix
5
pkgs.nix
@ -10,5 +10,8 @@ rec {
|
||||
less screen openssh binutils strace shadowutils iputils gnumake curl
|
||||
gnused gnutar gnugrep gzip mingetty grub parted;};
|
||||
|
||||
everything = [boot sysvinit kernel];
|
||||
init = (import ./init) {inherit stdenv bash coreutils
|
||||
utillinux e2fsprogs nix shadowutils mingetty grub parted;};
|
||||
|
||||
everything = [boot init sysvinit kernel];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user