[arch-projects] [initscripts] a bit of cleanup
Hi guys, I'm about to push thefollowing patches, so feedback welcome. In particular: 1) this might affect hooks. any known cases? imho they should be fixed 2) stole this from dave even though he did not submit it. the nerve! 3) this changes behavior, please raise any objections now 4) nothing interesting, move along -t
Avoid global variables, and make things clearer.
Signed-off-by: Tom Gundersen
On Sat, Mar 17, 2012 at 11:44:27AM +0100, Tom Gundersen wrote:
Avoid global variables, and make things clearer.
Signed-off-by: Tom Gundersen
--- functions | 6 ++++++ rc.sysinit | 29 ++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/functions b/functions index 0b7fd8d..747e42d 100644 --- a/functions +++ b/functions @@ -428,6 +428,12 @@ NETFS="nfs,nfs4,smbfs,cifs,codafs,ncpfs,shfs,fuse,fuseblk,glusterfs,davfs,fuse.g
# Check local filesystems fsck_all() { + [[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-f"
If you're trying to make things clearer, I'd probably convert this one into an if statement as well. The use of "||" and "&&" might be a bit confusing if you don't have a closer look here.
+ + if [[ ! -n $FORCEFSCK ]] && { [[ -f /fastboot ]] || in_array fastboot $(< /proc/cmdline); }; then + return
No return value? :) We use the return value of fsck_all() later so it might be worthwhile to explicitly return 0/1 here. Note that moving these checks into fsck_all() will also result in the "Checking Filesystems" being displayed even if the fastboot option is used (just saying, even though you were probably aware of that when writing this patch).
+ fi + if [[ -e /run/initramfs/root-fsck ]]; then IGNORE_MOUNTED="-M" fi diff --git a/rc.sysinit b/rc.sysinit index 8fa4270..0876d05 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -176,24 +176,19 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then fi
# Check filesystems -[[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-f" -declare -r FORCEFSCK - -if [[ -n $FORCEFSCK ]] || { [[ ! -f /fastboot ]] && ! in_array fastboot $(< /proc/cmdline); }; then - run_hook sysinit_prefsck - if [[ -x $(type -P fsck) ]]; then - stat_busy "Checking Filesystems" - fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}" - declare -r fsckret=$? - (( fsckret <= 1 )) && stat_done || stat_fail - else - declare -r fsckret=0 - fi - run_hook sysinit_postfsck - - # Single-user login and/or automatic reboot if needed - fsck_reboot $fsckret +run_hook sysinit_prefsck +if [[ -x $(type -P fsck) ]]; then + stat_busy "Checking Filesystems" + fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}" + declare -r fsckret=$? + (( fsckret <= 1 )) && stat_done || stat_fail +else + declare -r fsckret=0 fi +run_hook sysinit_postfsck + +# Single-user login and/or automatic reboot if needed +fsck_reboot $fsckret
status "Remounting Root" \ mount -o remount / -- 1.7.9.4
On Sat, Mar 17, 2012 at 6:01 PM, Lukas Fleischer
On Sat, Mar 17, 2012 at 11:44:27AM +0100, Tom Gundersen wrote:
# Check local filesystems fsck_all() { + [[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-f"
If you're trying to make things clearer, I'd probably convert this one into an if statement as well. The use of "||" and "&&" might be a bit confusing if you don't have a closer look here.
I'm not too bothered about this, but next time someone touches that line we could change it into an "if".
+ + if [[ ! -n $FORCEFSCK ]] && { [[ -f /fastboot ]] || in_array fastboot $(< /proc/cmdline); }; then + return
No return value? :) We use the return value of fsck_all() later so it might be worthwhile to explicitly return 0/1 here.
Thanks! Fixed.
Note that moving these checks into fsck_all() will also result in the "Checking Filesystems" being displayed even if the fastboot option is used (just saying, even though you were probably aware of that when writing this patch).
Yeah, I thought that was ok. We might add some message saying that it is being skipped, but let's keep it like it is for now. -t
From: Dave Reisner
dm-mod and dm-crypt will be autoloaded when needed (at least on kernels
newer than 2.6.36).
The rtc modules should be compiled in, as they have been in the official
kernels for some time.
Signed-off-by: Tom Gundersen
No functional change, just improve readability.
Signed-off-by: Tom Gundersen
Am 17.03.2012 11:44, schrieb Tom Gundersen:
In particular: 1) this might affect hooks. any known cases? imho they should be fixed
Main users of hooks are the *splash people. And archlive/larch might use it too (I think the fsck hooks were for archlive originally).
2) stole this from dave even though he did not submit it. the nerve!
Good idea - we used to have quite a funny switcheroo with cryptsetup was that two years ago already?
participants (3)
-
Lukas Fleischer
-
Thomas Bächler
-
Tom Gundersen