dependencies-install.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. sed -i 's_https\?://downloads.openwrt.org_https://mirrors.cernet.edu.cn/openwrt_' "$FOLDER_NAME/repositories.conf"
  40. fi
  41. }
  42. install_ubuntu_deps () {
  43. echo "Install ubuntu deps..."
  44. echo "******************************"
  45. # install deps openwrt make and others
  46. apt-get install build-essential python2 wget gawk libncurses5-dev libncursesw5-dev zip rename -y
  47. # install binwalk
  48. git clone https://github.com/ReFirmLabs/binwalk
  49. cd binwalk && sudo python3 setup.py install && sudo ./deps.sh
  50. echo ""
  51. echo "[*] Install script end!"
  52. }
  53. install_openwrt_deps_mips () {
  54. echo "Install OpenWrt MIPS deps..."
  55. echo "******************************"
  56. for TARGET in ${OPENWRT_MIPS_TARGET_LIST[@]}; do
  57. echo "[*] Install: $TARGET"
  58. install_openwrt_deps $TARGET
  59. done
  60. echo ""
  61. echo "[*] Install script end!"
  62. }
  63. install_openwrt_deps_mipsel () {
  64. echo "Install OpenWrt MIPSEL deps..."
  65. echo "******************************"
  66. for TARGET in ${OPENWRT_MIPSEL_TARGET_LIST[@]}; do
  67. echo "[*] Install: $TARGET"
  68. install_openwrt_deps $TARGET
  69. done
  70. echo ""
  71. echo "[*] Install script end!"
  72. }
  73. echo "Wifi Pineapple Cloner - dependencies"
  74. echo "************************************** by DSR!"
  75. echo ""
  76. if [ "$1" == "openwrt-deps-mips" ]
  77. then
  78. install_openwrt_deps_mips
  79. elif [ "$1" == "openwrt-deps-mipsel" ]
  80. then
  81. install_openwrt_deps_mipsel
  82. elif [ "$1" == "ubuntu-deps" ]
  83. then
  84. install_ubuntu_deps
  85. else
  86. echo "Valid command:"
  87. echo "openwrt-deps-mips -> install imagebuilders for mips and configure it"
  88. echo "openwrt-deps-mipsel -> install imagebuilders for mipsel and configure it"
  89. echo "ubuntu-deps -> install ubuntu dependencies"
  90. fi