2006-12-09 19:25:23 +00:00
|
|
|
#! @shell@
|
|
|
|
|
2009-01-02 16:06:46 +00:00
|
|
|
source @newActivationScript@
|
2006-12-21 14:44:22 +00:00
|
|
|
|
2006-12-09 19:25:23 +00:00
|
|
|
|
2007-06-08 15:41:12 +00:00
|
|
|
# Set up Nix.
|
2008-01-24 16:56:09 +00:00
|
|
|
mkdir -p /nix/etc/nix
|
|
|
|
ln -sfn /etc/nix.conf /nix/etc/nix/nix.conf
|
|
|
|
chown root.nixbld /nix/store
|
|
|
|
chmod 1775 /nix/store
|
2006-12-09 19:25:23 +00:00
|
|
|
|
|
|
|
|
2006-12-10 22:29:44 +00:00
|
|
|
# Nix initialisation.
|
2008-01-24 16:56:09 +00:00
|
|
|
mkdir -m 0755 -p \
|
|
|
|
/nix/var/nix/gcroots \
|
|
|
|
/nix/var/nix/temproots \
|
|
|
|
/nix/var/nix/manifests \
|
|
|
|
/nix/var/nix/userpool \
|
|
|
|
/nix/var/nix/profiles \
|
|
|
|
/nix/var/nix/db \
|
|
|
|
/nix/var/log/nix/drvs \
|
2008-10-29 15:43:37 +00:00
|
|
|
/nix/var/nix/channel-cache \
|
|
|
|
/nix/var/nix/chroots
|
2007-08-22 14:58:51 +00:00
|
|
|
mkdir -m 1777 -p /nix/var/nix/gcroots/per-user
|
2007-01-15 14:43:56 +00:00
|
|
|
mkdir -m 1777 -p /nix/var/nix/profiles/per-user
|
2006-12-10 22:29:44 +00:00
|
|
|
|
|
|
|
ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/
|
2007-08-09 23:54:23 +00:00
|
|
|
ln -sf /nix/var/nix/manifests /nix/var/nix/gcroots/
|
2006-12-10 22:29:44 +00:00
|
|
|
|
|
|
|
|
2006-12-09 19:25:23 +00:00
|
|
|
# Make a few setuid programs work.
|
2007-01-15 14:43:56 +00:00
|
|
|
PATH=@systemPath@/bin:@systemPath@/sbin:$PATH
|
2008-03-19 12:34:39 +00:00
|
|
|
save_PATH="$PATH"
|
|
|
|
|
|
|
|
# Add the default profile to the search path for setuid executables.
|
|
|
|
PATH="/nix/var/nix/profiles/default/sbin:$PATH"
|
|
|
|
PATH="/nix/var/nix/profiles/default/bin:$PATH"
|
|
|
|
|
2006-12-09 19:25:23 +00:00
|
|
|
wrapperDir=@wrapperDir@
|
|
|
|
if test -d $wrapperDir; then rm -f $wrapperDir/*; fi
|
|
|
|
mkdir -p $wrapperDir
|
2007-01-11 16:29:23 +00:00
|
|
|
for i in @setuidPrograms@; do
|
2006-12-09 19:25:23 +00:00
|
|
|
program=$(type -tp $i)
|
2008-07-25 13:34:00 +00:00
|
|
|
if test -z "$program"; then
|
2008-03-17 10:11:48 +00:00
|
|
|
# XXX: It would be preferable to detect this problem before
|
|
|
|
# `activate-configuration' is invoked.
|
2008-11-07 13:38:05 +00:00
|
|
|
#echo "WARNING: No executable named \`$i' was found" >&2
|
|
|
|
#echo "WARNING: but \`$i' was specified as a setuid program." >&2
|
|
|
|
true
|
2008-07-25 13:34:00 +00:00
|
|
|
else
|
|
|
|
cp "$(type -tp setuid-wrapper)" $wrapperDir/$i
|
|
|
|
echo -n "$program" > $wrapperDir/$i.real
|
|
|
|
chown root.root $wrapperDir/$i
|
|
|
|
chmod 4755 $wrapperDir/$i
|
2008-03-17 10:11:48 +00:00
|
|
|
fi
|
2006-12-09 19:25:23 +00:00
|
|
|
done
|
|
|
|
|
2008-06-30 15:13:02 +00:00
|
|
|
@adjustSetuidOwner@
|
|
|
|
|
2008-03-19 12:34:39 +00:00
|
|
|
PATH="$save_PATH"
|
2006-12-09 19:25:23 +00:00
|
|
|
|
2007-12-04 15:02:48 +00:00
|
|
|
# Set the host name. Don't clear it if it's not configured in the
|
|
|
|
# NixOS configuration, since it may have been set by dhclient in the
|
|
|
|
# meantime.
|
|
|
|
if test -n "@hostName@"; then
|
|
|
|
hostname @hostName@
|
|
|
|
else
|
|
|
|
# dhclient won't do anything if the hostname isn't empty.
|
|
|
|
if test "$(hostname)" = "(none)"; then
|
|
|
|
hostname ''
|
|
|
|
fi
|
|
|
|
fi
|
2007-03-20 11:45:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Make this configuration the current configuration.
|
2008-01-30 01:28:56 +00:00
|
|
|
# The readlink is there to ensure that when $systemConfig = /system
|
|
|
|
# (which is a symlink to the store), /var/run/current-system is still
|
|
|
|
# used as a garbage collection root.
|
|
|
|
ln -sfn "$(readlink -f "$systemConfig")" /var/run/current-system
|
2007-05-09 17:32:41 +00:00
|
|
|
|
2007-03-20 11:45:59 +00:00
|
|
|
|
|
|
|
# Prevent the current configuration from being garbage-collected.
|
|
|
|
ln -sfn /var/run/current-system /nix/var/nix/gcroots/current-system
|