1010# Лицензия MIT, читайте файл LICENSE.md
1111
1212# Check root
13- if [[ ` whoami` != " root" ]]; then echo -e " Run as root! You have no rights." ; exit 2; fi
14-
15- # Check localisation file
16- if [[ ! -e " /usr/share/idd/idd.${LANG: 0: 2} " ]]; then
17- if [[ -e " ./lang/idd.${LANG: 0: 2} " ]]; then
18- mkdir " /usr/share/idd"
19- cp ./lang/* /usr/share/idd/
20- cp $0 /usr/bin/idd
21- echo " idd.sh installed successful!"
22- echo " Run just 'idd' without '.sh'."
23- exit 0
24- else
25- echo " Localisation files not found. Please download release archive from"
26- echo " https://github.com/grigruss/interactive-dd/releases"
27- echo " Extract and run 'idd.sh' from extracted directory."
28- exit 2
29- fi
30- fi
13+ if [[ ` whoami` != " root" ]]; then echo -e " \n\t\e[33;5mRun as root! You have no rights.\e[0m\n" ; exit 2; fi
3114
3215# Load locales
3316IFS=$' \n '
3417iddlocale=
35- for line in $( cat " /usr/share/idd/idd. ${LANG: 0: 2} " ) ; do
18+ for line in $( cat " /usr/share/idd/${LANG: 0: 2} .trans " ) ; do
3619 idx1=` expr index " $line " =`
3720 idx=` expr $idx1 - 1`
3821 nm=" ${line: 0: $idx } "
@@ -53,7 +36,7 @@ list= # For lists of files/disks | Для списков файлов/диско
5336# Рисует шапку/заголовок
5437field (){
5538 echo -e " \e[37;45m\e[2J\e[1;0H"
56- echo -e " $idd_header "
39+ echo -e " $idd_header dd (v0.4.1)\e[0m\e[37;45;1m "
5740 echo -e " $idd_target "
5841 echo -e " $idd_target1 "
5942 echo -e " $idd_thankfulness "
@@ -76,7 +59,7 @@ chs1(){
7659 else
7760 showdevices
7861 fi
79- echo -e " $idd_read_source_dest "
62+ echo -e " $idd_read_source_dest $d$idd_read_source_dest1 "
8063 read file
8164 sl=" ${# list[*]} "
8265 if [[ $d == " $idd_choise_f " && $file == $sl ]]; then
@@ -109,10 +92,10 @@ chs2(){
10992 esac
11093 if [[ $d == $idd_choise_d ]]; then
11194 showdevices
112- echo -e " $idd_read_source_dest "
95+ echo -e " $idd_read_source_dest $d$idd_read_source_dest1 "
11396 read file
11497 else
115- echo -e " $idd_type_filename "
98+ echo -e " $idd_type_filename $d$idd_type_filename1 "
11699 read ff
117100 if [[ -e " $ff " && $ff != " /dev/null" ]]; then
118101 echo -e " $idd_file_exists_exit " ; exit 2
@@ -130,13 +113,15 @@ chs2(){
130113# Вывод нумерованного списка файлов в текущей директории
131114showfiles (){
132115 echo -e " $idd_filelist "
133- flist=(` ls * .i* ` )
134116 count=1
135- for file in ${flist[*]} ; do
136- echo -e " \t\t$count ) $file "
137- list[$count ]=$file
138- count=` expr $count + 1`
139- done
117+ if [[ -e * .i* ]]; then
118+ flist=(` ls * .i* ` )
119+ for file in ${flist[*]} ; do
120+ echo -e " \t\t$count ) $file "
121+ list[$count ]=$file
122+ count=` expr $count + 1`
123+ done
124+ fi
140125 echo -e " \t\t$count$idd_type_from_kbd "
141126}
142127
@@ -167,6 +152,7 @@ showdevices(){
167152# Get device block size
168153# Определение размера блока
169154getbs (){
155+ if [[ ! -e /sys/block/$bsdev /queue/logical_block_size ]]; then bs=; return ; fi
170156 bsdev=
171157 if [[ ${odev: 0: 4} == " /dev" ]]; then bsdev=" ${odev: 5} " ; else bsdev=" no" ; return ; fi
172158 blocksize=` cat /sys/block/$bsdev /queue/logical_block_size`
@@ -189,7 +175,7 @@ showdata(){
189175 field
190176 echo -e " \e[30;47m\e[12H\e[0J"
191177 echo -e " $idd_source_choised \t$idev "
192- echo -e " $idd_dest_choised$odev \t$mnt \e[0m\e[30;47m"
178+ echo -e " $idd_dest_choised \t $odev \t$mnt \e[0m\e[30;47m"
193179 echo -e " $idd_bs \t$bs "
194180 if [[ ! $bs ]]; then pbs=" " ; else pbs=" bs=$bs " ; fi
195181 echo -e " $idd_command \e[30;43m dd if=$idev of=$odev ${pbs} status=progress \e[0m\e[30;47m"
0 commit comments