2004-02-14 22:56:51 +00:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
2005-07-31 15:25:39 +00:00
|
|
|
# deps is an array
|
2005-07-29 16:54:36 +00:00
|
|
|
declare -a deps
|
|
|
|
|
2005-07-05 13:52:49 +00:00
|
|
|
archivesDir=/tmp/arch
|
|
|
|
manifest=${archivesDir}/MANIFEST
|
2005-07-19 16:55:44 +00:00
|
|
|
nixpkgs=/nixpkgs/trunk/pkgs
|
2005-07-06 16:00:20 +00:00
|
|
|
fill_disk=$archivesDir/scripts/fill-disk.sh
|
2005-07-29 16:54:36 +00:00
|
|
|
storePaths=$archivesDir/mystorepaths
|
|
|
|
validatePaths=$archivesDir/validatepaths
|
2005-07-31 15:25:39 +00:00
|
|
|
bootiso=/tmp/nixos.iso
|
2005-08-01 17:30:45 +00:00
|
|
|
#initrd=/tmp/initrd.img
|
|
|
|
initrd=/tmp/initram.img
|
2005-08-03 12:00:42 +00:00
|
|
|
initdir=${archivesDir}/initdir
|
2005-07-06 14:42:41 +00:00
|
|
|
|
2005-07-31 15:25:39 +00:00
|
|
|
# keep chmod happy
|
2005-07-19 16:55:44 +00:00
|
|
|
touch ${archivesDir}/blah
|
2005-07-18 09:47:42 +00:00
|
|
|
chmod -f -R +w ${archivesDir}/*
|
2005-07-06 14:42:41 +00:00
|
|
|
rm -rf ${archivesDir}/*
|
2004-08-06 13:52:39 +00:00
|
|
|
|
|
|
|
NIX_CMD_PATH=/nix/bin
|
|
|
|
|
2005-07-05 13:52:49 +00:00
|
|
|
storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -)
|
2005-07-29 16:54:36 +00:00
|
|
|
#$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 -))
|
2004-02-18 10:56:07 +00:00
|
|
|
|
|
|
|
# Location of sysvinit?
|
2005-07-06 16:00:20 +00:00
|
|
|
sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
|
2004-02-18 10:56:07 +00:00
|
|
|
|
2004-02-18 14:56:32 +00:00
|
|
|
# Location of Nix boot scripts?
|
2005-07-06 16:00:20 +00:00
|
|
|
bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
|
|
|
|
|
2005-07-08 10:06:41 +00:00
|
|
|
nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-07-05 14:39:12 +00:00
|
|
|
|
2005-08-02 12:29:23 +00:00
|
|
|
syslinux=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-07-31 13:11:44 +00:00
|
|
|
|
2005-07-31 15:25:39 +00:00
|
|
|
kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))
|
|
|
|
|
2005-07-11 17:59:19 +00:00
|
|
|
#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))
|
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)))
|
|
|
|
echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths
|
|
|
|
|
|
|
|
#echo $nixDeps > $storePaths
|
|
|
|
|
|
|
|
utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-04 14:45:27 +00:00
|
|
|
coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-07-29 16:54:36 +00:00
|
|
|
|
2005-08-01 17:30:45 +00:00
|
|
|
bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-03 12:00:42 +00:00
|
|
|
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 -))
|
2005-08-01 17:30:45 +00:00
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
(while read storepath; do
|
|
|
|
cp -fa --parents ${storepath} ${archivesDir}
|
|
|
|
done) < $storePaths
|
|
|
|
|
|
|
|
echo utillinux $utilLinux
|
2005-07-11 17:59:19 +00:00
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
for i in $utilLinux; do
|
|
|
|
echo i $i
|
|
|
|
deps=( $($NIX_CMD_PATH/nix-store -q --references $i) )
|
|
|
|
echo length ${#deps[@]}
|
|
|
|
if test "${#deps[@]}" = 0
|
|
|
|
then
|
|
|
|
echo zarro
|
|
|
|
fi
|
|
|
|
done
|
2005-07-11 17:59:19 +00:00
|
|
|
|
2005-08-01 17:30:45 +00:00
|
|
|
echo creating directories for bootimage
|
|
|
|
|
2005-08-03 12:00:42 +00:00
|
|
|
mkdir ${initdir}
|
|
|
|
mkdir ${initdir}/bin
|
2005-08-03 17:59:23 +00:00
|
|
|
mkdir ${initdir}/dev
|
|
|
|
mkdir ${initdir}/etc
|
|
|
|
mkdir ${initdir}/installimage
|
|
|
|
mkdir ${initdir}/proc
|
2005-08-03 12:00:42 +00:00
|
|
|
mkdir ${initdir}/sbin
|
2005-08-03 17:59:23 +00:00
|
|
|
mkdir ${initdir}/sys
|
|
|
|
mkdir ${initdir}/tmp
|
2005-08-03 12:00:42 +00:00
|
|
|
mkdir -p ${initdir}/usr/bin
|
|
|
|
mkdir -p ${initdir}/usr/sbin
|
|
|
|
mkdir ${initdir}/var
|
2005-08-01 17:30:45 +00:00
|
|
|
|
2005-07-31 13:11:44 +00:00
|
|
|
echo copying nixpkgs
|
|
|
|
|
2005-07-06 14:42:41 +00:00
|
|
|
cp -fa ${nixpkgs} ${archivesDir}
|
2005-07-31 13:11:44 +00:00
|
|
|
|
|
|
|
echo copying packges from store
|
|
|
|
|
2005-07-29 16:54:36 +00:00
|
|
|
#cp -fa --parents ${nixDeps} ${archivesDir}
|
|
|
|
cp -fau --parents ${utilLinux} ${archivesDir}
|
2005-08-03 17:59:23 +00:00
|
|
|
#cp -fau --parents ${kernel} ${archivesDir}
|
2005-07-31 13:11:44 +00:00
|
|
|
|
2005-08-03 12:00:42 +00:00
|
|
|
bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-01 17:30:45 +00:00
|
|
|
|
2005-07-31 13:11:44 +00:00
|
|
|
echo copying scripts
|
|
|
|
|
2005-07-06 14:42:41 +00:00
|
|
|
mkdir ${archivesDir}/scripts
|
|
|
|
cp -fa * ${archivesDir}/scripts
|
2005-07-06 16:00:20 +00:00
|
|
|
sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \
|
|
|
|
-e "s^@bootPath\@^$bootPath^g" \
|
2005-07-08 10:06:41 +00:00
|
|
|
-e "s^@NIX_CMD_PATH\@^$nix^g" \
|
2005-08-01 17:30:45 +00:00
|
|
|
-e "s^@bash\@^$bash^g" \
|
2005-08-03 12:00:42 +00:00
|
|
|
-e "s^@findutils\@^$findutils^g" \
|
|
|
|
-e "s^@coreutils\@^$coreutils^g" \
|
|
|
|
-e "s^@utillinux\@^$utillinux^g" \
|
2005-07-06 16:00:20 +00:00
|
|
|
< $fill_disk > $fill_disk.tmp
|
|
|
|
mv $fill_disk.tmp $fill_disk
|
2005-07-31 13:11:44 +00:00
|
|
|
|
|
|
|
echo copying bootimage
|
|
|
|
|
|
|
|
mkdir ${archivesDir}/isolinux
|
|
|
|
cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux
|
2005-07-31 19:01:59 +00:00
|
|
|
cp isolinux.cfg ${archivesDir}/isolinux
|
2005-07-31 13:11:44 +00:00
|
|
|
chmod u+w ${archivesDir}/isolinux/*
|
2005-07-31 15:25:39 +00:00
|
|
|
|
|
|
|
echo copying kernel
|
|
|
|
|
|
|
|
# By following the symlink we don't have to know the version number
|
|
|
|
# of the kernel here.
|
2005-07-31 19:04:58 +00:00
|
|
|
cp -L $kernel/vmlinuz ${archivesDir}/isolinux
|
2005-07-31 15:25:39 +00:00
|
|
|
|
|
|
|
# echo making ramdisk
|
|
|
|
# todo!
|
2005-08-01 17:30:45 +00:00
|
|
|
# mkdir ${archivesDir}/sbin
|
|
|
|
# ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init
|
2005-08-03 12:00:42 +00:00
|
|
|
# ln -s /scripts/fill-disk.sh ${archivesDir}/init
|
2005-08-01 17:30:45 +00:00
|
|
|
|
|
|
|
echo creating ramdisk
|
|
|
|
|
|
|
|
rm -f ${initrd}
|
2005-08-03 12:00:42 +00:00
|
|
|
cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init
|
|
|
|
cp ${bash}/bin/* ${initdir}/bin
|
|
|
|
chmod u+x ${initdir}/init
|
|
|
|
cp -fau --parents ${bashdeps} ${initdir}
|
2005-08-03 18:14:47 +00:00
|
|
|
cp -fau --parents ${utilLinux} ${initdir}
|
2005-08-04 14:45:27 +00:00
|
|
|
cp -fau --parents ${coreUtils} ${initdir}
|
2005-08-03 12:00:42 +00:00
|
|
|
|
2005-08-04 14:45:27 +00:00
|
|
|
(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd}
|
|
|
|
#(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd}
|
2005-08-01 17:30:45 +00:00
|
|
|
|
|
|
|
cp ${initrd} ${archivesDir}/isolinux
|
2005-07-31 15:25:39 +00:00
|
|
|
|
|
|
|
echo creating ISO image
|
|
|
|
|
|
|
|
mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \
|
2005-07-31 13:11:44 +00:00
|
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
|
|
|
${archivesDir}
|