dependencies-install.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/bin/bash
  2. # by DSR! from https://github.com/xchwarze/wifi-pineapple-cloner
  3. OPENWRT_VERSION="19.07.7"
  4. OPENWRT_BASE_URL="https://downloads.openwrt.org/releases/$OPENWRT_VERSION/targets"
  5. declare -a OPENWRT_MIPS_TARGET_LIST=(
  6. "ar71xx-generic" "ar71xx-nand" "ath79-generic" "lantiq-xrx200"
  7. )
  8. declare -a OPENWRT_MIPSEL_TARGET_LIST=(
  9. "ramips-mt7620" "ramips-mt7621" "ramips-mt76x8"
  10. )
  11. install_openwrt_deps () {
  12. TARGET="$1"
  13. FOLDER_NAME="imagebuilder-$OPENWRT_VERSION-$TARGET"
  14. ORIGINAL_FOLDER_NAME="openwrt-imagebuilder-$OPENWRT_VERSION-$TARGET.Linux-x86_64"
  15. FILE="$FOLDER_NAME.tar.xz"
  16. # download imagebuilder
  17. if [ ! -d "$FOLDER_NAME" ]; then
  18. if [ ! -f "$FILE" ]; then
  19. echo " [+] Downloading imagebuilder..."
  20. TYPE=$(echo $TARGET | sed "s/-/\//g")
  21. wget -q "$OPENWRT_BASE_URL/$TYPE/$ORIGINAL_FOLDER_NAME.tar.xz" -O "$FILE"
  22. fi
  23. # install...
  24. echo " [+] Install imagebuilder..."
  25. rm -rf "$FOLDER_NAME"
  26. tar xJf "$FILE"
  27. mv "$ORIGINAL_FOLDER_NAME" "$FOLDER_NAME"
  28. # correct opkg feeds
  29. echo " [+] Correct opkg feeds"
  30. sed -i "s/src\/gz openwrt_freifunk/#/" "$FOLDER_NAME/repositories.conf"
  31. sed -i "s/src\/gz openwrt_luci/#/" "$FOLDER_NAME/repositories.conf"
  32. sed -i "s/src\/gz openwrt_telephony/#/" "$FOLDER_NAME/repositories.conf"
  33. fi
  34. }
  35. install_ubuntu_deps () {
  36. echo "Install ubuntu deps..."
  37. echo "******************************"
  38. # install deps openwrt make and others
  39. apt-get install build-essential python2 wget gawk libncurses5-dev libncursesw5-dev zip rename -y
  40. # install binwalk
  41. git clone https://github.com/ReFirmLabs/binwalk
  42. cd binwalk && sudo python3 setup.py install && sudo ./deps.sh
  43. echo ""
  44. echo "[*] Install script end!"
  45. }
  46. install_openwrt_deps_mips () {
  47. echo "Install OpenWrt MIPS deps..."
  48. echo "******************************"
  49. for TARGET in ${OPENWRT_MIPS_TARGET_LIST[@]}; do
  50. echo "[*] Install: $TARGET"
  51. install_openwrt_deps $TARGET
  52. done
  53. echo ""
  54. echo "[*] Install script end!"
  55. }
  56. install_openwrt_deps_mipsel () {
  57. echo "Install OpenWrt MIPSEL deps..."
  58. echo "******************************"
  59. for TARGET in ${OPENWRT_MIPSEL_TARGET_LIST[@]}; do
  60. echo "[*] Install: $TARGET"
  61. install_openwrt_deps $TARGET
  62. done
  63. echo ""
  64. echo "[*] Install script end!"
  65. }
  66. echo "Wifi Pineapple Cloner - dependencies"
  67. echo "************************************** by DSR!"
  68. echo ""
  69. if [ "$1" == "openwrt-deps-mips" ]
  70. then
  71. install_openwrt_deps_mips
  72. elif [ "$1" == "openwrt-deps-mipsel" ]
  73. then
  74. install_openwrt_deps_mipsel
  75. elif [ "$1" == "ubuntu-deps" ]
  76. then
  77. install_ubuntu_deps
  78. else
  79. echo "Valid command:"
  80. echo "openwrt-deps-mips -> install imagebuilders for mips and configure it"
  81. echo "openwrt-deps-mipsel -> install imagebuilders for mipsel and configure it"
  82. echo "ubuntu-deps -> install ubuntu dependencies"
  83. fi