ppcrcd/trunk/conf.dir/usr/lib/ppcrcd: functions hw-detect load-conf rc.live
sparky
cvs at pld-linux.org
Mon Feb 27 12:26:58 CET 2006
Author: sparky
Date: Mon Feb 27 12:26:50 2006
New Revision: 7032
Modified:
ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions
ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect
ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf
ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live
Log:
- add colors
- incrase required verbosity levels (to make 0 == no verbose)
Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions Mon Feb 27 12:26:50 2006
@@ -3,6 +3,13 @@
PATH=/bin:/sbin:/usr/bin:/usr/sbin
+esc=$(echo -n -e "\033")
+cR="$esc[31m"
+cG="$esc[32m"
+cB="$esc[34m"
+cY="$esc[33m"
+cE="$esc[0m"
+
### lastlink: recurently resolve symlink #####################################
lastlink() {
ll_dir="$(dirname "$1")"
@@ -28,9 +35,9 @@
ERROR=$1
shift
if [ "$ERROR" -gt 0 ]; then
- echo "$0: ERROR($ERROR): $*" > /dev/stderr
+ echo "$cR${0##/}: ERROR($ERROR): $*$cE" > /dev/stderr
else
- echo "$0: ABORTED: $*" > /dev/stderr
+ echo "$cY${0##/}: ABORTED: $*$cE" > /dev/stderr
fi
echo $ERROR > /tmp/sig
sync; usleep 100000
@@ -40,7 +47,7 @@
### warn: show warning on stderr #############################################
warn() {
- echo "$0: Warning: $*" > /dev/stderr
+ echo "$cY${0##/}: Warning: $*$cE" > /dev/stderr
}
@@ -55,10 +62,23 @@
Eoptnew="-n"
shift
fi
+ color=
+ endcol=
+ case "$1" in
+ -[RGBY])
+ c="${1#-}"
+ cR="$esc[31m"
+ cG="$esc[32m"
+ cB="$esc[34m"
+ cY="$esc[33m"
+ eval color="\$c${c}"
+ endcol="$cE"
+ ;;
+ esac
if [ "$Eopt" = "-n" ]; then
- echo $Eoptnew "$*"
+ echo $Eoptnew "$color$*$endcol"
else
- echo $Eoptnew "$(basename $0): $*"
+ echo $Eoptnew "$color${0##/}: $*$endcol"
fi
Eopt=$Eoptnew
}
Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect Mon Feb 27 12:26:50 2006
@@ -6,13 +6,13 @@
. /usr/lib/ppcrcd/functions
-verbose 0 "Autodetecting PCI hardware"
+verbose 1 -G "Autodetecting PCI hardware"
# SCSI #######################################################################
-verbose 1 " +-Checking scsi controllers"
+verbose 2 " +-Checking scsi controllers"
COUNT=0
for scsi in $(/usr/bin/pcidev /m scsi); do
- verbose 2 " +-Found scsi ${COUNT}: ${scsi}"
+ verbose 3 " +-Found scsi ${COUNT}: ${scsi}"
echo "alias scsi_hostadapter${COUNT} ${scsi}" | sed -e 's/pter0 /pter /' \
>> /etc/modprobe.conf
let $((++COUNT))
@@ -21,15 +21,15 @@
# IDE ########################################################################
-verbose 1 " +-Checking ide controllers"
+verbose 2 " +-Checking ide controllers"
for ide in `/usr/bin/pcidev /m ide`; do
- verbose 2 " +-Found IDE: $ide"
+ verbose 3 " +-Found IDE: $ide"
modprobe $ide
done
# USB ########################################################################
-verbose 1 " +-Checking usb controllers"
+verbose 2 " +-Checking usb controllers"
/sbin/lspci -v | awk '
/USB Controller:.*prog-if 00/ { print "alias usb-controller uhci-hcd" }
/USB Controller:.*prog-if 10/ { print "alias usb-controller ohci-hcd" }
@@ -42,19 +42,19 @@
echo -e "\n# autogenerated" >> /etc/fstab
# Searching for cdroms #######################################################
-verbose 1 " +-Searching CDROMs"
+verbose 2 " +-Searching CDROMs"
modprobe ide-cd
cddev=$(grep /media/ppcrcd /etc/fstab | awk '{print $1}')
[ -n "$cddevs" ] && cddev=$(lastlink $cddev)
cddevs=" $cddev "
for cdrom in /dev/{dvd,cdwriter,cdrom} /dev/{dvd,cdwriter,cdrom}*; do
- verbose 3 " +-Checking cdrom: $cdrom"
+ verbose 4 " +-Checking cdrom: $cdrom"
[ -r $cdrom ] || continue
cddev=$(lastlink $cdrom)
echo "$cddevs" | grep -q " $cddev " && continue
cddevs="$cddevs $cddev "
- verbose 2 " +-Found cdrom: $cdrom"
+ verbose 4 " +-Found cdrom: $cdrom"
echo "$cdrom /media/$(basename $cdrom) iso9660,udf,hfsplus,hfs defaults,ro,user,noauto" \
>> /etc/fstab
mkdir -p /media/$(basename $cdrom)
@@ -63,17 +63,17 @@
echo >> /etc/fstab
# Searching for partitions ###################################################
-verbose 1 " +-Checking partitions"
+verbose 2 " +-Checking partitions"
mac-fdisk -l 2>/dev/null | egrep "^/dev/[a-z]+[0-9]+" > /tmp/parts.mac
fdisk -l 2>/dev/null | egrep "^/dev/[a-z]+[0-9]+" > /tmp/parts.pc
for dev in /dev/hd??* /dev/sd??*; do
[ -r $dev ] || continue
- verbose 3 " +-Checking $dev"
+ verbose 4 " +-Checking $dev"
mnt="/mnt/$(basename $dev)"
if egrep -q "^$dev[ ]" /tmp/parts.mac; then # mac partitions
- verbose 3 -n " +-Mac partition, "
+ verbose 4 -n " +-Mac partition, "
line="$(egrep "^$dev[ ]" /tmp/parts.mac)"
type="$(echo $line | sed 's/^.*)//')"
mnt="${mnt}_$(echo $line | awk '{print $3}')"
@@ -81,86 +81,86 @@
*linux*swap*)
mnt=
echo "#$dev swap swap defaults 0 0" >> /etc/fstab
- verbose 3 "type: swap (not activating)"
+ verbose 4 "type: swap (not activating)"
;;
*linux*)
echo "$dev $mnt auto defaults,noauto,noatime 0 0" >> /etc/fstab
- verbose 3 "type: linux"
+ verbose 4 "type: linux"
;;
*bootblock*)
echo "$dev $mnt hfs,hfsplus defaults,noauto,noatime 0 0" >> /etc/fstab
- verbose 3 "type: bootblock"
+ verbose 4 "type: bootblock"
;;
*hfs*)
echo "$dev $mnt hfsplus,hfs defaults,noauto,noatime 0 0" >> /etc/fstab
- verbose 3 "type: hfs"
+ verbose 4 "type: hfs"
;;
*dos*) #PRODOS - fat ?
echo "$dev $mnt fat,vfat,msdos defaults,noauto,noatime 0 0" >> /etc/fstab
- verbose 3 "type: dos"
+ verbose 4 "type: dos"
;;
#MFS - not supported
*)
mnt=
- verbose 3 "type: unknown"
+ verbose 4 "type: unknown"
;;
esac
elif egrep -q "^$dev[ ]" /tmp/parts.pc; then # pc partitions
- verbose 3 -n " +-PC partition, "
+ verbose 4 -n " +-PC partition, "
type="$(egrep "^$dev[ ]" /tmp/parts.pc | cut -c 56-)"
case "$(tl $type)" in
*linux*swap)
mnt=
echo "#$dev swap swap defaults 0 0" >> /etc/fstab
- verbose 3 "type: swap (not activating)"
+ verbose 4 "type: swap (not activating)"
;;
*linux*)
mnt="${mnt}_linux"
echo "$dev $mnt auto defaults,noauto,noatime 0 0" >> /etc/fstab
- verbose 3 "type: linux"
+ verbose 4 "type: linux"
;;
*dos*)
mnt="${mnt}_dos"
echo "$dev $mnt msdos,fat,vfat user,noauto,umask=002,uid=0,gid=28,exec,showexec 0 0" >> /etc/fstab
- verbose 3 "type: dos"
+ verbose 4 "type: dos"
;;
*fat*)
mnt="${mnt}_fat"
echo "$dev $mnt vfat,fat,msdos user,noauto,umask=002,uid=0,gid=28,exec,showexec 0 0" >> /etc/fstab
- verbose 3 "type: fat"
+ verbose 4 "type: fat"
;;
*nfts*)
mnt="${mnt}_ntfs"
echo "$dev $mnt ntfs user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
- verbose 3 "type: ntfs"
+ verbose 4 "type: ntfs"
;;
*hpfs*)
mnt="${mnt}_hpfs"
echo "$dev $mnt hpfs user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
- verbose 3 "type: hpfs"
+ verbose 4 "type: hpfs"
;;
*bsd*)
mnt="${mnt}_bsd"
echo "$dev $mnt ufs user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
- verbose 3 "type: bsd"
+ verbose 4 "type: bsd"
;;
*minix*)
mnt="${mnt}_minix"
echo "$dev $mnt minix user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
- verbose 3 "type: minix"
+ verbose 4 "type: minix"
;;
*)
mnt=
- verbose 3 "type: unknown"
+ verbose 4 "type: unknown"
;;
esac
else
mnt=
- verbose 1 " +-Partition '$dev' has unrecognized partition type. BSD slice ?"
+ verbose 2 " +-Partition '$dev' has unrecognized partition type. BSD slice ?"
fi
if [ -n "$mnt" ]; then
mkdir -p $mnt
- verbose 2 " +-Partition '$dev' can be mounted on '$mnt'"
+ verbose 3 " +-Partition '$dev' can be mounted on '$mnt'"
fi
done
Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf Mon Feb 27 12:26:50 2006
@@ -8,9 +8,9 @@
if [ -z "$conf" ]; then
cmdopt nonvconf || conf=$(nvvar conf)
fi
-[ -z "$conf" ] && die 1 "No config specified"
+[ -z "$conf" ] && die 0 "No config specified"
-verbose 0 "Loading configuration ($conf)"
+verbose 1 -G "Loading configuration ($conf)"
cd /
Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live Mon Feb 27 12:26:50 2006
@@ -38,7 +38,7 @@
rm -rf /initrd
fi
-cmdopt verbose && echo 0 > /verbose
+cmdopt verbose && echo 1 > /verbose
verb=$(cmdvar verbose)
[ -n "$verb" ] && echo $verb > /verbose
More information about the pld-cvs-commit
mailing list