summary refs log tree commit diff
path: root/pkgs/build-support/build-fhs-chrootenv/destroy.sh.in
blob: 30b51cb5068f71fa61731e18e04be355a0656595 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! @shell@ -e

chrootenvDest=/run/chrootenv/@name@

# Remove bind mount points
rmdir $chrootenvDest/{dev,nix/store,nix,proc,sys,host-etc,home,var,run}

# Remove symlinks to the software that should be part of the chroot system profile
for i in @chrootEnv@/sw/*
do
    if [ "$i" != "@chrootEnv@/sw/etc" ] && [ "$i" != "@chrootEnv@/sw/var" ]
    then
        rm $chrootenvDest/$(basename $i)
    fi
done

# Remove the remaining folders
rm -Rf $chrootenvDest/{etc,root,tmp}

# Remove the chroot environment folder
rmdir $chrootenvDest