This repository has been archived on 2024-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
evolution-packages/srcpkgs/dinit/files/dinit.d/rootfscheck.sh

33 lines
985 B
Bash
Raw Normal View History

2023-08-28 22:56:39 +01:00
#!/bin/sh
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
if [ "$1" != "stop" ]; then
ROOTDEV=`findmnt -v -o SOURCE -n -M /`
echo "Checking root file system (^C to skip)..."
if [ -x /sbin/fsck ]; then
/sbin/fsck -C -a "$ROOTDEV"
fsckresult=$?
if [ $((fsckresult & 4)) -eq 4 ]; then
echo "***********************"
echo "WARNING WARNING WARNING"
echo "***********************"
echo "The root file system has problems which require user attention."
echo "A maintenance shell will now be started; system will then be rebooted."
/sbin/sulogin
/sbin/reboot --use-passed-cfd -r
elif [ $(($fsckresult & 2)) -eq 2 ]; then
echo "***********************"
echo "WARNING WARNING WARNING"
echo "***********************"
echo "The root file system had problems (now repaired): rebooting..."
sleep 5
/sbin/reboot --use-passed-cfd -r
fi
else
echo "WARNING - Could not find /sbin/fsck"
fi
fi;