idd.sh: quote paths and fix package manager detection

Quote file and device paths, drop the bogus grep filter on find results,
detect dnf/pacman/xbps-install individually, and chain apt-get update
with install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 14:22:37 -04:00
co-authored by Claude Opus 5.5
parent 44b920c89d
commit 4119fb01d7
+30 -32
View File
@@ -38,9 +38,9 @@ FindImages(){
printf "${LCYAN}Results Found:${NC}\n"
echo
if [ "${1}" ];then
find $1 -regex ".*\.\(img\|iso\)" | grep [.iso,.img]
find "${1}" -regex ".*\.\(img\|iso\)$"
else
find ${HOMEDIR} -regex ".*\.\(img\|iso\)" | grep [.iso,.img]
find "${HOMEDIR}" -regex ".*\.\(img\|iso\)$"
fi
}
CheckFile(){
@@ -90,23 +90,22 @@ Quit(){
}
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
apt-get update && apt-get -y install pv
elif [ "${use_which}" = "${base_dir}/dnf" ];then
elif which dnf >/dev/null 2>&1;then
dnf -y install pv
elif [ "${use_which}" = "${base_dir}/pacman" ];then
elif which pacman >/dev/null 2>&1;then
pacman -Sy pv
elif [ "${use_which}" = "${base_dir}/xbps-install" ];then
elif which xbps-install >/dev/null 2>&1;then
xbps-install -Sy pv
else
printf "\n${LRED}No suitible package manager was found!${NC}\n\n"
printf "\n${LRED}No suitable package manager was found!${NC}\n\n"
fi
return
}
@@ -118,20 +117,19 @@ case "$1" in
printf "${LPURPLE}********************************${NC}\n"
Options
echo
printf "${LGREEN}Image files (img, iso) in ${2}${NC}\n"
printf "${LBLUE}-------------------------------------------${NC}\n"
printf "${LGREEN}Image files (img, iso) in ${2}${NC}\n"
printf "${LBLUE}-------------------------------------------${NC}\n"
#find $2 -regex ".*\.\(img\|iso\)" | grep [.iso,.img]
FindImages $2
FindImages "${2}"
if [ ! $? = 0 ];then
printf "${LRED}No image files found${NC}\n"
fi
printf "${LBLUE}-------------------------------------------${NC}\n"
printf "${YELLOW}Copy & paste full file path here: ${NC}"
read filepath
Quit ${filepath}
CheckFile ${filepath}
printf "${YELLOW}Copy & paste full file path here: ${NC}"
read filepath
Quit "${filepath}"
CheckFile "${filepath}"
clear
Options
echo
@@ -140,18 +138,18 @@ case "$1" in
lsblk
printf "${LBLUE}-------------------------------------------${NC}\n"
echo
printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): "
read devname
Quit ${devname}
DEVPATH="${DEVICEDIR}/${devname}"
CheckDev ${DEVPATH}
ConfirmWrite ${filepath} ${DEVPATH}
printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): "
read devname
Quit "${devname}"
DEVPATH="${DEVICEDIR}/${devname}"
CheckDev "${DEVPATH}"
ConfirmWrite "${filepath}" "${DEVPATH}"
echo
printf "${LCYAN}Please wait ...${NC}\n"
echo
pv -tpreb ${filepath} | dd bs=${BLOCKSIZE}M of=${DEVICEDIR}/${devname}
echo
printf "${LCYAN}Please wait ...${NC}\n"
echo
pv -tpreb "${filepath}" | dd bs="${BLOCKSIZE}M" of="${DEVPATH}"
echo
printf "${YELLOW}Syncing buffers...${NC}\n";sync
echo
@@ -185,8 +183,8 @@ case "$1" in
printf "${YELLOW}Copy & paste full file path here: ${NC}"
read filepath
Quit ${filepath}
CheckFile ${filepath}
Quit "${filepath}"
CheckFile "${filepath}"
clear
@@ -199,15 +197,15 @@ case "$1" in
echo
printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): "
read devname
Quit ${devname}
Quit "${devname}"
DEVPATH="${DEVICEDIR}/${devname}"
CheckDev ${DEVPATH}
ConfirmWrite ${filepath} ${DEVPATH}
CheckDev "${DEVPATH}"
ConfirmWrite "${filepath}" "${DEVPATH}"
echo
printf "${LCYAN}Please wait ...${NC}\n"
echo
pv -tpreb ${filepath} | dd bs=${BLOCKSIZE}M of=${DEVICEDIR}/${devname}
pv -tpreb "${filepath}" | dd bs="${BLOCKSIZE}M" of="${DEVPATH}"
echo
printf "${YELLOW}Syncing buffers...${NC}\n";sync
echo