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
8 PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
:/opt
/bin
:/opt
/sbin
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."
20 echo "Error: No default gateway set!"
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."
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"
37 echo " sed -i s/192.168.*/${GATEWAY}/ /etc/resolv.conf"
39 echo "to correct this."
43 echo "Error: No nameserver specified in /etc/resolv.conf"
47 echo "Error: Empty or nonexistent /etc/resolv.conf"
51 if mount |
grep -q /opt
; then
52 [ -d /opt
/etc
] && echo "Warning: /opt partition not empty!"
54 echo "Error: /opt partition not mounted."
56 echo " mkdir /jffs/opt"
57 echo " mount -o bind /jffs/opt /opt"
58 echo "to correct this."
67 echo "Installing package ${PACKAGE} ..."
68 wget
-O ${TMP}/${PACKAGE} ${REPOSITORY}/${PACKAGE}
70 tar xzf
${TMP}/${PACKAGE}
71 tar xzf
${TMP}/control.
tar.gz
73 if [ -f ${TMP}/preinst
] ; then
77 tar xzf
${TMP}/data.
tar.gz
78 if [ -f ${TMP}/postinst
] ; then
82 rm -f ${TMP}/data.
tar.gz
83 rm -f ${TMP}/control.
tar.gz
85 rm -f ${TMP}/${PACKAGE}
89 _install_package uclibc-opt_0.9
.28-1_arm.ipk
90 _install_package ipkg-opt_0.99
.163-10_arm.ipk
93 /opt
/bin
/ipkg
install -force-reinstall uclibc-opt
94 /opt
/bin
/ipkg
install -force-reinstall ipkg-opt
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