From 30c93cc91043075f1055918b06f8ed60edddf8d6 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Wed, 3 Aug 2022 15:47:17 -0700 Subject: [PATCH] make jail mounts work with all file system devices --- bin/vhost-del.sh | 6 +++--- bin/vhost-user-del.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/vhost-del.sh b/bin/vhost-del.sh index a8d77ce..cdb32f1 100755 --- a/bin/vhost-del.sh +++ b/bin/vhost-del.sh @@ -54,13 +54,13 @@ if [[ -f /etc/varnish/sites.d/$domain.vcl ]]; then fi # if virtualhost is mounted in a jail, unmount it -if grep -q "^/dev/sda /usr/jails/$username/srv/www/$domain " /etc/mtab; then +if grep -q " /usr/jails/$username/srv/www/$domain " /etc/mtab; then umount /usr/jails/$username/srv/www/$domain fi # if virtualhost mount in fstab.jails exists remove it -if grep -q "/usr/jails/$username/srv/www/$domain" /etc/fstab.jails; then - sed -i "\|/usr/jails/$username/srv/www/$domain|d" /etc/fstab.jails +if grep -q " /usr/jails/$username/srv/www/$domain " /etc/fstab.jails; then + sed -i "\| /usr/jails/$username/srv/www/$domain |d" /etc/fstab.jails fi # if virtualhost symlink exists in jail remove it diff --git a/bin/vhost-user-del.sh b/bin/vhost-user-del.sh index a134ffe..2c277ac 100755 --- a/bin/vhost-user-del.sh +++ b/bin/vhost-user-del.sh @@ -42,7 +42,7 @@ do done # check for jailed vhost mount -if /bin/grep -q "^/dev/sda /usr/jails/$username/srv/www/" /etc/mtab; then +if /bin/grep -q " /usr/jails/$username/srv/www/" /etc/mtab; then echo user \"$username\" has one or more jailed vhosts mounted exit 1 fi @@ -70,7 +70,7 @@ if [[ -f "/etc/php/$phpVersion/fpm/pool.d/$username.conf" ]]; then fi # if users home dir is mounted in a jail, unmount it -if grep -q "^/dev/sda /usr/jails/$username/home/$username " /etc/mtab; then +if grep -q " /usr/jails/$username/home/$username " /etc/mtab; then umount /usr/jails/$username/home/$username fi