aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions61
-rwxr-xr-xrc.sysinit4
2 files changed, 37 insertions, 28 deletions
diff --git a/functions b/functions
index 2ee56b4..d0747ba 100644
--- a/functions
+++ b/functions
@@ -4,26 +4,40 @@
# width:
-STAT_COL=80
-if [[ ! -t 1 ]]; then
- USECOLOR=""
-elif [[ -t 0 ]]; then
- # stty will fail when stdin isn't a terminal
- STAT_COL="$(/bin/stty size)"
- # stty gives "rows cols"; strip the rows number, we just want columns
- STAT_COL="${STAT_COL##* }"
-elif /bin/tput cols &>/dev/null; then
- # is /usr/share/terminfo already mounted, and TERM recognized?
- STAT_COL=$(/bin/tput cols)
-fi
-if ((STAT_COL==0)); then
- # if output was 0 (serial console), set default width to 80
+calc_columns () {
STAT_COL=80
- USECOLOR=""
-fi
+ if [[ ! -t 1 ]]; then
+ USECOLOR=""
+ elif [[ -t 0 ]]; then
+ # stty will fail when stdin isn't a terminal
+ STAT_COL="$(/bin/stty size)"
+ # stty gives "rows cols"; strip the rows number, we just want columns
+ STAT_COL="${STAT_COL##* }"
+ elif /bin/tput cols &>/dev/null; then
+ # is /usr/share/terminfo already mounted, and TERM recognized?
+ STAT_COL=$(/bin/tput cols)
+ fi
+ if ((STAT_COL==0)); then
+ # if output was 0 (serial console), set default width to 80
+ STAT_COL=80
+ USECOLOR=""
+ fi
+
+ # we use 13 characters for our own stuff
+ STAT_COL=$(($STAT_COL - 13))
+
+ if [[ -t 1 ]]; then
+ SAVE_POSITION="\e[s"
+ RESTORE_POSITION="\e[u"
+ DEL_TEXT="\e[$(($STAT_COL+4))G"
+ else
+ SAVE_POSITION=""
+ RESTORE_POSITION=""
+ DEL_TEXT=""
+ fi
+}
-# we use 13 characters for our own stuff
-STAT_COL=$(($STAT_COL - 13))
+calc_columns
# disable colors on broken terminals
TERM_COLORS="$(/bin/tput colors 2>/dev/null)"
@@ -76,16 +90,6 @@ if [[ $USECOLOR =~ yes|YES ]]; then
fi
fi
-if [[ -t 1 ]]; then
- SAVE_POSITION="\e[s"
- RESTORE_POSITION="\e[u"
- DEL_TEXT="\e[$(($STAT_COL+4))G"
-else
- SAVE_POSITION=""
- RESTORE_POSITION=""
- DEL_TEXT=""
-fi
-
# prefixes:
PREFIX_REG="::"
@@ -338,6 +342,7 @@ read_crypttab() {
# sysinit_udevsettled: after uevents have settled in rc.sysinit
# single_udevsettled: after uevents have settled in rc.single
# sysinit_premount: before local filesystems are mounted, but after root is mounted read-write in rc.sysinit
+# sysinit_postmount: after local filesystems are mounted
# shutdown_prekillall: before all processes are being killed in rc.shutdown
# single_prekillall: before all processes are being killed in rc.single
# shutdown_postkillall: after all processes have been killed in rc.shutdown
diff --git a/rc.sysinit b/rc.sysinit
index 8158f78..b5d63ea 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -95,6 +95,9 @@ unset mods
status "Waiting for UDev uevents to be processed" \
udevadm settle --timeout=${UDEV_TIMEOUT:-30}
+# in case loading a module changed the display mode
+calc_columns
+
run_hook sysinit_udevsettled
# bring up the loopback interface
@@ -277,6 +280,7 @@ stat_busy "Mounting Local Filesystems"
run_hook sysinit_premount
# now mount all the local filesystems
mount -a -t $NETFS -O no_netdev
+ run_hook sysinit_postmount
stat_done
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw