#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024-present ArchR (https://github.com/archr-linux/Arch-R)

export PATH=/opt/bin:/opt/sbin:$PATH

[ ! -d /storage/.opt ] && mkdir -p /storage/.opt

if [ ! -f /opt/bin/opkg ]; then
  wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh
  echo ""
  read -p "Would you like to reboot now to finish installation (recommended) [y/N]? " choice
  case "$choice" in
    [yY]*)
      reboot
      ;;
  esac
else
  echo "Entware is already installed."
fi
