diff --git a/new.sh b/new.sh index 08fed472a..563b6d2e1 100644 --- a/new.sh +++ b/new.sh @@ -26,6 +26,10 @@ main_xbps() { return 0 } +main_pkg() { + return 0 +} + main_apt() { return 0 } @@ -93,6 +97,10 @@ main_apt() { return 1 } +main_pkg() { + return 1 +} + main_brew() { return 1 } diff --git a/require.sh b/require.sh index 3552eca31..2c66c24e4 100644 --- a/require.sh +++ b/require.sh @@ -48,6 +48,24 @@ function not_require_pacman() { fi } +# install packages using pkg +function require_pkg() { + declare -a to_install_pkg + to_install_pkg=() + + for pkg in "$@"; do + running "require" " pkg ${pkg}" + if ! pkg list-installed | grep "${pkg}" &>/dev/null; then + to_install_pkg+=("${pkg}") + fi + done + + if [[ ${#to_install_pkg[@]} -ne 0 ]]; then + action "require" " pkg install ${to_install_pkg[*]}" + pkg install "${to_install_pkg[@]}" + fi +} + # install packages using brew function require_brew() { declare -a to_install_pkg diff --git a/start.sh b/start.sh index baf04579c..2266b2428 100755 --- a/start.sh +++ b/start.sh @@ -257,6 +257,19 @@ install() { return fi + if [[ "${OSTYPE}" == "linux-android" ]]; then + msg " android (termux), using pkg" + + if declare -f main_pkg >/dev/null; then + main_brew + else + msg "main_pkg not found, there is nothing to do" "error" + exit + fi + + return + fi + if [[ -n "$(command -v apt)" ]]; then msg " linux with apt installed, using apt"