altquire-0.1.2/000075500000000000000000000000001233570311000133315ustar00rootroot00000000000000altquire-0.1.2/1-select-source.sh000075500000000000000000000050641233570311000166100ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . . get-sn.sh devcount=0 menulist='' while read line; do # List block devices (without RAM disks and loop devices) devcount=$(($devcount+1)) dev=`echo "$line" | cut -d ' ' -f 1` size=`echo "$line" | cut -d ' ' -f 2` model=`echo "$line" | cut -d ' ' -f 3-` sn=`get_sn "/dev/$dev"` menulist="$menulist \"$dev\" \"$model, емкость: $size, с/н: $sn\"" done < <(lsblk -dnro NAME,SIZE,MODEL -e 1,7 2> /dev/null) while read line; do # Add RAID and LVM devices devcount=$(($devcount+1)) dev=`echo "$line" | cut -d ':' -f 1 | cut -d '/' -f 3` type=`blkid -p -o value -s TYPE "/dev/$dev" 2> /dev/null` if [ -z "$type" ]; then type="-" fi uuid=`blkid -p -o value -s UUID "/dev/$dev" 2> /dev/null` if [ -z "$uuid" ]; then uuid="-" fi menulist="$menulist \"$dev\" \"UUID: $uuid, тип: $type\"" done < <(blkid -p /dev/dm-* 2> /dev/null) if [ $devcount == 0 ]; then # No block devices found dialog --msgbox "Доступных накопителей не обнаружено!" 12 60 exec ./255-finish.sh fi # Display menulist tmpfile=`mktemp 2> /dev/null` command="dialog --visit-items --cancel-label \"Выход из программы\" --ok-label \"Выбрать накопитель\" --extra-button --extra-label \"Обновить список\" --menu \"Выберите накопитель, содержимое которого следует скопировать (накопитель-источник):\" 23 75 20 $menulist 2> "$tmpfile"" eval "$command" ec="$?" device=`cat "$tmpfile" 2> /dev/null` rm -f "$tmpfile" 2> /dev/null # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "OK" button pressed if [ ! -z "$device" ]; then exec ./2-select-destination.sh "$device" # Next step else exec $0 # Nothing was selected fi ;; 1) exit 1;; # "Cancel" button pressed 3) exec $0;; # "Extra" button pressed esac altquire-0.1.2/128-dc3dd-clone.sh000075500000000000000000000054721233570311000162670ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . srcdev="$1" dstdev="$2" if [ -z "$srcdev" ] || [ -z "$dstdev" ]; then dialog --msgbox "Не выбраны накопители!" 12 60 exit 5 fi if [ "$ALTQUIRE_DST" != "$dstdev" ]; then # Double-check dialog --msgbox "Ошибка: \"$dstdev\" != \"$ALTQUIRE_DST\"!" 12 60 exit 6 fi logfile=`mktemp --suffix=.dc3dd 2> /dev/null` # Run dc3dd clear echo 'Запуск клонирования. Для отмены клонирования нажмите Ctrl+C.' echo '' dc3dd if="$srcdev" of="$dstdev" log="$logfile" # Examine the log file grep -q '^dc3dd completed at ' "$logfile" if [ $? == 0 ]; then # dc3dd successfully completed question=`echo -e "Клонирование успешно завершено! Более подробные сведения можно найти в журнальном файле по адресу \"$logfile\".\n\nОтобразить содержимое указанного файла?"` dialog --visit-items --cr-wrap --yes-label "Да" --no-label "Нет" --yesno "$question" 12 60 ec="$?" # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "YES" button pressed, display the log dialog --exit-label "Вернуться" --textbox "$logfile" 60 75 exec ./255-finish.sh ;; 1) exec ./255-finish.sh;; # "NO" button pressed, go to next step esac else # dc3dd failed question=`echo -e "Клонирование было прервано из-за ошибки или из-за его отмены пользователем! Более подробные сведения можно найти в журнальном файле по адресу \"$logfile\".\n\nОтобразить содержимое указанного файла?"` dialog --visit-items --cr-wrap --yes-label "Да" --no-label "Нет" --yesno "$question" 12 65 ec="$?" # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "YES" button pressed, display the log dialog --exit-label "Вернуться" --textbox "$logfile" 60 75 exec ./255-finish.sh ;; 1) exec ./255-finish.sh;; # "NO" button pressed, go to next step esac fi altquire-0.1.2/128-dc3dd-file.sh000075500000000000000000000052041233570311000160770ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . srcdev="$1" dstdir="$2" fstype="$3" mountpoint="$4" if [ -z "$srcdev" ] || [ -z "$dstdir" ] || [ -z "$fstype" ] || [ -z "$mountpoint" ]; then dialog --msgbox "Не выбран накопитель, или не задан путь к файлу для записи данных, или не задан тип файловой системы, или не задана точка подключения файловой системы!" 12 60 exit 5 fi log_filename='dc3dd.log' logfile="$dstdir$log_filename" filename='image.00000' # Run dc3dd clear echo 'Запуск копирования. Для отмены копирования нажмите Ctrl+C.' echo '' if [ "$fstype" == "vfat" ]; then # Segment the output dc3dd if="$srcdev" ofs="$dstdir$filename" ofsz=4294967294c log="$logfile" else # Output into one file dc3dd if="$srcdev" of="$dstdir$filename" log="$logfile" fi # Examine the log file grep -q '^dc3dd completed at ' "$logfile" if [ $? == 0 ]; then # dc3dd successfully completed dialog --msgbox "Копирование успешно завершено!" 12 60 exec ./255-finish.sh "$mountpoint" # Go to next step else # dc3dd failed question=`echo -e "Копирование было прервано из-за ошибки или из-за его отмены пользователем! Более подробные сведения можно найти в журнальном файле по адресу \"$logfile\".\n\nОтобразить содержимое указанного файла?"` dialog --visit-items --cr-wrap --yes-label "Да" --no-label "Нет" --yesno "$question" 12 65 ec="$?" # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "YES" button pressed, display the log dialog --exit-label "Вернуться" --textbox "$logfile" 60 75 exec ./255-finish.sh "$mountpoint" ;; 1) exec ./255-finish.sh "$mountpoint";; # "NO" button pressed, go to next step esac fi altquire-0.1.2/2-select-destination.sh000075500000000000000000000050361233570311000176310ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . . get-sn.sh srcdev="$1" if [ -z "$srcdev" ]; then dialog --msgbox "Сначала нужно выбрать накопитель, с которого будут скопированы данные!" 12 60 exit 5 fi devcount=0 menulist='' while read line; do # List block devices (without RAM disks, CD drives, loop devices and without source drive) dev=`echo "$line" | cut -d ' ' -f 1` if [ "$srcdev" != "$dev" ]; then devcount=$(($devcount+1)) size=`echo "$line" | cut -d ' ' -f 2` model=`echo "$line" | cut -d ' ' -f 3-` sn=`get_sn "/dev/$dev"` menulist="$menulist \"$dev\" \"$model, емкость: $size, с/н: $sn\"" fi done < <(lsblk -dnro NAME,SIZE,MODEL -e 1,7,25,26,27,28,24,21,15,29,16,23,20,32,17,18,46,11,22 2> /dev/null) # See "http://www.faqs.org/docs/Linux-HOWTO/CDROM-HOWTO.html" if [ $devcount == 0 ]; then # No block devices found dialog --msgbox "Доступных накопителей не обнаружено!" 12 60 exec ./255-finish.sh fi # Display menulist tmpfile=`mktemp 2> /dev/null` command="dialog --visit-items --cancel-label \"Назад\" --ok-label \"Выбрать накопитель\" --extra-button --extra-label \"Обновить список\" --menu \"Выберите накопитель, на который следует скопировать данные (накопитель-приемник):\" 23 75 20 $menulist 2> "$tmpfile"" eval "$command" ec="$?" device=`cat "$tmpfile" 2> /dev/null` rm -f "$tmpfile" 2> /dev/null # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "OK" button pressed if [ ! -z "$device" ]; then exec ./3-select-confirm.sh "$srcdev" "$device" # Next step else exec $0 "$srcdev" # Nothing was selected fi ;; 1) exec ./1-select-source.sh;; # "Cancel" button pressed 3) exec $0 "$srcdev";; # "Extra" button pressed esac altquire-0.1.2/255-finish.sh000075500000000000000000000031731233570311000154650ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . mountpoint="$1" if [ ! -z "$mountpoint" ]; then umount "$mountpoint" 2> /dev/null ec="$?" if [ $ec != 0 ]; then # Cannot ummount dialog --msgbox "Невозможно отключить файловую систему, содержащую скопированные данные! В таком случае не отключайте накопитель, содержащий скопированные данные, до выключения компьютера." 12 60 else rmdir "$mountpoint" 2> /dev/null fi fi export ALTQUIRE_DST= dialog --visit-items --cr-wrap --yes-label "Да, завершить" --no-label "Нет, начать сначала" --yesno "Завершить работу с программой?" 12 60 ec="$?" # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) exit 0;; # "YES" button pressed, quit 1) exec ./1-select-source.sh;; # "NO" button pressed, start again esac altquire-0.1.2/3-select-confirm.sh000075500000000000000000000046651233570311000167550ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . . get-sn.sh srcdev="$1" dstdev="$2" if [ -z "$srcdev" ] || [ -z "$dstdev" ]; then dialog --msgbox "Не выбраны накопители!" 12 60 exit 5 fi srcstring='' dststring='' while read line; do # Collect information about selected devices dev=`echo "$line" | cut -d ' ' -f 1` if [ "$dev" == "$srcdev" ]; then srcsize=`echo "$line" | cut -d ' ' -f 2` srcmodel=`echo "$line" | cut -d ' ' -f 3-` srcsn=`get_sn "/dev/$dev"` srcstring="$dev, $srcmodel, $srcsize, $srcsn" fi if [ "$dev" == "$dstdev" ]; then dstsize=`echo "$line" | cut -d ' ' -f 2` dstmodel=`echo "$line" | cut -d ' ' -f 3-` dstsn=`get_sn "/dev/$dev"` dststring="$dev, $dstmodel, $dstsize, $dstsn" fi done < <(lsblk -dnro NAME,SIZE,MODEL -e 7) if [ -z "$dststring" ]; then # Something strange happened! dialog --msgbox "Ошибка при получении сведений о накопителе-приемнике!" 12 60 exit 5 fi if [ -z "$srcstring" ]; then srcstring="$srcdev" fi # Display confirmation dialog question=`echo -e "Будет произведено копирование данных следующим образом:\nС НАКОПИТЕЛЯ $srcstring\nНА НАКОПИТЕЛЬ $dststring\n\nВсе верно?\n\nНажатие на кнопку \"Да\" еще не начнет копирование."` dialog --visit-items --cr-wrap --yes-label "Да" --no-label "Нет" --yesno "$question" 16 60 ec="$?" # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "YES" button pressed export ALTQUIRE_DST="/dev/$dstdev" # Use this global variable for further double-checking exec ./4-select-mode.sh "$srcdev" "$dstdev" # Go to next step ;; 1) exec ./1-select-source.sh;; # "NO" button pressed esac altquire-0.1.2/4-select-mode.sh000075500000000000000000000032331233570311000162330ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . srcdev="$1" dstdev="$2" if [ -z "$srcdev" ] || [ -z "$dstdev" ]; then dialog --msgbox "Не выбраны накопители!" 12 60 exit 5 fi # Display menulist tmpfile=`mktemp 2> /dev/null` dialog --visit-items --cancel-label "В начало" --ok-label "Выбрать режим" --menu "Выберите режим копирования данных:" 23 75 20 "disk-to-file" "Копирование содержимого накопителя в файл" "disk-to-disk" "Создание клона накопителя" 2> "$tmpfile" ec="$?" mode=`cat "$tmpfile" 2> /dev/null` rm -f "$tmpfile" 2> /dev/null # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "OK" button pressed case $mode in disk-to-disk) exec ./5-clone-confirm.sh "$srcdev" "$dstdev";; # Next step disk-to-file) exec ./5-enter-caseinfo.sh "$srcdev" "$dstdev";; # Next step esac ;; 1) exec ./1-select-source.sh;; # "Cancel" button pressed esac altquire-0.1.2/5-clone-confirm.sh000075500000000000000000000034701233570311000165710ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . srcdev="$1" dstdev="$2" if [ -z "$srcdev" ] || [ -z "$dstdev" ]; then dialog --msgbox "Не выбраны накопители!" 12 60 exit 5 fi src_size=`blockdev --getsize64 "/dev/$srcdev" 2> /dev/null || echo 0` dst_size=`blockdev --getsize64 "/dev/$dstdev" 2> /dev/null || echo 0` if [ "$src_size" -gt "$dst_size" ]; then # Not enough space dialog --msgbox "Накопитель-приемник имеет меньшую емкость, чем накопитель-источник!" 12 60 exec ./1-select-source.sh fi # Display confirmation dialog question=`echo -e "Клонирование накопителя приведет к перезаписи имеющихся данных на накопителе-приемнике. Продолжить?"` dialog --visit-items --cr-wrap --yes-label "Да" --no-label "Нет" --yesno "$question" 12 60 ec="$?" # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) exec ./128-dc3dd-clone.sh "/dev/$srcdev" "/dev/$dstdev";; # "YES" button pressed, go to next step 1) exec ./4-select-mode.sh "$srcdev" "$dstdev";; # "NO" button pressed esac altquire-0.1.2/5-enter-caseinfo.sh000075500000000000000000000030321233570311000167320ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . srcdev="$1" dstdev="$2" if [ -z "$srcdev" ] || [ -z "$dstdev" ]; then dialog --msgbox "Не выбраны накопители!" 12 60 exit 5 fi # Display input box tmpfile=`mktemp 2> /dev/null` dialog --visit-items --cancel-label "В начало" --ok-label "Ввод" --inputbox "Введите краткое описание обстоятельств копирования данных в произвольной форме (поле можно оставить пустым):" 25 60 2> "$tmpfile" ec="$?" # What did user select or enter? case $ec in 255) # Error or "ESC" key pressed rm -f "$tmpfile" 2> /dev/null exit 255 ;; 0) exec ./6-select-filesystem.sh "$srcdev" "$dstdev" "$tmpfile";; # "YES" button pressed, go to next step 1) # "NO" button pressed rm -f "$tmpfile" 2> /dev/null exec ./1-select-source.sh ;; esac altquire-0.1.2/6-select-filesystem.sh000075500000000000000000000131671233570311000175040ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . srcdev="$1" dstdev="$2" descrfile="$3" dstdir='' if [ "$ALTQUIRE_DST" != "/dev/$dstdev" ]; then # Double-check dialog --msgbox "Ошибка: \"/dev/$dstdev\" != \"$ALTQUIRE_DST\"!" 12 60 exit 6 fi function mountdev_and_prepare() { umount "/dev/$1" 2> /dev/null grep -q "^/dev/$1 " /proc/mounts ec="$?" if [ $ec == 0 ]; then # Already mounted dialog --msgbox "Файловая система \"$1\" уже подключена! Перед копированием необходимо произвести отключение указанной файловой системы." 12 60 exec $0 "$srcdev" "$dstdev" "$descrfile" fi mountpoint=`mktemp -d 2> /dev/null` mount -o rw "/dev/$1" "$mountpoint" ec="$?" if [ $ec != 0 ]; then # Cannot mount rmdir "$mountpoint" 2> /dev/null dialog --msgbox "Невозможно подключить выбранную файловую систему! Вероятно, выбранная файловая система повреждена и требует восстановления." 12 60 exec $0 "$srcdev" "$dstdev" "$descrfile" fi src_size=`blockdev --getsize64 "/dev/$srcdev" 2> /dev/null || echo 0` avail_space_1024=`df -Pk "$mountpoint/." | grep "$mountpoint\$" | awk '{ print $4 }'` cant_do_it=$(($src_size-$avail_space_1024*1024)) if [ $cant_do_it -gt 0 ]; then # Not enough free space in the file system umount "$mountpoint" 2> /dev/null rmdir "$mountpoint" 2> /dev/null dialog --msgbox "В выбранной файловой системе недостаточно свободного пространства (не хватает, байт: $cant_do_it)! Выберите другую файловую систему." 12 60 exec $0 "$srcdev" "$dstdev" "$descrfile" fi currtime=`date '+%H-%M-%S_%Y-%m-%d'` mkdir "$mountpoint/$currtime" 2> /dev/null ec="$?" if [ $ec != 0 ]; then # Cannot create directory umount "$mountpoint" 2> /dev/null rmdir "$mountpoint" 2> /dev/null dialog --msgbox "Невозможно создать в выбранной файловой системе директорию с именем \"$currtime\" для сохранения копируемых данных!" 12 60 exec $0 "$srcdev" "$dstdev" "$descrfile" fi cp -f "$descrfile" "$mountpoint/$currtime/information.txt" 2> /dev/null ec="$?" if [ $ec != 0 ]; then # Cannot move file umount "$mountpoint" 2> /dev/null rmdir "$mountpoint" 2> /dev/null dialog --msgbox "Невозможно переместить в выбранную файловую систему файл с описанием обстоятельств копирования данных!" 12 60 exec $0 "$srcdev" "$dstdev" "$descrfile" fi dstdir="$mountpoint/$currtime/" } if [ -z "$srcdev" ] || [ -z "$dstdev" ] || [ -z "$descrfile" ] || [ ! -r "$descrfile" ]; then dialog --msgbox "Не выбраны накопители или не задан файл с описанием обстоятельств копирования данных!" 12 60 exit 5 fi devcount=0 menulist='' lastdev='' while read line; do # List available file systems dev=`echo "$line" | cut -d ' ' -f 1` fstype=`echo "$line" | cut -d ' ' -f 2` if [ "$fstype" == "ntfs" ] || [ "$fstype" == "vfat" ] || [ "$fstype" == "ext4" ] || [ "$fstype" == "btrfs" ]; then devcount=$(($devcount+1)) lastdev="$dev" menulist="$menulist \"$dev\" \"файловая система: $fstype\"" fi done < <(lsblk -nro NAME,FSTYPE "/dev/$dstdev") if [ $devcount == 0 ]; then # No file systems found dialog --msgbox "Доступных файловых систем на накопителе \"$dstdev\" не обнаружено! Обратите внимание, что в настоящее время программой \"altquire\" поддерживаются только файловые системы NTFS, FAT, Ext4 и btrfs." 12 60 rm -f "$descrfile" 2> /dev/null exec ./4-select-mode.sh "$srcdev" "$dstdev" else # File system(s) found # Display menulist tmpfile=`mktemp 2> /dev/null` command="dialog --visit-items --cancel-label \"В начало\" --ok-label \"Выбрать файловую систему\" --menu \"Выберите файловую систему, в которую будут скопированы данные:\" 23 75 20 $menulist 2> "$tmpfile"" eval "$command" ec="$?" mountdevice=`cat "$tmpfile" 2> /dev/null` rm -f "$tmpfile" 2> /dev/null # What did user select? case $ec in 255) exit 255;; # Error or "ESC" key pressed 0) # "OK" button pressed if [ ! -z "$mountdevice" ]; then fs=`blkid -o value -s TYPE "/dev/$mountdevice" 2> /dev/null` mountdev_and_prepare "$mountdevice" if [ ! -z "$dstdir" ]; then exec ./128-dc3dd-file.sh "/dev/$srcdev" "$dstdir" "$fs" "$mountpoint" # Next step fi else exec $0 "$srcdev" "$dstdev" "$descrfile" # Nothing was selected fi ;; 1) # "Cancel" button pressed rm -f "$descrfile" 2> /dev/null exec ./1-select-source.sh ;; esac fi altquire-0.1.2/altquire000075500000000000000000000033101233570311000151020ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . VERSION='20140517' PROGRAMPATH='.' # Check dependencies if [ -z `which dc3dd` ] || [ -z `which lsblk` ] || [ -z `which blkid` ] || [ -z `which blockdev` ] || [ -z `which dialog` ] || [ -z `which grep` ] || [ -z `which awk` ] || [ -z `which strings` ]; then echo 'Are you sure that dc3dd, lsblk, blkid, blockdev, dialog, grep, awk and strings were installed?' exit 255 fi # Safely activate Linux RAID and LVM2. raid-forensic start &> /dev/null lvm2-forensic start &> /dev/null cd "$PROGRAMPATH" msg="Программа \"altquire\" (версия \"$VERSION\") является оболочкой для программы \"dc3dd\". Опытным пользователям рекомендуется использовать названную программу напрямую из командной строки.\n\nДля работы с интерфейсом используйте стрелки на клавиатуре и клавиши Tab, Enter." dialog --msgbox "$msg" 12 60 exec ./1-select-source.sh altquire-0.1.2/get-sn.sh000075500000000000000000000022231233570311000150640ustar00rootroot00000000000000#!/bin/bash # 10/05/2014, author: Maxim Suhanov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . function get_sn() # Obtain serial number { # First try sn=`hdparm -I "$1" 2> /dev/null | grep -i 'serial number:' | awk '{ sn = ""; for (i = 3; i <= NF; i++) sn = sn $i " "; print sn }' | strings` if [ -z "$sn" ]; then # Second try sn=`smartctl --all "$1" 2> /dev/null | grep -i 'serial number:' | awk '{ sn = ""; for (i = 3; i <= NF; i++) sn = sn $i " "; print sn }' | strings` if [ -z "$sn" ]; then # We got nothing sn='-' fi fi echo "$sn" }