123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- # This file is part of the 'dragora-installer'.
- #
- # Purpose: Medium selector (CD-DVD/Pendrive/SD/Hard disk).
- # Show media menu
- while true
- do
- dialog --colors \
- --backtitle "\\ZbSelecting the installation medium" \
- --title "INSTALLATION ORIGIN" \
- --menu \
- "Please select the installation medium containing the software packages \
- to install Dragora:" 10 54 2 \
- "0" "CDROM" \
- "1" "Local or mounted directory" \
- 2> "${SUBTMPDIR}/return-MenuMedia"
- # Check for selected options
- case "$(cat -- "${SUBTMPDIR}"/return-MenuMedia)" in
- 0) ## CDROM
- # Scan device name(s) containing the packages to install Dragora
- for name in hda hdb hdc hdd hde hdf hdh sr0 sr1 sr2 sr3 \
- pcd0 pcd1 pcd2 pcd3 aztcd cdu535 gscd0 \
- sonycd optcd sjcd mcdx0 mcdx1 sbpcd \
- cm205cd cm206cd mcd dvd cdrom ; \
- do
- # Prepend path for device files
- name=/dev/${name}
- dialog --colors \
- --backtitle "\\ZbCDROM: Discovering drive name" \
- --title "Searching CDROM drive" --sleep 1 \
- --infobox "Checking device: $name" 3 33
- test -b "$name" || continue
- # Prepare to mount and check the package directory
- if mountpoint -q /media/dragora-packages
- then
- umount /media/dragora-packages
- fi
- echo "Mounting ${name} under /media/dragora-packages ..."
- sleep 3
- if mount -t iso9660 $name /media/dragora-packages > /dev/null 2>&1
- then
- if test ! -e /media/dragora-packages/packages
- then
- dialog --colors \
- --backtitle "\\ZbCDROM: Dragora packages" \
- --title "CD/DVD Content" \
- --msgbox \
- "The ${name} device was successfully mounted under the\\n\
- /media/dragora-packages directory. However, the contents\\n\
- for the Dragora packages were not found. They are\\n\
- searched through /media/dragora-packages/packages.\\n\
- \\n\
- The installer can check for another device name (such as\\n\
- a secondary CDROM drive) looking for the package directory\\n\
- in order to install Dragora.\\n\
- \\n\
- Press \\Z3[Enter]\Zn to proceed..." 14 63
- continue
- else
- # Save reference directory
- echo "/media/dragora-packages/packages" \
- > "${SUBTMPDIR}/MediumFound"
- # Save device name to eject later
- echo "$name" > "${SUBTMPDIR}/CDDevice"
- break 2;
- fi
- fi
- done
- unset -v name
- dialog --colors \
- --backtitle "\\ZbSelecting the installation medium: CDROM (medium not found)" \
- --title "CDROM detection" \
- --ok-label "Return" \
- --msgbox \
- "It was not possible to detect the device name for your CDROM drive.\\n\\n\
- Please return to the previous menu by pressing \\Z3[Enter]\Zn in order to\\n\
- try by other means..." 9 71
- ;;
- 1) ## Local or mounted directory
- while true
- do
- dialog --colors \
- --backtitle "\\ZbSelecting the installation medium: Local or mounted directory" \
- --title "Define valid directory" \
- --cancel-label "- Back" --inputbox \
- "Please enter a directory path containing the packages to\\n\
- install Dragora. Note: the package directory search is\\n\
- relative to the specified directory. For example, if you\\n\
- enter \"/media/harddisk\" the installer will complete the\\n\
- path by adding \"/media/harddisk/packages\"." 12 62 \
- 2> "${SUBTMPDIR}/return-MenuMedia_case1" || continue 2;
- answer="$(cat -- "${SUBTMPDIR}"/return-MenuMedia_case1)"
- test -n "$answer" || continue
- if test ! -d "/${answer}/packages"
- then
- dialog --colors \
- --backtitle "\\ZbSelecting the installation medium: Local or mounted directory" \
- --title "Directory not found" \
- --ok-label "Return" --msgbox \
- "The \"packages\" subdirectory does not exist\\n\
- under the specified directory:\\n\
- /${answer#/*}" 8 47
- continue
- fi
- echo "/${answer}/packages" > "${SUBTMPDIR}/MediumFound"
- unset -v answer
- break 2;
- done
- ;;
- esac
- done
|