]> git.sur5r.net Git - bacula/rescue/blob - rescue/solaris/getdiskinfo
Tweak version
[bacula/rescue] / rescue / solaris / getdiskinfo
1 #!/bin/sh
2 #
3 # Create bootstrap information files -- prelude to creating a
4 #   Bacula Rescue Disk
5 #
6 #  Solaris version
7 #
8 #   Kern Sibbald, December MMII
9 #      This source distributed under the GPL
10 #
11 di=diskinfo
12 cwd=`pwd`
13 host=`uname -s`
14 case $host in
15  Linux)
16    echo ""
17    echo "This is the Solaris script. Please use the Linux version."
18    echo ""
19    exit 1
20    ;;
21  SunOS)
22    echo ""
23    echo "This is preliminary code and not yet"      
24    echo "tested or guaranteed to work ..."
25    echo ""
26    ;;
27  FreeBSD | IRIX)
28    echo ""
29    echo "This code is not yet adapted to this OS"     
30    exit 1
31    ;;
32  *)
33    echo ""
34    echo "Unknown operating system type: $host"     
35    exit 1
36    ;;
37 esac
38 uid=`id | cut -d'(' -f1 | cut -d'=' -f2`
39 if [ "$uid" -ne "0" ]; then
40   echo ""
41   echo "You need to be root to run this, otherwise"
42   echo "the results are not optimal. Continuing anyway ..."
43   echo ""
44 fi
45
46 #
47 #  First collect information
48 #
49 echo "Begin collecting system info"
50 mkdir -p $di
51 cd $di
52 mount -p >mount.bsi
53 if [ -e /etc/fstab ] ; then
54    cp /etc/fstab fstab.bsi
55 fi
56 if [ -e /etc/vfstab ] ; then
57    cp /etc/vfstab vfstab.bsi
58 fi
59 df -tkFnfs >df.bsi
60 df -l >dflocal.bsi
61 ../SysAudit >sysaudit.bsi
62 route -n >route.bsi
63 ifconfig -a >ifconfig.bsi
64
65
66 echo "Done collecting info. Building scripts ..."
67
68 #
69 # Done collecting information
70 #
71
72
73 cd $cwd
74
75 #
76 # Create network start script
77 #
78 dev=`cat $di/ifconfig.bsi | grep BROADCAST | awk -F: '{print $1}' | head -1`
79 ip=`ifconfig $dev | grep inet | awk '{print $2}'`
80 cat >start_network <<END_OF_DATA
81 #!/bin/sh
82 #
83 #  Start network -- created by getdiskinfo
84 #
85 ip=$ip
86 dev=$dev
87 ifconfig leo up
88 ifconfig \$dev up \$ip
89 route add default gw \$ip dev \$dev
90 END_OF_DATA
91
92 chmod 755 start_network