#!/bin/sh # # /etc/rc.d/scripts/pktsetup - run once at boot time from rc.sysinit # # Setup packet device for writing. # based on /etc/rc.d/scripts/idetune # written by LAKostis WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions PKTSETUP=/usr/bin/pktsetup [ -x "$PKTSETUP" ] || exit 0 # in ALTLinux only wks* and std26-* kernel have packet writing support check_kernel() { local flavor local kver local valid=0 flavor=`/bin/uname -r|/bin/cut -d- -f2` kver=`kernelversion_minor` [ "$kver" -gt 5 ] && `egrep -qs '(std|wks)26' "$flavor"` [ "$kver" -eq 4 ] && `egrep -qs 'wks' "$flavor"` valid=$? echo "$valid" } check_drive() { local drive=$1 local valid `dmesg|egrep -qs "$drive\:.*\/RW"` valid=$? echo "$valid" } # Reset parameters. sourced= SourceIfNotEmpty /etc/sysconfig/pktsetup && sourced=1 [ -n "$sourced" ] || continue if [ -n "$DEVICES" ] && [ "`check_kernel`" -eq 1 ] 2>/dev/null; then modprobe pktcdvd for DEVICE in "$DEVICES"; do if [ "`check_drive $DEVICE`" -eq 1 ]; then i=0 action "Mapping $DEVICE drive as packet device pktcdvd$i:" "$PKTSETUP" pktcdvd$i "$DEVICE" i=`expr $i + 1` fi done fi