Init fixes.

This commit is contained in:
Syahrial Agni Prasetya 2021-05-28 18:10:54 +07:00
parent 2e0b458f11
commit 286542f481
No known key found for this signature in database
GPG Key ID: 46F88749C8C79383

View File

@ -17,11 +17,15 @@ msg(){
printf "${green}${bold}%s${reset}\n" "==> $*" 1>&2 printf "${green}${bold}%s${reset}\n" "==> $*" 1>&2
} }
checkmount(){
mount | grep "${CHROOT}${1}" >/dev/null 2>&1
}
rbind(){ rbind(){
if [ "$(mount | grep "${CHROOT}"${1} >/dev/null 2>&1)" ]; then if checkmount $1; then
msg "${CHROOT}${1} already mounted." msg "${CHROOT}${1} already mounted."
else else
mount -R $1 "${CHROOT}"${1} mount -R $1 "${CHROOT}${1}"
msg "${CHROOT}${1} mounted!" msg "${CHROOT}${1} mounted!"
fi fi
if [ "$2" = "make-rslave" ]; then if [ "$2" = "make-rslave" ]; then
@ -30,16 +34,16 @@ rbind(){
} }
rbind_diff() { rbind_diff() {
if [ "$(mount | grep "${CHROOT}"${2})" ]; then if checkmount $2; then
msg "$CHROOT$2 already mounted." msg "${CHROOT}${2} already mounted."
else else
mount -R $1 "${CHROOT}"${2} mount -R $1 "${CHROOT}${2}"
msg "${CHROOT}${2} mounted!" msg "${CHROOT}${2} mounted!"
fi fi
} }
bindproc() { bindproc() {
if [ "$(mount | grep "${CHROOT}"/proc)" ]; then if checkmount /proc; then
msg "${CHROOT}/proc already mounted." msg "${CHROOT}/proc already mounted."
else else
mount -t proc /proc "${CHROOT}"/proc mount -t proc /proc "${CHROOT}"/proc
@ -50,7 +54,7 @@ bindproc() {
rmbind() { rmbind() {
umount_args=-R umount_args=-R
[ "$LAZY_UMOUNT" = "yes" ] && umount_args=-Rl [ "$LAZY_UMOUNT" = "yes" ] && umount_args=-Rl
if [ "$(mount | grep "${CHROOT}"${1})" ]; then if checkmount $1; then
umount $umount_args "${CHROOT}"${1} umount $umount_args "${CHROOT}"${1}
msg "${CHROOT}${1} unmounted!" msg "${CHROOT}${1} unmounted!"
fi fi