2020-04-30 02:33:20 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
prereqs)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Extract kernel parameters
|
|
|
|
root_val=""
|
|
|
|
set -- $(cat /proc/cmdline)
|
|
|
|
for x in "$@"; do
|
|
|
|
case "$x" in
|
2023-12-19 19:51:49 -06:00
|
|
|
root=UUID=*)
|
|
|
|
root_val="${x#root=UUID=}"
|
|
|
|
blkdev=$(blkid --uuid $root_val)
|
|
|
|
;;
|
2020-04-30 02:33:20 -05:00
|
|
|
root=*)
|
2023-12-19 19:51:49 -06:00
|
|
|
blkdev="${x#root=}"
|
2020-04-30 02:33:20 -05:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Check the filesystem we are using
|
2023-12-19 19:51:49 -06:00
|
|
|
if [ ! -z $blkdev ]; then
|
|
|
|
fstype=$(blkid -o value -s TYPE $blkdev)
|
2020-04-30 02:33:20 -05:00
|
|
|
case "$fstype" in
|
|
|
|
ext4)
|
|
|
|
cmd="fsck.ext4 -v -p"
|
|
|
|
;;
|
|
|
|
ext3)
|
|
|
|
cmd="fsck.ext3 -v -p"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ ! -z "$cmd" ]; then
|
2023-12-19 19:51:49 -06:00
|
|
|
$cmd $blkdev 2>&1 | gzip -c > /tmp/fsck.log.gz
|
2020-04-30 02:33:20 -05:00
|
|
|
fi
|
|
|
|
fi
|