rewrite make-disk.sh and have it parameterize fill-disk.sh with the location

of sysvinit and the boot scripts that will be used.

svn path=/nixu/trunk/; revision=3299
This commit is contained in:
Armijn Hemel 2005-07-06 16:00:20 +00:00
parent 1054efb792
commit 9380bf77d8
2 changed files with 24 additions and 29 deletions

View file

@ -1,7 +1,7 @@
#! /bin/sh -e
sysvinitPath=$1
bootPath=$2
sysvinitPath=@sysvinitPath@
bootPath=@bootPath@
make_dir() {
mode=$1
@ -49,8 +49,6 @@ rm -f $root/etc/mtab
ln -s /proc/mounts $root/etc/mtab
export NIX_ROOT=$root
#NIX_CMD_PATH=/usr/home/nix/.nix-profile/bin
#NIX_CMD_PATH=/home/armijn/.nix-profile/bin
NIX_CMD_PATH=/nix/bin
echo initialising Nix DB...
@ -60,20 +58,20 @@ $NIX_CMD_PATH/nix-store --init
echo verifying Nix DB...
$NIX_CMD_PATH/nix-store --verify
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 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
#echo registering successors...
#(while read line; do
# echo SUCC $line
# $NIX_CMD_PATH/nix-store --successor $line
#done) < /tmp/mysuccessors
echo setting init symlink...
rm -f $root/init
@ -95,12 +93,3 @@ 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
echo unmounting...
umount $root
echo syncing...
sync
echo halting...
/sbin/halt -d -f

View file

@ -3,6 +3,7 @@
archivesDir=/tmp/arch
manifest=${archivesDir}/MANIFEST
nixpkgs=/nixpkgs2/trunk/pkgs
fill_disk=$archivesDir/scripts/fill-disk.sh
rm -rf ${archivesDir}/*
@ -10,14 +11,19 @@ NIX_CMD_PATH=/nix/bin
storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -)
$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))
#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))
# Location of sysvinit?
#sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
# Location of Nix boot scripts?
#bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
echo "bootPath: ${bootPath}"
cp -fa ${nixpkgs} ${archivesDir}
mkdir ${archivesDir}/scripts
cp -fa * ${archivesDir}/scripts
sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \
-e "s^@bootPath\@^$bootPath^g" \
< $fill_disk > $fill_disk.tmp
mv $fill_disk.tmp $fill_disk