diff --git a/idd.sh b/idd.sh index ede031b..1896f2a 100755 --- a/idd.sh +++ b/idd.sh @@ -85,7 +85,28 @@ Quit(){ exit 0; fi } +FindMgr(){ + use_which=$(which {dnf,pacman,xbps-install}) + base_dir="/usr/bin" + printf "${BWHITE}\n\nGetting Dependencies...${NC}\n\n" + if [ -f "${base_dir}/apt" ] || [ -f "${base_dir}/apt-get" ];then + apt-get update; apt-get -y install pv + + elif [ "${use_which}" = "${base_dir}/dnf" ];then + dnf -y install pv + + elif [ "${use_which}" = "${base_dir}/pacman" ];then + pacman -Sy pv + + elif [ "${use_which}" = "${base_dir}/xbps-install" ];then + xbps-install -Sy pv + + else + printf "\n${LRED}No suitible package manager was found!${NC}\n\n" + fi + return +} case "$1" in -d) if [ -f /usr/bin/pv ];then @@ -140,6 +161,9 @@ case "$1" in usage: idd -d [directory] """ ;; + +-t) FindMgr + ;; *) if [ -f /usr/bin/pv ];then clear printf "${LCYAN}idd - interactive dd${NC}\n" @@ -186,7 +210,7 @@ case "$1" in echo printf "${LGREEN}Done writing file${NC}\n" else - echo "${0}: pv command not found in /usr/bin" + FindMgr && ${0} fi ;; esac