Group :: File tools
RPM: altquire
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
altquire-0.1.2/ 0000755 0000000 0000000 00000000000 12335703110 0013331 5 ustar 00root root 0000000 0000000 altquire-0.1.2/1-select-source.sh 0000755 0000000 0000000 00000005064 12335703110 0016610 0 ustar 00root root 0000000 0000000 #!/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 <http://www.gnu.org/licenses/>.
. 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