On 04/12/18 04:53 PM, Petr Štetiar wrote:

Please try to follow DRY principles and don't copy&paste the same code over
again. I mean something like this:

  er_move_config() {
          local dev="$1"
          mount -t vfat "$dev" /mnt
          [ -f /mnt/sysupgrade.tgz ] && mv -f /mnt/sysupgrade.tgz /
          umount /mnt
  }

  move_config() {
          . /lib/functions.sh

          case "$(board_name)" in
                 er)
                         er_move_config /dev/mmcblk0p1
                         ;;
                 erlite)
                         er_move_config /dev/sda1
                         ;;
         esac
  }
No problem. I was thinking along those lines too initially but as this isn't my code I was trying my best to match what's already there and not step on any toes. Same for the board_name eval order. I had matched what was already in the file until it was requested that I put them in order.

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to