aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2006-12-17 12:53:22 +0000
committerThomas Bächler <thomas@archlinux.org>2006-12-17 12:53:22 +0000
commit4b00503d2d25e40b0e962df08005d749cf3a4c87 (patch)
tree5e6f4577f33e8bd5070a7f1031abd9e4e73a03b2
parent779bd2abb1b67431b6e353eaba569779fb718833 (diff)
downloadinitscripts-4b00503d2d25e40b0e962df08005d749cf3a4c87.tar.xz
added stat_append to functions, fixed fsck bugs when clock is not set
-rw-r--r--functions10
-rwxr-xr-xrc.shutdown8
-rwxr-xr-xrc.sysinit20
3 files changed, 35 insertions, 3 deletions
diff --git a/functions b/functions
index 0ae7b62..a43d3a2 100644
--- a/functions
+++ b/functions
@@ -24,6 +24,9 @@ if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
C_CLEAR="\033[1;0m"
fi
+SAVE_POSITION="\033[s"
+RESTORE_POSITION="\033[u"
+
# prefixes:
PREFIX_REG="::"
@@ -51,10 +54,17 @@ stat_bkgd() {
stat_busy() {
echo -ne "$C_OTHER$PREFIX_REG $C_MAIN$1$C_CLEAR "
+ echo -ne "${SAVE_POSITION}"
deltext
echo -ne " $C_OTHER[${C_BUSY}BUSY$C_OTHER]$C_CLEAR "
}
+stat_append() {
+ echo -ne "${RESTORE_POSITION}"
+ echo -ne "$C_MAIN$1$C_CLEAR"
+ echo -ne "${SAVE_POSITION}"
+}
+
stat_done() {
deltext
echo -e " $C_OTHER[${C_DONE}DONE$C_OTHER]$C_CLEAR "
diff --git a/rc.shutdown b/rc.shutdown
index 31c1fa3..8befcf8 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -78,11 +78,17 @@ stat_done
# Kill non-root encrypted partition mappings
if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
- stat_busy "Deactivating encrypted volumes"
+ stat_busy "Deactivating encrypted volumes:"
CS=/sbin/cryptsetup.static
do_uncrypt() {
if [ $# -ge 3 ]; then
+ stat_append "${1}.."
$CS remove $1 >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ stat_append "failed "
+ else
+ stat_append "ok "
+ fi
fi
}
while read line; do
diff --git a/rc.sysinit b/rc.sysinit
index 5368a5a..c637d99 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -103,7 +103,7 @@ fi
# Set up non-root encrypted partition mappings
if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
- stat_busy "Unlocking encrypted volumes"
+ stat_busy "Unlocking encrypted volumes:"
csfailed=0
CS=/sbin/cryptsetup.static
do_crypt() {
@@ -113,6 +113,7 @@ if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
cpass="$3"
shift 3
copts="$*"
+ stat_append "${cname}.."
if [ "${cpass:0:1}" != "/" ]; then
# For some fun reason, the parameter ordering varies for
# LUKS and non-LUKS devices. Joy.
@@ -128,7 +129,12 @@ if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
$CS -d $cpass $copts create $cname $csrc >/dev/null
fi
fi
- [ $? -ne 0 ] && csfailed=1
+ if [ $? -ne 0 ]; then
+ csfailed=1
+ stat_append "failed "
+ else
+ stat_append "ok "
+ fi
fi
}
while read line; do
@@ -143,6 +149,16 @@ fi
status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
+# Set clock early to fix some bugs with filesystem checks
+# Clock is set again later to match rc.conf
+if [ -f /etc/localtime ]; then
+ if [ "$HARDWARECLOCK" = "UTC" ]; then
+ /sbin/hwclock --directisa --utc --hctosys
+ else
+ /sbin/hwclock --directisa --localtime --hctosys
+ fi
+fi
+
FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
NETFS="nonfs,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,nousbfs,noshfs,nofuse"