summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/lsb/lsbsetup/LSB_Setup.sh
blob: 10d8fb8299c12d0f97e89cca47ddbd580c5d9342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash

# Copyright (C) 2010-2011 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

##Prepare Steps
#Steps 0; Confirm the installed LSB Packages
ARCH=`uname -m`
APP_FILE=`ls /lsb-Application/*.rpm`
if [ ! -f /opt/lsb/test/manager/bin/dist-checker-start.pl ]
then
        if [ -d /lsb-dist-testkit ];then
		if [ ${ARCH} == i686 ];then
                	echo "i486-suse" >> /etc/rpm/platform
                	echo "i486-noarch" >> /etc/rpm/platform
                	echo "i486-pc" >> /etc/rpm/platform
                	echo "noarch-suse" >> /etc/rpm/platform
		else
                	echo "${ARCH}-suse" >> /etc/rpm/platform
                	echo "${ARCH}-noarch" >> /etc/rpm/platform
                	echo "${ARCH}-pc" >> /etc/rpm/platform
                	echo "noarch-suse" >> /etc/rpm/platform
                fi      
                cd /lsb-dist-testkit && sh install.sh && cd ../lsb-Application
                for i in ${APP_FILE}
                do
                    echo "$i" |grep -q "apache"
                    if [ $? -eq 0 ]
                    then
                        rpm -ivh $i --noscripts --nodeps --force
                    else
                        rpm -ivh $i --nodeps --force
                    fi
                done
                mkdir -p /var/opt/lsb/test/manager/packages/ftp.linuxfoundation.org/pub/lsb/snapshots/appbat/tests/
                mkdir -p  /var/opt/lsb/test/manager/packages/ftp.linuxfoundation.org/pub/lsb/app-battery/tests/ 
		cp expect-tests.tar  test1.pdf  test2.pdf /var/opt/lsb/test/manager/packages/ftp.linuxfoundation.org/pub/lsb/app-battery/tests/
                cp raptor-tests.tar  tcl-tests.tar /var/opt/lsb//test/manager/packages/ftp.linuxfoundation.org/pub/lsb/snapshots/appbat/tests/
		cd ..
        else 
                echo "Please install the realted LSB Packages"
                exit 1
        fi
fi

#Steps 1; Deleted existed user tester
id tester
if [ $? -eq  0 ]
then 
        echo "User tester was existed"
        sleep 1
        userdel -rf tester
        if [ $? -eq 0 ] || [ $? -eq 6 ]
        then
                echo "Success to delete user tester"
       else
                echo "Fail to delete user tester"
        fi
else 
        echo "There was not User tester"
fi

##Funs
check ()
{
if [ $? -eq 0 ]
then
        echo "PASS"
else 
        echo "FAIL"
        exit 1
fi
}

###Start 
#Step 1:Add tester group
echo ""
echo "---------------------------------"
echo "Step 1:Add Group tester"
groupadd tester
check


#Step 2:Add User tester 
echo ""
echo "---------------------------------"
echo "Step 2:Add User tester"
useradd -g tester tester
check 

echo "Check the tester user"
id tester
check 

#Step 3;Stop Boa server
#echo ""
#echo "---------------------------------"
#echo "Step 3:Stop BOA server"
#/etc/init.d/boa stop
#check

#Step 4:Create Dirnames file for RPM
echo ""
echo "---------------------------------"
echo "Step 4:Create the Dirnames on target"

mkdir -pv /etc/rpm/sysinfo 

cat > /etc/rpm/sysinfo/Dirnames << EOF
/etc/opt/lsb
/home/tet/LSB.tools
/opt/lsb-tet3-lite/lib/ksh
/opt/lsb-tet3-lite/lib/perl
/opt/lsb-tet3-lite/lib/posix_sh
/opt/lsb-tet3-lite/lib/tet3
/opt/lsb-tet3-lite/lib/xpg3sh
/opt/lsb/appbat/lib/python2.4/site-packages/qm
/opt/lsb/appbat/lib/python2.4/site-packages/qm/external
/opt/lsb/appbat/lib/python2.4/site-packages/qm/external/DocumentTemplate
/opt/lsb/appbat/lib/python2.4/site-packages/qm/test
/opt/lsb/appbat/lib/python2.4/site-packages/qm/test/classes
/opt/lsb/appbat/lib/python2.4/site-packages/qm/test/web
/opt/lsb/test/doc
/opt/lsb/test/lib
/opt/lsb/test/qm/diagnostics
/opt/lsb/test/qm/doc
/opt/lsb/test/qm/doc/test/html
/opt/lsb/test/qm/doc/test/print
/opt/lsb/test/qm/dtml
/opt/lsb/test/qm/dtml/test
/opt/lsb/test/qm/messages/test
/opt/lsb/test/qm/tutorial/test/tdb
/opt/lsb/test/qm/tutorial/test/tdb/QMTest
/opt/lsb/test/qm/web
/opt/lsb/test/qm/web/images
/opt/lsb/test/qm/web/stylesheets
/opt/lsb/test/qm/xml
/opt/lsb/test/share
/usr/share/doc/lsb-runtime-test
/var/opt/lsb
/opt/lsb/test/desktop
/opt/lsb/test/desktop/fontconfig
/opt/lsb/test/desktop/freetype
/opt/lsb/test/desktop/gtkvts
/opt/lsb/test/desktop/libpng
/opt/lsb/test/desktop/qt3
/opt/lsb/test/desktop/xft
/opt/lsb/test/desktop/xml
/opt/lsb/test/desktop/xrender


EOF

if [ -f /etc/rpm/sysinfo/Dirnames ]
then
        echo "Success to creat Dirnames file"
else 
        echo "Fail to creat Dirnames file"
fi

#Step 5;
echo ""
echo "---------------------------------"
echo "Step 5:"
ldconfig -v
check;

#Step 6;
echo ""
echo "---------------------------------"
echo "Step 6:Check with link to ftp.linux-foundation.org"
echo "140.211.169.59 ftp.linux-foundation.org ftp.linuxfoundation.org" >> /etc/hosts

ping -c 5 ftp.linux-foundation.org
check

#Step 7
insmod /lib/modules/2.6.*/kernel/drivers/block/loop.ko
if [ $? != 0 ];then
	echo "Please insmod loop.ko  manully"
fi
#Step 8
echo ""
if [ -f /opt/lsb/test/manager/bin/dist-checker-start.pl ];then
        /opt/lsb/test/manager/bin/dist-checker-start.pl
fi

#Step 9 get ip address for target platform
addr=`ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}'|sed s/[[:space:]][[:space:]]Bcast//g`
echo -e "you should input ${addr}:8888 on your browser"

#workaround to add part of locales for LSB test
localedef -i ja_JP -f EUC-JP ja_JP.eucjp
localedef -i en_US -f ISO-8859-15  en_US.ISO-8859-15
localedef -i en_US -f UTF-8 en_US.UTF-8
localedef -i se_NO -f UTF-8 se_NO.UTF-8
localedef -i de_DE -f ISO-8859-1 de_DE
localedef -i en_US -f ISO-8859-1 en_US.ISO8859-1
localedef -i fr_FR -f ISO-8859-1 fr_FR

#resolve localhost 
LOCALHOST=`hostname`
if ! `grep -F -q "$LOCALHOST" /etc/hosts`; then
    echo "127.0.0.1 $LOCALHOST" >> /etc/hosts
fi

#Step 10
echo "Done!!"

###End