Remove TCP Vegas support (ARM7)
[tomato.git] / release / src-rt-6.x.4708 / router / others / optware-install.sh
blobf036d03c21a21749d76b22e1e1fc837871c76f7a
1 #!/bin/sh
2 # Optware pre-installation script, Leon Kos 2006-2008
3 # Broadcom ARM support - Shibby 2014
5 REPOSITORY=http://ipkg.nslu2-linux.org/feeds/optware/mbwe-bluering/cross/stable
6 TMP=/tmp
8 PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin
9 unset LD_PRELOAD
10 unset LD_LIBRARY_PATH
12 _check_config()
14 echo "Checking system config ..."
15 GATEWAY=$(netstat -rn |
16 sed -n 's/^0.0.0.0[ \t]\{1,\}\([0-9.]\{8,\}\).*/\1/p' )
17 if [ -n "${GATEWAY}" ]; then
18 echo "Using ${GATEWAY} as default gateway."
19 else
20 echo "Error: No default gateway set!"
21 exit 2
23 if [ -s /etc/resolv.conf ]; then
24 echo "Using the following nameserver(s):"
25 if grep nameserver /etc/resolv.conf ; then
26 GATEWAY_SUBNET=$(echo "${GATEWAY}" |
27 sed 's/\.[0-9]\{1,3\}\.[0-9]\{1,3\}$//')
28 if [ "${GATEWAY_SUBNET}" = "192.168" ]; then
29 if grep -q ${GATEWAY} /etc/resolv.conf ; then
30 echo "Gateway ${GATEWAY} is also nameserver."
31 else
32 echo "Warning: local nameserver is different than gateway!"
33 echo "Check config or enter:"
34 if test -L /etc/resolv.conf ; then
35 echo " sed -i s/192.168.*/${GATEWAY}/ /tmp/resolv.conf"
36 else
37 echo " sed -i s/192.168.*/${GATEWAY}/ /etc/resolv.conf"
39 echo "to correct this."
42 else
43 echo "Error: No nameserver specified in /etc/resolv.conf"
44 exit 5
46 else
47 echo "Error: Empty or nonexistent /etc/resolv.conf"
48 exit 3
51 if mount | grep -q /opt ; then
52 [ -d /opt/etc ] && echo "Warning: /opt partition not empty!"
53 else
54 echo "Error: /opt partition not mounted."
55 echo "Enter"
56 echo " mkdir /jffs/opt"
57 echo " mount -o bind /jffs/opt /opt"
58 echo "to correct this."
59 exit 4
64 _install_package()
66 PACKAGE=$1
67 echo "Installing package ${PACKAGE} ..."
68 wget -O ${TMP}/${PACKAGE} ${REPOSITORY}/${PACKAGE}
69 cd ${TMP}
70 tar xzf ${TMP}/${PACKAGE}
71 tar xzf ${TMP}/control.tar.gz
72 cd /
73 if [ -f ${TMP}/preinst ] ; then
74 sh ${TMP}/preinst
75 rm -f ${TMP}/preints
77 tar xzf ${TMP}/data.tar.gz
78 if [ -f ${TMP}/postinst ] ; then
79 sh ${TMP}/postinst
80 rm -f ${TMP}/postinst
82 rm -f ${TMP}/data.tar.gz
83 rm -f ${TMP}/control.tar.gz
84 rm -f ${TMP}/control
85 rm -f ${TMP}/${PACKAGE}
88 _check_config
89 _install_package uclibc-opt_0.9.28-1_arm.ipk
90 _install_package ipkg-opt_0.99.163-10_arm.ipk
92 /opt/bin/ipkg update
93 /opt/bin/ipkg install -force-reinstall uclibc-opt
94 /opt/bin/ipkg install -force-reinstall ipkg-opt
96 ##ipkg.conf
97 echo "src/gz nslu2 http://ipkg.nslu2-linux.org/feeds/optware/mbwe-bluering/cross/stable" > /opt/etc/ipkg.conf
98 echo "src shibby http://tomato.groov.pl/repo-arm" >> /opt/etc/ipkg.conf
99 echo "dest /opt/ /" >> /opt/etc/ipkg.conf
100 /opt/bin/ipkg update