diff options
Diffstat (limited to 'scripts/build/chroot_devpts')
-rwxr-xr-x | scripts/build/chroot_devpts | 101 |
1 files changed, 72 insertions, 29 deletions
diff --git a/scripts/build/chroot_devpts b/scripts/build/chroot_devpts index d917bc4d4..713ff28ae 100755 --- a/scripts/build/chroot_devpts +++ b/scripts/build/chroot_devpts @@ -29,46 +29,89 @@ Require_stagefile .build/config .build/bootstrap case "${1}" in install) - Echo_message "Begin mounting /dev/pts..." + if [ "${LIVE_IMAGE_TYPE}" = "hdd" ]; then + Echo_message "Begin mounting /dev..." - # Checking stage file - Check_stagefile .build/chroot_devpts + # Checking stage file + Check_stagefile .build/chroot_devpts - # Checking lock file - Check_lockfile .lock + # Checking lock file + Check_lockfile .lock - # Creating lock file - Create_lockfile .lock + # Creating lock file + Create_lockfile .lock - # Creating mountpoint - mkdir -p chroot/dev/pts + # Creating mountpoint + mount --bind /dev chroot/dev || true + mount devpts-live -t devpts -o gid=5,mode=620 chroot/dev/pts || true - # Mounting /dev/pts - mount devpts-live -t devpts -o gid=5,mode=620 chroot/dev/pts || true + # Creating stage file + Create_stagefile .build/chroot_devpts + else + Echo_message "Begin mounting /dev/pts..." - # Creating stage file - Create_stagefile .build/chroot_devpts - ;; + # Checking stage file + Check_stagefile .build/chroot_devpts - remove) - Echo_message "Begin unmounting /dev/pts..." + # Checking lock file + Check_lockfile .lock - # Checking lock file - Check_lockfile .lock + # Creating lock file + Create_lockfile .lock - # Creating lock file - Create_lockfile .lock + # Creating mountpoint + mkdir -p chroot/dev/pts - # Unmounting /dev/pts - if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/* - then - umount chroot/dev/pts - else - umount -f chroot/dev/pts > /dev/null 2>&1 || true - fi + # Mounting /dev/pts + mount devpts-live -t devpts -o gid=5,mode=620 chroot/dev/pts || true - # Removing stage file - rm -f .build/chroot_devpts + # Creating stage file + Create_stagefile .build/chroot_devpts + fi + ;; + + remove) + if [ "${LIVE_IMAGE_TYPE}" = "hdd" ]; then + Echo_message "Begin unmounting /dev..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Unmounting /dev + if grep -qs "$(pwd)/chroot/dev" /proc/mounts || Find_files chroot/dev/* + then + umount chroot/dev/pts + umount chroot/dev + else + umount -f chroot/dev/pts > /dev/null 2>&1 || true + umount -f chroot/dev > /dev/null 2>&1 || true + fi + + # Removing stage file + rm -f .build/chroot_devpts + else + Echo_message "Begin unmounting /dev/pts..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Unmounting /dev/pts + if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/* + then + umount chroot/dev/pts + else + umount -f chroot/dev/pts > /dev/null 2>&1 || true + fi + + # Removing stage file + rm -f .build/chroot_devpts + fi ;; *) |