root/floppyfw-3.0/scripts/functions.inc

Revision 268, 2.2 KB (checked in by root, 2 years ago)

Some real changes, now it's easy to use VLAN, just set the thernet interfaces to interface.vlan-id and it'll configure it all automagically.

Line 
1
2# $Id: functions.inc,v 1.6 2005/08/13 10:02:16 thomasez Exp $
3
4# Define a function to strip CRs from files and chmod if desired
5stripcr () {
6        #[ -r $1 ] && { echo stripcr $1 $2; tr -d '\r' < $1 > $2; }
7        #[ -n $3 ] && { echo chmod $3 $2; chmod $3 $2; }
8        [ -r $1 ] && { echo -n $1 ; tr -d '\r' < $1 > $2; echo " stripped"; }
9        #echo -n "X$3"
10        #echo "X"
11        [ -n "$3" ] && { chmod $3 $2 ; echo "$1 chmoded"; }
12}
13
14load_fsmod () {
15       case $1 in
16       # /dev/hd*)
17       /dev/discs* | /dev/ide* | /dev/cdrom*)
18               insmod cdrom
19               insmod ide-core
20               insmod ide-detect
21               insmod ide-cd
22               insmod ide-disk
23               insmod scsi_mod
24               insmod libata
25               insmod ahci
26               insmod sata_nv
27               insmod sata_promise
28               insmod sata_sil
29               insmod sata_sis
30               insmod sata_svw
31               insmod sata_sx4
32               insmod sata_uli
33               insmod sata_via
34               insmod sata_vsc
35               ;;
36       /dev/scsi* )
37               insmod cdrom
38               insmod ide-core
39               insmod ide-detect
40               insmod ide-cd
41               insmod ide-disk
42               insmod scsi_mod
43               insmod sd_mod
44               insmod usbcore
45               insmod uhci
46               insmod usb-uhci
47               insmod usb-ohci
48               insmod ehci-hcd
49               modprobe usb-storage
50               # It needs to initialize itself.
51               sleep 10
52               ;;
53       esac
54       case $2 in
55       vfat)
56               echo vfat support is builtin
57               ;;
58       iso9660)
59               insmod zlib_inflate
60               insmod isofs
61               ;;
62       esac
63}
64
65bool_value () {
66        case "$1" in
67
68        [Tt]|true|[Yy]|yes)
69                return 0
70                ;;
71        *)
72                return 1
73                ;;
74        esac
75        return 1
76}
77
78count () {
79        LO=$1;HI=$2
80        while [ $LO -le $HI ]
81            do
82            echo -n $LO " "
83            LO=`expr $LO + 1`
84            done
85}
86
87configure_interface () {
88        if=$1         
89        if echo $if | grep -q '[a-z]\{1,\}[0-9]\{1,\}\.[0-9]\{1,\}'
90          then                                             
91            vconfig add `echo $if | sed -e 's/\./ /'`
92        fi
93        ifconfig $*
94}               
95
Note: See TracBrowser for help on using the browser.