2018-04-30 16:57:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#remaster lib
|
2018-05-07 00:56:46 +00:00
|
|
|
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
|
2018-04-30 16:57:01 +00:00
|
|
|
|
|
|
|
#chroot_umount [chroot_dir]
|
|
|
|
function chroot_umount() {
|
|
|
|
echo -n "unmount chroot ... "
|
|
|
|
|
|
|
|
#check chroot dir
|
|
|
|
chroot_dir="$1"
|
|
|
|
[ -d "$chroot_dir" ] || {
|
|
|
|
echo "### ERROR ### chroot_umount: chroot directory not exist!"
|
|
|
|
return 12
|
|
|
|
}
|
|
|
|
|
|
|
|
for d in "$chroot_dir/tmp" "$chroot_dir/root" "$chroot_dir/proc" "$chroot_dir/dev" ; do
|
|
|
|
umount $d
|
|
|
|
retval=$?
|
|
|
|
[ "$retval" -gt 0 ] && {
|
|
|
|
echo "### ERROR ### chroot_umount: can't umount \"$d\"!"
|
|
|
|
return 21
|
|
|
|
}
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "done"
|
|
|
|
}
|
2018-05-10 15:13:19 +00:00
|
|
|
|
2018-05-10 22:04:02 +00:00
|
|
|
#this func is standalone executable
|
2018-05-10 15:13:19 +00:00
|
|
|
[ -n "$1" ] && {
|
2018-05-10 22:04:02 +00:00
|
|
|
chroot_umount $@
|
2018-05-10 15:13:19 +00:00
|
|
|
}
|