2004-02-14 22:56:51 +00:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
2005-07-06 16:00:20 +00:00
|
|
|
sysvinitPath=@sysvinitPath@
|
|
|
|
bootPath=@bootPath@
|
2004-02-14 22:56:51 +00:00
|
|
|
|
2005-07-14 16:57:39 +00:00
|
|
|
if ! test -n "$1"
|
|
|
|
then
|
2005-07-29 16:54:36 +00:00
|
|
|
echo "need harddisk device for installing!"
|
2005-07-14 16:57:39 +00:00
|
|
|
exit
|
|
|
|
else
|
2005-07-29 16:54:36 +00:00
|
|
|
device=$1
|
2005-07-14 16:57:39 +00:00
|
|
|
fi
|
|
|
|
|
2004-02-14 22:56:51 +00:00
|
|
|
make_dir() {
|
|
|
|
mode=$1
|
|
|
|
name=$2
|
|
|
|
echo creating $name...
|
|
|
|
if ! test -d $root/$name; then mkdir $root/$name; fi
|
|
|
|
chmod $mode $root/$name
|
|
|
|
}
|
|
|
|
|
2004-08-06 13:50:42 +00:00
|
|
|
|
|
|
|
touch_file() {
|
|
|
|
name=$1
|
2004-08-06 17:22:24 +00:00
|
|
|
echo touching $name...
|
2004-08-06 13:50:42 +00:00
|
|
|
if ! test -d $root/$name; then touch $root/$name; fi
|
|
|
|
}
|
2004-02-14 22:56:51 +00:00
|
|
|
root=/tmp/mnt
|
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
mkdir -p /tmp/mnt
|
|
|
|
|
|
|
|
mount $device /tmp/mnt
|
|
|
|
|
|
|
|
mkdir -p /nix
|
|
|
|
mkdir -p /nixpkgs/trunk/pkgs
|
|
|
|
|
|
|
|
# temporary hack
|
|
|
|
mount --bind /mnt/cdrom1/nix /nix
|
|
|
|
mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs
|
|
|
|
|
2004-08-06 17:22:24 +00:00
|
|
|
make_dir 00755 /bin
|
2004-02-14 22:56:51 +00:00
|
|
|
make_dir 00755 /dev
|
|
|
|
make_dir 00755 /proc
|
|
|
|
make_dir 01777 /tmp
|
2004-02-18 10:56:07 +00:00
|
|
|
make_dir 00755 /etc # global non-constant configuration
|
2004-08-06 17:22:24 +00:00
|
|
|
make_dir 00755 /etc-secret
|
2004-02-18 10:56:07 +00:00
|
|
|
make_dir 00755 /var
|
2004-02-14 22:56:51 +00:00
|
|
|
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
|
2005-07-14 16:57:39 +00:00
|
|
|
make_dir 00755 /nix/var/nix/manifests
|
2004-02-14 22:56:51 +00:00
|
|
|
make_dir 00755 /nix/var/log
|
|
|
|
make_dir 00755 /nix/var/log/nix
|
2005-07-11 17:59:19 +00:00
|
|
|
make_dir 00755 /nixpkgs
|
2005-07-19 15:39:32 +00:00
|
|
|
make_dir 00755 /nixpkgs/trunk
|
2004-02-18 10:56:07 +00:00
|
|
|
make_dir 00755 /mnt
|
|
|
|
make_dir 00755 /mnt/host
|
|
|
|
make_dir 00755 /home
|
|
|
|
make_dir 00755 /home/root
|
|
|
|
|
2005-07-19 15:39:32 +00:00
|
|
|
mknod $root/dev/null c 1 3
|
|
|
|
|
2004-08-06 13:50:42 +00:00
|
|
|
touch_file /etc/passwd
|
|
|
|
touch_file /etc/shadow
|
|
|
|
touch_file /etc/group
|
|
|
|
|
2004-02-18 10:56:07 +00:00
|
|
|
rm -f $root/etc/mtab
|
2005-07-14 16:57:39 +00:00
|
|
|
#ln -s /proc/mounts $root/etc/mtab
|
2004-02-14 22:56:51 +00:00
|
|
|
|
2005-07-19 15:39:32 +00:00
|
|
|
export NIX_DATA_DIR=$root/nix/share
|
|
|
|
export NIX_LOG_DIR=$root/nix/log/nix
|
2005-07-14 16:57:39 +00:00
|
|
|
export NIX_STATE_DIR=$root/nix/var/nix
|
2005-07-19 15:39:32 +00:00
|
|
|
export NIX_CONF_DIR=$root/nix/etc
|
2005-07-08 10:06:41 +00:00
|
|
|
NIX_CMD_PATH=@NIX_CMD_PATH@/bin
|
2004-02-14 22:56:51 +00:00
|
|
|
|
|
|
|
echo initialising Nix DB...
|
2004-08-06 13:50:42 +00:00
|
|
|
#/nix/bin/nix-store --init
|
|
|
|
$NIX_CMD_PATH/nix-store --init
|
2004-02-14 22:56:51 +00:00
|
|
|
|
|
|
|
echo verifying Nix DB...
|
2004-08-06 13:50:42 +00:00
|
|
|
$NIX_CMD_PATH/nix-store --verify
|
2004-02-14 22:56:51 +00:00
|
|
|
|
2005-07-11 17:59:19 +00:00
|
|
|
echo copying nixpkgs...
|
2005-07-19 15:39:32 +00:00
|
|
|
cp -fa ../pkgs $root/nixpkgs/trunk
|
|
|
|
|
|
|
|
make_dir 0755 /tmp/scripts
|
2005-07-19 16:02:17 +00:00
|
|
|
cp -fa ../scripts $root/tmp
|
2005-07-11 17:59:19 +00:00
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
#echo adding manifest
|
|
|
|
#$NIX_CMD_PATH/nix-pull $manifest
|
2005-07-11 17:59:19 +00:00
|
|
|
|
2005-07-19 15:39:32 +00:00
|
|
|
echo adding packages
|
|
|
|
export NIX_ROOT=$root
|
|
|
|
unset NIX_DATA_DIR
|
|
|
|
unset NIX_LOG_DIR
|
|
|
|
unset NIX_STATE_DIR
|
|
|
|
unset NIX_CONF_DIR
|
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
#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
|
2005-07-19 15:39:32 +00:00
|
|
|
|
2005-07-06 16:00:20 +00:00
|
|
|
#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
|
2004-02-14 22:56:51 +00:00
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
exit
|
|
|
|
|
2004-02-14 22:56:51 +00:00
|
|
|
echo setting init symlink...
|
|
|
|
rm -f $root/init
|
2004-02-18 10:56:07 +00:00
|
|
|
ln -s $sysvinitPath/sbin/init $root/init
|
|
|
|
|
|
|
|
echo setting up inittab...
|
|
|
|
rm -f $root/etc/inittab
|
|
|
|
echo "id:2:initdefault:" >> $root/etc/inittab
|
2004-02-18 14:56:32 +00:00
|
|
|
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
|
2004-02-19 12:49:00 +00:00
|
|
|
#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
|