Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for optware-install.sh

-13 change

optware-install.sh
Monday, January 28th, 2008 at 11:44:15am MST 

  1. #!/bin/sh
  2. # Optware pre-installation script, Leon Kos 2006, 2008
  3.  
  4. REPOSITORY=http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable
  5. TMP=/tmp
  6.  
  7. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin
  8. unset LD_PRELOAD
  9. unset LD_LIBRARY_PATH
  10.  
  11. _check_config()
  12. {
  13.     echo "Checking system config ..."
  14.     GATEWAY=$(netstat -rn |
  15.         sed -n 's/^0.0.0.0[ \t]\{1,\}\([0-9.]\{8,\}\).*/\1/p' )
  16.     if [ -n "${GATEWAY}" ]; then
  17.         echo "Using ${GATEWAY} as default gateway."
  18.     else
  19.         echo "Error: No default gateway set!"
  20.         exit 2
  21.     fi
  22.     if [ -s /etc/resolv.conf ]; then
  23.         echo "Using the following nameserver(s):"
  24.         if grep nameserver /etc/resolv.conf ; then
  25.             GATEWAY_SUBNET=$(echo "${GATEWAY}" |
  26.                 sed 's/\.[0-9]\{1,3\}\.[0-9]\{1,3\}$//')
  27.             if [ "${GATEWAY_SUBNET}" = "192.168" ]; then
  28.                 if grep -q ${GATEWAY} /etc/resolv.conf ; then
  29.                     echo "Gateway ${GATEWAY} is also nameserver."
  30.                 else
  31.                     echo "Warning: local nameserver is different than gateway!"
  32.                     echo "Check config or enter:"
  33.                     if test -L /etc/resolv.conf ; then
  34.                       echo "  sed -i s/192.168.*/${GATEWAY}/ /tmp/resolv.conf"
  35.                     else
  36.                       echo "  sed -i s/192.168.*/${GATEWAY}/ /etc/resolv.conf"
  37.                     fi
  38.                     echo "to correct this."
  39.                 fi
  40.             fi
  41.         else
  42.             echo "Error: No nameserver specified in /etc/resolv.conf"
  43.             exit 5
  44.         fi
  45.     else
  46.         echo "Error: Empty or nonexistent /etc/resolv.conf"
  47.         exit 3
  48.     fi
  49.  
  50.     if mount | grep -q /opt ; then
  51.         [ -d /opt/etc ] && echo "Warning: /opt partition not empty!"
  52.     else
  53.         echo "Error: /opt partition not mounted."
  54.         echo "Enter"
  55.         echo "    mkdir /jffs/opt"
  56.         echo "    mount -o bind /jffs/opt /opt"
  57.         echo "to correct this."
  58.         exit 4
  59.     fi
  60. }
  61.  
  62.  
  63. _install_package()
  64. {
  65.     PACKAGE=$1
  66.     echo "Installing package ${PACKAGE} ..."
  67.     wget -O ${TMP}/${PACKAGE} ${REPOSITORY}/${PACKAGE}
  68.     cd  ${TMP}
  69.     tar xzf ${TMP}/${PACKAGE}
  70.     tar xzf ${TMP}/control.tar.gz
  71.     cd /
  72.     if [ -f ${TMP}/preinst ] ; then
  73.         sh ${TMP}/preinst
  74.         rm -f ${TMP}/preints
  75.     fi
  76.     tar xzf ${TMP}/data.tar.gz
  77.     if [ -f ${TMP}/postinst ] ; then
  78.         sh ${TMP}/postinst
  79.         rm -f ${TMP}/postinst
  80.     fi
  81.     rm -f ${TMP}/data.tar.gz
  82.     rm -f ${TMP}/control.tar.gz
  83.     rm -f ${TMP}/control
  84.     rm -f ${TMP}/${PACKAGE}
  85. }
  86.  
  87. _check_config
  88. _install_package uclibc-opt_0.9.28-13_mipsel.ipk
  89. _install_package ipkg-opt_0.99.163-9_mipsel.ipk
  90. /opt/sbin/ldconfig
  91. /opt/bin/ipkg update
  92. /opt/bin/ipkg install -force-reinstall uclibc-opt
  93. /opt/bin/ipkg install -force-reinstall ipkg-opt

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right fantasy-obligation
fantasy-obligation