All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] e2scrub: check to make sure lvm2 is installed
@ 2019-03-21  2:02 Theodore Ts'o
  2019-03-21  2:02 ` [PATCH 2/9] debian: drop lvm2 from the recommends line Theodore Ts'o
                   ` (8 more replies)
  0 siblings, 9 replies; 38+ messages in thread
From: Theodore Ts'o @ 2019-03-21  2:02 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: darrick.wong, Theodore Ts'o

Not all systems will have the lvm2 package installed, so check for
that.  Pretty much all systems should have util-linux installed, but
check for that as well.

Of course, if lvm2 is installed we shouldn't find any LVM devices ---
but eventually the Demon Murphy will find a way to make it happen. :-)

Also, set the PATH so we don't have to worry about the script failing
due to /sbin not being in the path.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 scrub/e2scrub.in     | 12 ++++++++++++
 scrub/e2scrub_all.in | 16 ++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
index e1965db4e..51a909373 100644
--- a/scrub/e2scrub.in
+++ b/scrub/e2scrub.in
@@ -23,6 +23,8 @@
 # check filesystems in VGs that have at least 256MB (or so) of
 # free space.
 
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
 snap_size_mb=256
 fstrim=0
 reap=0
@@ -82,6 +84,16 @@ if [ -z "${arg}" ]; then
 	exitcode 1
 fi
 
+if ! type lsblk >& /dev/null ; then
+    echo "e2scrub: can't find lsblk --- is util-linux installed?"
+    exitcode 1
+fi
+
+if ! type lvcreate >& /dev/null ; then
+    echo "e2scrub: can't find lvcreate --- is lvm2 installed?"
+    exitcode 1
+fi
+
 # Find the device for a given mountpoint
 dev_from_mount() {
 	local mountpt="$(realpath "$1")"
diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index 23d122d25..d725a7f2e 100644
--- a/scrub/e2scrub_all.in
+++ b/scrub/e2scrub_all.in
@@ -18,6 +18,8 @@
 #  along with this program; if not, write the Free Software Foundation,
 #  Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
 
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
 scrub_all=0
 conffile="@root_sysconfdir@/e2scrub.conf"
 
@@ -68,6 +70,20 @@ while getopts "ArV" opt; do
 done
 shift "$((OPTIND - 1))"
 
+# If some prerequisite packages are not installed, exit with a code
+# indicating success to avoid spamming the sysadmin with fail messages
+# when e2scrub_all is run out of cron or a systemd timer.
+
+if ! type lsblk >& /dev/null ; then
+    echo "e2scrub_all: can't find lsblk --- is util-linux installed?"
+    exitcode 0
+fi
+
+if ! type lvcreate >& /dev/null ; then
+    echo "e2scrub_all: can't find lvcreate --- is lvm2 installed?"
+    exitcode 0
+fi
+
 # Find scrub targets, make sure we only do this once.
 ls_scrub_targets() {
 	lsblk -o NAME,FSTYPE,MOUNTPOINT -p -P -n | while read vars; do
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 38+ messages in thread
* [PATCH -v2 0/9] e2fsprogs: e2scrub cleanups
@ 2019-03-21 20:25 Theodore Ts'o
  2019-03-21 20:25 ` [PATCH 6/9] e2scrub_all: add the -n option which shows what e2scrub_all would do Theodore Ts'o
  0 siblings, 1 reply; 38+ messages in thread
From: Theodore Ts'o @ 2019-03-21 20:25 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: darrick.wong, lczerner, Theodore Ts'o

The primary changes are in the device probe loop refactor for
e2scrub_all.

There were also some documentation changes for the -n option.

Darrick J. Wong (1):
  e2scrub_all: refactor device probe loop

Theodore Ts'o (8):
  e2scrub: check to make sure lvm2 is installed
  debian: drop lvm2 from the recommends line
  Fix "make install-strip"
  e2scrub: fix up "make install-strip" support
  e2scrub: add the -n option which shows what commands e2scrub would
    execute
  e2scrub_all: add the -n option which shows what e2scrub_all would do
  e2scrub_all: make sure there's enough free space for a snapshot
  e2scrub,e2scrub_all: print a (more understandable) error if not run as
    root

-- 
2.19.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2019-03-22  9:38 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21  2:02 [PATCH 1/9] e2scrub: check to make sure lvm2 is installed Theodore Ts'o
2019-03-21  2:02 ` [PATCH 2/9] debian: drop lvm2 from the recommends line Theodore Ts'o
2019-03-21  3:57   ` Darrick J. Wong
2019-03-21  2:02 ` [PATCH 3/9] Fix "make install-strip" Theodore Ts'o
2019-03-21  2:02 ` [PATCH 4/9] e2scrub: fix up "make install-strip" support Theodore Ts'o
2019-03-21  2:02 ` [PATCH 5/9] e2fscrub: add the -n option which shows what commands e2scrub would execute Theodore Ts'o
2019-03-21  3:59   ` Darrick J. Wong
2019-03-21 10:57   ` Lukas Czerner
2019-03-21 14:32     ` Theodore Ts'o
2019-03-21  2:02 ` [PATCH 6/9] e2scrub_all: add the -n option which shows what e2scrub_all would do Theodore Ts'o
2019-03-21  4:01   ` Darrick J. Wong
2019-03-21  2:02 ` [PATCH 7/9] e2scrub_all: make sure there's enough free space for a snapshot Theodore Ts'o
2019-03-21  4:02   ` Darrick J. Wong
2019-03-21 11:18   ` Lukas Czerner
2019-03-21 14:26     ` Theodore Ts'o
2019-03-21  2:02 ` [PATCH 8/9] e2scrub_all: refactor device probe loop Theodore Ts'o
2019-03-21  4:05   ` Darrick J. Wong
2019-03-21 10:27   ` Lukas Czerner
2019-03-21 14:31     ` Theodore Ts'o
2019-03-21 15:57       ` Lukas Czerner
2019-03-21 18:24         ` Theodore Ts'o
2019-03-21 20:17           ` Lukas Czerner
2019-03-21 20:48             ` Theodore Ts'o
2019-03-21 21:14               ` Lukas Czerner
2019-03-21 22:04               ` Theodore Ts'o
2019-03-21 22:08                 ` Theodore Ts'o
2019-03-22  9:38                   ` Lukas Czerner
2019-03-21 20:09         ` Andreas Dilger
2019-03-21 17:48     ` Theodore Ts'o
2019-03-21 19:49       ` Lukas Czerner
2019-03-21 20:23         ` Theodore Ts'o
2019-03-21 16:10   ` Lukas Czerner
2019-03-21  2:02 ` [PATCH 9/9] e2scrub,e2scrub_all: print a (more understandable) error if not run as root Theodore Ts'o
2019-03-21  4:04   ` Darrick J. Wong
2019-03-21 11:36   ` Lukas Czerner
2019-03-21 14:40     ` Theodore Ts'o
2019-03-21  3:55 ` [PATCH 1/9] e2scrub: check to make sure lvm2 is installed Darrick J. Wong
2019-03-21 20:25 [PATCH -v2 0/9] e2fsprogs: e2scrub cleanups Theodore Ts'o
2019-03-21 20:25 ` [PATCH 6/9] e2scrub_all: add the -n option which shows what e2scrub_all would do Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.