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
+20 -22
View File
@@ -38,9 +38,9 @@ FindImages(){
printf "${LCYAN}Results Found:${NC}\n" printf "${LCYAN}Results Found:${NC}\n"
echo echo
if [ "${1}" ];then if [ "${1}" ];then
find $1 -regex ".*\.\(img\|iso\)" | grep [.iso,.img] find "${1}" -regex ".*\.\(img\|iso\)$"
else else
find ${HOMEDIR} -regex ".*\.\(img\|iso\)" | grep [.iso,.img] find "${HOMEDIR}" -regex ".*\.\(img\|iso\)$"
fi fi
} }
CheckFile(){ CheckFile(){
@@ -90,23 +90,22 @@ Quit(){
} }
FindMgr(){ FindMgr(){
use_which=$(which {dnf,pacman,xbps-install})
base_dir="/usr/bin" base_dir="/usr/bin"
printf "${BWHITE}\n\nGetting Dependencies...${NC}\n\n" printf "${BWHITE}\n\nGetting Dependencies...${NC}\n\n"
if [ -f "${base_dir}/apt" ] || [ -f "${base_dir}/apt-get" ];then 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 dnf -y install pv
elif [ "${use_which}" = "${base_dir}/pacman" ];then elif which pacman >/dev/null 2>&1;then
pacman -Sy pv pacman -Sy pv
elif [ "${use_which}" = "${base_dir}/xbps-install" ];then elif which xbps-install >/dev/null 2>&1;then
xbps-install -Sy pv xbps-install -Sy pv
else 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 fi
return return
} }
@@ -121,8 +120,7 @@ case "$1" in
printf "${LGREEN}Image files (img, iso) in ${2}${NC}\n" printf "${LGREEN}Image files (img, iso) in ${2}${NC}\n"
printf "${LBLUE}-------------------------------------------${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n"
#find $2 -regex ".*\.\(img\|iso\)" | grep [.iso,.img] FindImages "${2}"
FindImages $2
if [ ! $? = 0 ];then if [ ! $? = 0 ];then
printf "${LRED}No image files found${NC}\n" printf "${LRED}No image files found${NC}\n"
fi fi
@@ -130,8 +128,8 @@ case "$1" in
printf "${YELLOW}Copy & paste full file path here: ${NC}" printf "${YELLOW}Copy & paste full file path here: ${NC}"
read filepath read filepath
Quit ${filepath} Quit "${filepath}"
CheckFile ${filepath} CheckFile "${filepath}"
clear clear
Options Options
echo echo
@@ -142,16 +140,16 @@ case "$1" in
echo echo
printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): " printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): "
read devname read devname
Quit ${devname} Quit "${devname}"
DEVPATH="${DEVICEDIR}/${devname}" DEVPATH="${DEVICEDIR}/${devname}"
CheckDev ${DEVPATH} CheckDev "${DEVPATH}"
ConfirmWrite ${filepath} ${DEVPATH} ConfirmWrite "${filepath}" "${DEVPATH}"
echo echo
printf "${LCYAN}Please wait ...${NC}\n" printf "${LCYAN}Please wait ...${NC}\n"
echo echo
pv -tpreb ${filepath} | dd bs=${BLOCKSIZE}M of=${DEVICEDIR}/${devname} pv -tpreb "${filepath}" | dd bs="${BLOCKSIZE}M" of="${DEVPATH}"
echo echo
printf "${YELLOW}Syncing buffers...${NC}\n";sync printf "${YELLOW}Syncing buffers...${NC}\n";sync
echo echo
@@ -185,8 +183,8 @@ case "$1" in
printf "${YELLOW}Copy & paste full file path here: ${NC}" printf "${YELLOW}Copy & paste full file path here: ${NC}"
read filepath read filepath
Quit ${filepath} Quit "${filepath}"
CheckFile ${filepath} CheckFile "${filepath}"
clear clear
@@ -199,15 +197,15 @@ case "$1" in
echo echo
printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): " printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): "
read devname read devname
Quit ${devname} Quit "${devname}"
DEVPATH="${DEVICEDIR}/${devname}" DEVPATH="${DEVICEDIR}/${devname}"
CheckDev ${DEVPATH} CheckDev "${DEVPATH}"
ConfirmWrite ${filepath} ${DEVPATH} ConfirmWrite "${filepath}" "${DEVPATH}"
echo echo
printf "${LCYAN}Please wait ...${NC}\n" printf "${LCYAN}Please wait ...${NC}\n"
echo echo
pv -tpreb ${filepath} | dd bs=${BLOCKSIZE}M of=${DEVICEDIR}/${devname} pv -tpreb "${filepath}" | dd bs="${BLOCKSIZE}M" of="${DEVPATH}"
echo echo
printf "${YELLOW}Syncing buffers...${NC}\n";sync printf "${YELLOW}Syncing buffers...${NC}\n";sync
echo echo