dependencies-install.sh 3.1 KB

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