5 tempfile
=`mktemp 2> /dev/null` || tempfile
=/tmp
/test$$
6 trap "rm -f $tempfile" 0 1 2 5 15
10 for drv
in $
(find /dev
-maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" |
sort); do
11 LC_ALL
=C sfdisk
-d $drv 2> /dev
/null |
grep "^/dev/" | \
13 if echo "$LINE" |
grep -q "type=82\|type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F"; then
14 DEVICE
=$
(echo "$LINE" | cut
-d : -f 1 |
tr -d " ")
15 DEVNAME
=$
(basename $DEVICE)
17 (cd /dev
/disk
/by-id
; ls -l ata-
* usb-
* scsi-
* 2> /dev
/null | \
18 sed -n -e 's%.*[[:space:]]\+\(ata-.*\)%\1%p' -e 's%.*[[:space:]]\+\(usb-.*\)%\1%p' \
19 -e 's%.*[[:space:]]\+\(scsi-.*\)%\1%p' |
grep "/$DEVNAME$") |
read -r DEV_ID LNK_S LNK
21 if [ -n "$DEV_ID" ]; then
23 eval $
(echo "$LINE" | cut
-d : -f 2 | cut
-d , -f 2 |
tr -d " ")
24 echo -n "$(expr $size \* 512 / 1048576)MB "
31 $DIALOG --backtitle "Create swap on device" \
33 --menu "Select partition" 20 70 15 \
34 `lsswappart` 2> $tempfile
38 choice
=`cat $tempfile`
41 if [ ! -z "$choice" ]; then
42 DEV
=`realpath /dev/disk/by-id/$choice`