summaryrefslogtreecommitdiffstats
path: root/lib/chroot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chroot.sh')
-rw-r--r--lib/chroot.sh82
1 files changed, 0 insertions, 82 deletions
diff --git a/lib/chroot.sh b/lib/chroot.sh
deleted file mode 100644
index 4aea1d1..0000000
--- a/lib/chroot.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-# Functions for setting up isolated file system environments
-#
-# Copyright (C) 2014 Patrick "P. J." McDermott
-#
-# This file is part of the ProteanOS Development Kit.
-#
-# The ProteanOS Development Kit is free software: you can redistribute
-# it and/or modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# The ProteanOS Development Kit is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with the ProteanOS Development Kit. If not, see
-# <http://www.gnu.org/licenses/>.
-
-[ "x${_CHROOT_SM+set}" = 'xset' ] && return 0
-_CHROOT_SM=1
-
-use profile
-
-chroot_mount()
-{
- local root="${1}"
- local arch=
- local plat=
- local fs=
- local dir=
- local fstype=
- local options=
-
- arch="$(cat "${root}/etc/proteanos_arch")"
- plat="$(cat "${root}/etc/proteanos_plat")"
-
- while read fs dir fstype options; do
- [ "x${dir}" = 'x' ] && continue
- mount -t "${fstype}" -o "${options}" "${fs}" "${root}/${dir}"
- done <<-EOF
- $(profile_get_fstab "${arch}" "${plat}")
- EOF
-}
-
-chroot_umount()
-{
- local root="${1}"
- local arch=
- local plat=
- local fs=
- local dir=
- local fstype=
- local options=
-
- arch="$(cat "${root}/etc/proteanos_arch")"
- plat="$(cat "${root}/etc/proteanos_plat")"
-
- while read fs dir fstype options; do
- [ "x${dir}" = 'x' ] && continue
- # umount sometimes complains that the /dev file system is busy.
- # Here's a kludge to try to handle that. We better make sure
- # bind mounts get unmounted; otherwise, `rm -Rf ${root}` can be
- # painful.
- while ! umount "${root}/${dir}"; do
- sleep 1
- done
- done <<-EOF
- $(profile_get_fstab "${arch}" "${plat}" | sed -n '1!G;h;$p')
- EOF
-}
-
-chroot_exec()
-{
- local root="${1}"
- shift 1
-
- chroot_mount "${root}"
- chroot "${root}" "${@}"
- chroot_umount "${root}"
-}