1 # This file is part of the 'dragora-installer'.
3 # Purpose: Medium selector (CD/DVD/SD/Pendrive/Hard disk).
10 --backtitle "\ZbSelecting the installation medium" \
11 --title "INSTALLATION ORIGIN" \
13 "Please select the installation medium containing the software packages \
14 to install Dragora:" 10 54 2 \
16 "1" "Local or mounted directory" \
17 2> ${SUBTMPDIR}/return-MenuMedia
19 # Check for selected options
20 case "$(cat ${SUBTMPDIR}/return-MenuMedia)" in
23 # Try to detect the device name via /proc
24 list="$(awk '/drive name:/{sub(/drive name:/,""); for (i=1; i<=NF; i++) print $i}' /proc/sys/dev/cdrom/info 2> /dev/null)" || true
26 # Scan device name(s) containing the packages for Dragora
27 for name in $list cdrom dvd hda hdb hdc hdd hde hdf hdh sr0 sr1 \
28 sr2 sr3 pcd0 pcd1 pcd2 pcd3 aztcd cdu535 gscd0 \
29 sonycd optcd sjcd mcdx0 mcdx1 sbpcd cm205cd \
32 test -n "$name" || continue
35 --backtitle "\ZbCDROM: Discovering drive name" \
36 --title "Searching CDROM drive" --sleep 1 \
37 --infobox "Checking device: /dev/${name}" 3 34
39 test -b "$name" || continue
42 --backtitle "\ZbCDROM: /dev/${name}" \
43 --title "Checking device content" --sleep 1 \
44 --infobox "Mounting /dev/${name} under /media/dragora-mount" 3 52
46 if mountpoint -q /media/dragora-mount
48 umount /media/dragora-mount
51 if mount -t iso9660 /dev/${name} /media/dragora-mount > /dev/null 2>&1
53 if test -d /media/dragora-mount/packages
55 echo "/media/dragora-mount/packages" > ${SUBTMPDIR}/MediumFound
59 --backtitle "\ZbCDROM: Dragora packages" \
60 --title "CD/DVD content" \
62 "The /dev/${name} device was successfully mounted under the\n\
63 /media/dragora-mount directory. However, the contents\n\
64 for the Dragora packages were not found. They are\n\
65 searched through /media/dragora-mount/packages.\n\
67 Next, the installer will proceed with another device\n\
68 looking for the package directory to install Dragora.\n\
69 (Let's say, if you inserted the CD/DVD containing the\n\
70 Dragora packages in a second CDROM drive)." 14 63
78 --backtitle "\ZbSelecting the installation medium: CDROM (medium not found)" \
79 --title "CDROM detection" \
82 "It was not possible to detect the device name for your CDROM drive.\n\n\
83 Please return to the previous menu by pressing \Zb\Z7ENTER\Zn in order to\n\
84 try by other means..." 9 71
86 1) ## Local or mounted directory
90 --backtitle "\ZbSelecting the installation medium: Local or mounted directory" \
91 --title "Define valid directory" \
93 "Please enter a directory path containing the packages to\n\
94 install Dragora. Note: the package directory search is\n\
95 relative to the specified directory. For example, if you\n\
96 enter \"/media/harddisk\" the installer will complete the\n\
97 path by adding \"/media/harddisk/packages\"." 12 62 \
98 2> ${SUBTMPDIR}/return-MenuMedia_case1
99 answer="$(cat ${SUBTMPDIR}/return-MenuMedia_case1)"
101 test -n "$answer" || continue
103 if test ! -d "/${answer}/packages"
106 --backtitle "\ZbSelecting the installation medium: Local or mounted directory" \
107 --title "Directory not found" \
108 --ok-label "Return" --msgbox \
109 "The \"packages\" subdirectory does not exist\n\
110 under the specified directory:\n\
115 echo "/${answer}/packages" > ${SUBTMPDIR}/MediumFound