97-pineapple.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Make SSH banner have the correct version and device
  2. version=$(cat /pineapple/pineapple_version | head -c 5)
  3. eval "sed -i s/VERSION/$version/g /etc/banner"
  4. # Configure PATH with SD card directories
  5. echo "export PATH=/usr/bin/pineapple:/bin:/sbin:/usr/bin:/usr/sbin:/sd/bin:/sd/sbin:/sd/usr/sbin:/sd/usr/bin" >> /etc/profile
  6. echo "export LD_LIBRARY_PATH=/lib:/usr/lib:/sd/lib:/sd/usr/lib" >> /etc/profile
  7. # Touch known hosts
  8. mkdir -p /root/.ssh/
  9. touch /root/.ssh/known_hosts
  10. # "Temporarily" soft-link libpcap.so.1 to libpcap.so.1.3
  11. ln -s /usr/lib/libpcap.so.1 /usr/lib/libpcap.so.1.3
  12. # Disable AutoSSH
  13. /etc/init.d/autossh stop
  14. /etc/init.d/autossh disable
  15. # Correct opkg sources
  16. sed -i "s/src\/gz openwrt_freifunk/#src\/gz openwrt_freifunk/" /etc/opkg/distfeeds.conf
  17. sed -i "s/src\/gz openwrt_luci/#src\/gz openwrt_luci/" /etc/opkg/distfeeds.conf
  18. sed -i "s/src\/gz openwrt_telephony/#src\/gz openwrt_telephon/" /etc/opkg/distfeeds.conf
  19. # Get valid led value
  20. PINE_LED=""
  21. LED_TYPES="wps status system wan"
  22. LED_LIST=$(ls "/sys/class/leds/")
  23. for LED_TYPE in $LED_TYPES; do
  24. for LED_NAME in $LED_LIST; do
  25. if expr match "$LED_NAME" "\(.*:$LED_TYPE\)"; then
  26. PINE_LED="$LED_NAME"
  27. break
  28. fi
  29. done
  30. if [[ $PINE_LED != "" ]]; then
  31. break
  32. fi
  33. done
  34. if [[ $PINE_LED == "" && $LED_LIST != "" ]]; then
  35. PINE_LED=$(ls "/sys/class/leds/" | tail -1)
  36. fi
  37. if [[ $PINE_LED != "" ]]; then
  38. sed -i "s/wifi-pineapple-nano:blue:system/$PINE_LED/" /sbin/led
  39. echo 255 > "/sys/class/leds/$PINE_LED/brightness"
  40. fi
  41. exit 0