dependencies-install.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. URL="$OPENWRT_BASE_URL/$TYPE/$ORIGINAL_FOLDER_NAME.tar.xz"
  22. echo " $URL"
  23. wget -q "$URL" -O "$FILE"
  24. fi
  25. # install...
  26. echo " [+] Install imagebuilder..."
  27. rm -rf "$FOLDER_NAME"
  28. tar xJf "$FILE"
  29. mv "$ORIGINAL_FOLDER_NAME" "$FOLDER_NAME"
  30. rm "$FILE"
  31. # correct opkg feeds
  32. echo " [+] Correct opkg feeds"
  33. sed -i "s/src\/gz openwrt_freifunk/#/" "$FOLDER_NAME/repositories.conf"
  34. sed -i "s/src\/gz openwrt_luci/#/" "$FOLDER_NAME/repositories.conf"
  35. sed -i "s/src\/gz openwrt_telephony/#/" "$FOLDER_NAME/repositories.conf"
  36. fi
  37. }
  38. install_ubuntu_deps () {
  39. echo "Install ubuntu deps..."
  40. echo "******************************"
  41. # install deps openwrt make and others
  42. apt-get install build-essential python2 wget gawk libncurses5-dev libncursesw5-dev zip rename -y
  43. # install binwalk
  44. git clone https://github.com/ReFirmLabs/binwalk
  45. cd binwalk && sudo python3 setup.py install && sudo ./deps.sh
  46. echo ""
  47. echo "[*] Install script end!"
  48. }
  49. install_openwrt_deps_mips () {
  50. echo "Install OpenWrt MIPS deps..."
  51. echo "******************************"
  52. for TARGET in ${OPENWRT_MIPS_TARGET_LIST[@]}; do
  53. echo "[*] Install: $TARGET"
  54. install_openwrt_deps $TARGET
  55. done
  56. echo ""
  57. echo "[*] Install script end!"
  58. }
  59. install_openwrt_deps_mipsel () {
  60. echo "Install OpenWrt MIPSEL deps..."
  61. echo "******************************"
  62. for TARGET in ${OPENWRT_MIPSEL_TARGET_LIST[@]}; do
  63. echo "[*] Install: $TARGET"
  64. install_openwrt_deps $TARGET
  65. done
  66. echo ""
  67. echo "[*] Install script end!"
  68. }
  69. echo "Wifi Pineapple Cloner - dependencies"
  70. echo "************************************** by DSR!"
  71. echo ""
  72. if [ "$1" == "openwrt-deps-mips" ]
  73. then
  74. install_openwrt_deps_mips
  75. elif [ "$1" == "openwrt-deps-mipsel" ]
  76. then
  77. install_openwrt_deps_mipsel
  78. elif [ "$1" == "ubuntu-deps" ]
  79. then
  80. install_ubuntu_deps
  81. else
  82. echo "Valid command:"
  83. echo "openwrt-deps-mips -> install imagebuilders for mips and configure it"
  84. echo "openwrt-deps-mipsel -> install imagebuilders for mipsel and configure it"
  85. echo "ubuntu-deps -> install ubuntu dependencies"
  86. fi