2004-02-14 22:56:51 +00:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
2005-07-31 16:25:39 +01:00
|
|
|
# deps is an array
|
2005-07-29 17:54:36 +01:00
|
|
|
declare -a deps
|
|
|
|
|
2005-07-05 14:52:49 +01:00
|
|
|
archivesDir=/tmp/arch
|
|
|
|
manifest=${archivesDir}/MANIFEST
|
2005-07-19 17:55:44 +01:00
|
|
|
nixpkgs=/nixpkgs/trunk/pkgs
|
2005-07-06 17:00:20 +01:00
|
|
|
fill_disk=$archivesDir/scripts/fill-disk.sh
|
2005-07-29 17:54:36 +01:00
|
|
|
storePaths=$archivesDir/mystorepaths
|
|
|
|
validatePaths=$archivesDir/validatepaths
|
2005-07-31 16:25:39 +01:00
|
|
|
bootiso=/tmp/nixos.iso
|
2005-08-01 18:30:45 +01:00
|
|
|
initrd=/tmp/initram.img
|
2005-08-03 13:00:42 +01:00
|
|
|
initdir=${archivesDir}/initdir
|
2005-08-31 13:02:28 +01:00
|
|
|
initscript=$archivesDir/scripts/init.sh
|
2005-07-06 15:42:41 +01:00
|
|
|
|
2005-08-16 22:46:08 +01:00
|
|
|
echo cleaning old build
|
|
|
|
|
2005-07-31 16:25:39 +01:00
|
|
|
# keep chmod happy
|
2005-07-19 17:55:44 +01:00
|
|
|
touch ${archivesDir}/blah
|
2005-07-18 10:47:42 +01:00
|
|
|
chmod -f -R +w ${archivesDir}/*
|
2005-07-06 15:42:41 +01:00
|
|
|
rm -rf ${archivesDir}/*
|
2004-08-06 14:52:39 +01:00
|
|
|
|
2005-08-30 12:23:56 +01:00
|
|
|
NIX_CMD_PATH=$(dirname $(which nix-store))
|
2004-08-06 14:52:39 +01:00
|
|
|
|
2005-08-27 01:36:07 +01:00
|
|
|
storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-07-29 17:54:36 +01: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-08-14 02:40:36 +01:00
|
|
|
sysvinitPath=$($NIX_CMD_PATH/nix-store -r $(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-08-14 02:40:36 +01:00
|
|
|
bootPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-07-06 17:00:20 +01:00
|
|
|
|
2005-07-08 11:06:41 +01:00
|
|
|
nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-07-05 15:39:12 +01:00
|
|
|
|
2005-08-02 13:29:23 +01:00
|
|
|
syslinux=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-07-31 14:11:44 +01:00
|
|
|
|
2005-07-31 16:25:39 +01:00
|
|
|
kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))
|
|
|
|
|
2005-07-11 18:59:19 +01:00
|
|
|
#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))
|
|
|
|
|
2005-07-29 17:54:36 +01:00
|
|
|
#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-26 00:10:36 +01:00
|
|
|
#echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths
|
|
|
|
#$NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) >> $storePaths
|
2005-07-29 17:54:36 +01:00
|
|
|
|
2005-08-26 17:06:52 +01:00
|
|
|
for i in $storeExpr
|
|
|
|
do
|
2005-08-27 01:36:07 +01:00
|
|
|
echo $i >> $storePaths
|
|
|
|
echo '' >> $storePaths
|
|
|
|
deps=$($NIX_CMD_PATH/nix-store -q --references $i)
|
|
|
|
pkgs=$(echo $deps | wc -w)
|
|
|
|
echo $pkgs >> $storePaths
|
|
|
|
for j in $deps
|
|
|
|
do
|
|
|
|
echo $j >> $storePaths
|
|
|
|
done
|
|
|
|
echo copying from store: $i
|
|
|
|
tar -cf - $i | tar --directory=$archivesDir -xf -
|
2005-08-26 17:06:52 +01:00
|
|
|
done
|
|
|
|
|
2005-07-29 17:54:36 +01:00
|
|
|
utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-28 17:56:48 +01:00
|
|
|
coreUtilsDiet=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-28 01:51:34 +01:00
|
|
|
e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-20 22:49:53 +01:00
|
|
|
modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-14 02:40:36 +01:00
|
|
|
Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)))
|
|
|
|
#gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -)))
|
|
|
|
#gnuGrep=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)))
|
|
|
|
Kernel=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)))
|
|
|
|
SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)))
|
|
|
|
BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-07-29 17:54:36 +01:00
|
|
|
|
2005-08-01 18:30:45 +01:00
|
|
|
bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-28 17:56:48 +01:00
|
|
|
coreutilsdiet=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-03 13:00:42 +01:00
|
|
|
coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-23 16:56:17 +01:00
|
|
|
findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-03 13:00:42 +01:00
|
|
|
utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-28 01:51:34 +01:00
|
|
|
e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-20 22:49:53 +01:00
|
|
|
modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-14 02:40:36 +01:00
|
|
|
grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-28 01:51:34 +01:00
|
|
|
mingettyWrapper=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-17 20:19:54 +01:00
|
|
|
hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-19 16:26:01 +01:00
|
|
|
udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-21 20:56:30 +01:00
|
|
|
dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-23 16:56:17 +01:00
|
|
|
nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-23 17:53:39 +01:00
|
|
|
gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-26 00:10:36 +01:00
|
|
|
which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-26 17:06:52 +01:00
|
|
|
gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -))
|
2005-08-01 18:30:45 +01:00
|
|
|
|
2005-08-27 01:36:07 +01:00
|
|
|
#(while read storepath; do
|
|
|
|
#cp -fa --parents ${storepath} ${archivesDir}
|
|
|
|
#done) < $storePaths
|
2005-07-29 17:54:36 +01:00
|
|
|
|
|
|
|
echo utillinux $utilLinux
|
2005-07-11 18:59:19 +01:00
|
|
|
|
2005-07-29 17:54:36 +01: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 18:59:19 +01:00
|
|
|
|
2005-08-01 18:30:45 +01:00
|
|
|
echo creating directories for bootimage
|
|
|
|
|
2005-08-03 13:00:42 +01:00
|
|
|
mkdir ${initdir}
|
|
|
|
mkdir ${initdir}/bin
|
2005-08-12 17:26:51 +01:00
|
|
|
mkdir ${initdir}/cdrom
|
2005-08-03 18:59:23 +01:00
|
|
|
mkdir ${initdir}/dev
|
|
|
|
mkdir ${initdir}/etc
|
|
|
|
mkdir ${initdir}/installimage
|
2005-08-09 17:51:26 +01:00
|
|
|
mkdir ${initdir}/modules
|
2005-08-03 18:59:23 +01:00
|
|
|
mkdir ${initdir}/proc
|
2005-08-03 13:00:42 +01:00
|
|
|
mkdir ${initdir}/sbin
|
2005-08-03 18:59:23 +01:00
|
|
|
mkdir ${initdir}/sys
|
|
|
|
mkdir ${initdir}/tmp
|
2005-08-03 13:00:42 +01:00
|
|
|
mkdir -p ${initdir}/usr/bin
|
|
|
|
mkdir -p ${initdir}/usr/sbin
|
|
|
|
mkdir ${initdir}/var
|
2005-08-26 00:10:36 +01:00
|
|
|
mkdir ${initdir}/var/run
|
2005-08-01 18:30:45 +01:00
|
|
|
|
2005-07-31 14:11:44 +01:00
|
|
|
echo copying nixpkgs
|
|
|
|
|
2005-08-16 19:58:23 +01:00
|
|
|
svn export ${nixpkgs} ${archivesDir}/pkgs
|
|
|
|
#cp -fa ${nixpkgs} ${archivesDir}
|
2005-07-31 14:11:44 +01:00
|
|
|
|
2005-08-27 01:36:07 +01:00
|
|
|
#echo copying packages from store
|
2005-07-31 14:11:44 +01:00
|
|
|
|
2005-07-29 17:54:36 +01:00
|
|
|
#cp -fa --parents ${nixDeps} ${archivesDir}
|
2005-08-27 01:36:07 +01:00
|
|
|
#cp -fvau --parents ${utilLinux} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${Grub} ${archivesDir}
|
|
|
|
##cp -fau --parents ${gnuSed} ${archivesDir}
|
|
|
|
##cp -fau --parents ${gnuGrep} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${Kernel} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${SysVinit} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${BootPath} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${hotplug} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${udev} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${dhcp} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${nano} ${archivesDir}
|
|
|
|
#cp -fvau --parents ${gnutar} ${archivesDir}
|
2005-07-31 14:11:44 +01:00
|
|
|
|
2005-08-03 13:00:42 +01:00
|
|
|
bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)))
|
2005-08-01 18:30:45 +01:00
|
|
|
|
2005-07-31 14:11:44 +01:00
|
|
|
echo copying scripts
|
|
|
|
|
2005-07-06 15:42:41 +01:00
|
|
|
mkdir ${archivesDir}/scripts
|
|
|
|
cp -fa * ${archivesDir}/scripts
|
2005-08-31 13:02:28 +01:00
|
|
|
sed -e "s^@bash\@^$bash^g" \
|
|
|
|
-e "s^@coreutils\@^$coreutilsdiet^g" \
|
|
|
|
< $initscript > $initscript.tmp
|
|
|
|
mv $initscript.tmp $initscript
|
2005-07-06 17:00:20 +01:00
|
|
|
sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \
|
|
|
|
-e "s^@bootPath\@^$bootPath^g" \
|
2005-07-08 11:06:41 +01:00
|
|
|
-e "s^@NIX_CMD_PATH\@^$nix^g" \
|
2005-08-01 18:30:45 +01:00
|
|
|
-e "s^@bash\@^$bash^g" \
|
2005-08-03 13:00:42 +01:00
|
|
|
-e "s^@findutils\@^$findutils^g" \
|
2005-08-28 17:56:48 +01:00
|
|
|
-e "s^@coreutilsdiet\@^$coreutilsdiet^g" \
|
2005-08-03 13:00:42 +01:00
|
|
|
-e "s^@coreutils\@^$coreutils^g" \
|
|
|
|
-e "s^@utillinux\@^$utillinux^g" \
|
2005-08-05 14:48:22 +01:00
|
|
|
-e "s^@e2fsprogs\@^$e2fsprogs^g" \
|
2005-08-09 17:51:26 +01:00
|
|
|
-e "s^@modutils\@^$modutils^g" \
|
2005-08-13 00:40:12 +01:00
|
|
|
-e "s^@grub\@^$grub^g" \
|
2005-08-14 02:40:36 +01:00
|
|
|
-e "s^@kernel\@^$kernel^g" \
|
2005-08-17 20:19:54 +01:00
|
|
|
-e "s^@hotplug\@^$hotplug^g" \
|
2005-08-23 17:53:39 +01:00
|
|
|
-e "s^@gnugrep\@^$gnugrep^g" \
|
2005-08-26 00:10:36 +01:00
|
|
|
-e "s^@which\@^$which^g" \
|
2005-08-26 17:06:52 +01:00
|
|
|
-e "s^@gnutar\@^$gnutar^g" \
|
2005-08-28 01:51:34 +01:00
|
|
|
-e "s^@mingetty\@^$mingettyWrapper^g" \
|
2005-07-06 17:00:20 +01:00
|
|
|
< $fill_disk > $fill_disk.tmp
|
|
|
|
mv $fill_disk.tmp $fill_disk
|
2005-07-31 14:11:44 +01:00
|
|
|
|
|
|
|
echo copying bootimage
|
|
|
|
|
|
|
|
mkdir ${archivesDir}/isolinux
|
|
|
|
cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux
|
2005-07-31 20:01:59 +01:00
|
|
|
cp isolinux.cfg ${archivesDir}/isolinux
|
2005-07-31 14:11:44 +01:00
|
|
|
chmod u+w ${archivesDir}/isolinux/*
|
2005-07-31 16:25:39 +01:00
|
|
|
|
|
|
|
echo copying kernel
|
|
|
|
|
|
|
|
# By following the symlink we don't have to know the version number
|
|
|
|
# of the kernel here.
|
2005-07-31 20:04:58 +01:00
|
|
|
cp -L $kernel/vmlinuz ${archivesDir}/isolinux
|
2005-07-31 16:25:39 +01:00
|
|
|
|
2005-08-01 18:30:45 +01:00
|
|
|
echo creating ramdisk
|
|
|
|
|
|
|
|
rm -f ${initrd}
|
2005-08-31 13:02:28 +01:00
|
|
|
#cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init
|
|
|
|
cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/
|
|
|
|
cp ${archivesDir}/scripts/init.sh ${initdir}/init
|
2005-08-14 02:40:36 +01:00
|
|
|
ln -s ${bash}/bin/bash ${initdir}/bin/sh
|
2005-08-03 13:00:42 +01:00
|
|
|
chmod u+x ${initdir}/init
|
2005-08-31 13:02:28 +01:00
|
|
|
chmod u+x ${initdir}/fill-disk.sh
|
2005-08-03 13:00:42 +01:00
|
|
|
cp -fau --parents ${bashdeps} ${initdir}
|
2005-08-03 19:14:47 +01:00
|
|
|
cp -fau --parents ${utilLinux} ${initdir}
|
2005-08-28 17:56:48 +01:00
|
|
|
cp -fau --parents ${coreUtilsDiet} ${initdir}
|
2005-08-05 14:48:22 +01:00
|
|
|
cp -fau --parents ${e2fsProgs} ${initdir}
|
2005-08-09 17:51:26 +01:00
|
|
|
cp -fau --parents ${modUtils} ${initdir}
|
2005-08-17 20:19:54 +01:00
|
|
|
cp -fau --parents ${hotplug} ${initdir}
|
2005-08-30 12:23:56 +01:00
|
|
|
#cp -fau --parents ${which} ${initdir}
|
2005-08-03 13:00:42 +01:00
|
|
|
|
2005-08-11 15:06:04 +01:00
|
|
|
touch ${initdir}/NIXOS
|
|
|
|
|
2005-08-31 10:39:41 +01:00
|
|
|
(cd ${initdir}; find . |cpio -H newc -o) | gzip -9 > ${initrd}
|
2005-08-01 18:30:45 +01:00
|
|
|
|
2005-08-19 16:26:01 +01:00
|
|
|
chmod -f -R +w ${initdir}/*
|
|
|
|
rm -rf ${initdir}
|
|
|
|
|
2005-08-01 18:30:45 +01:00
|
|
|
cp ${initrd} ${archivesDir}/isolinux
|
2005-08-26 00:10:36 +01:00
|
|
|
rm -f ${initrd}
|
2005-07-31 16:25:39 +01:00
|
|
|
|
|
|
|
echo creating ISO image
|
|
|
|
|
|
|
|
mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \
|
2005-07-31 14:11:44 +01:00
|
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
|
|
|
${archivesDir}
|
2005-08-09 17:51:26 +01:00
|
|
|
|
2005-08-14 02:40:36 +01:00
|
|
|
# cleanup, be diskspace friendly
|
2005-08-16 22:46:08 +01:00
|
|
|
|
|
|
|
echo cleaning up
|
|
|
|
|
2005-08-14 02:40:36 +01:00
|
|
|
chmod -f -R +w ${archivesDir}/*
|
|
|
|
rm -rf ${archivesDir}/*
|