1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

* Copy the NixOS/Nixpkgs sources to /etc/nixos on the target.

svn path=/nixos/trunk/; revision=7846
This commit is contained in:
Eelco Dolstra 2007-02-05 16:23:19 +00:00
parent 4f64075215
commit 6291281358

View file

@ -147,16 +147,38 @@ chroot $mountPoint @nix@/bin/nix-env \
# Copy the configuration to /etc/nixos.
backupTimestamp=$(date "+%Y%m%d%H%M%S")
targetConfig=$mountPoint/etc/nixos/configuration.nix
mkdir -p $(dirname $targetConfig)
if test -e $targetConfig -o -L $targetConfig; then
cp -f $targetConfig $targetConfig.backup-$(date "+%Y%m%d%H%M%S")
cp -f $targetConfig $targetConfig.backup-$backupTimestamp
fi
if test "$nixosConfiguration" != "$targetConfig"; then
cp -f $nixosConfiguration $targetConfig
fi
# Make a backup of the old NixOS/Nixpkgs sources.
echo "copying NixOS/Nixpkgs sources to /etc/nixos...."
targetNixos=$mountPoint/etc/nixos/nixos
if test -e $targetNixos; then
mv $targetNixos $targetNixos.backup-$backupTimestamp
fi
targetNixpkgs=$mountPoint/etc/nixos/nixpkgs
if test -e $targetNixpkgs; then
mv $targetNixpkgs $targetNixpkgs.backup-$backupTimestamp
fi
# Copy the NixOS/Nixpkgs sources to the target.
cp -prd $nixosDir $targetNixos
if test -e /etc/nixos/nixpkgs; then
cp -prd /etc/nixos/nixpkgs $targetNixpkgs
fi
# Grub needs a mtab.
rootDevice=$(df $mountPoint | grep '^/' | sed 's^ .*^^')
echo "$rootDevice / somefs rw 0 0" > $mountPoint/etc/mtab