diff options
author | Andreas Loibl <andreas@andreas-loibl.de> | 2011-09-27 21:39:11 +0200 |
---|---|---|
committer | Andreas Loibl <andreas@andreas-loibl.de> | 2011-09-27 21:39:11 +0200 |
commit | fa22289c6fbd3abc1b4506553d55dcff20d619f1 (patch) | |
tree | 737b37738e80a9677934cbfbe72028f07e24d023 /backend/modules/partitions | |
parent | 18a5985a2b829aa0858433faee98c13a5c9a5d08 (diff) | |
download | acritoxinstaller-fa22289c6fbd3abc1b4506553d55dcff20d619f1.zip acritoxinstaller-fa22289c6fbd3abc1b4506553d55dcff20d619f1.tar.gz |
strip_live_media, error handling, hdmap fixes
Diffstat (limited to 'backend/modules/partitions')
-rw-r--r-- | backend/modules/partitions | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/modules/partitions b/backend/modules/partitions index a42333e..211fdba 100644 --- a/backend/modules/partitions +++ b/backend/modules/partitions @@ -1,5 +1,15 @@ #!/bin/bash +# Synopsis: strip_live_media +# +# This function strips the live media (usbstick) from a list of devices +# Output example: +# /dev/sda +function strip_live_media() +{ + grep -ve '^$' $(awk '{if($2=="/live/image" && $3=="iso9660"){gsub(/[0-9]*$/,"",$1); print "-e ^"$1; exit 0;}}' < /proc/mounts) +} + # Synopsis: list_all_disks # # This function lists all disks @@ -8,7 +18,9 @@ # /dev/sdb function list_all_disks() { + ( awk -vli="$(awk '{if($2=="sd") print $1;}' /proc/devices)" 'BEGIN{m=split(li,list," ")}{for(i=1;i<=m;i++) if($1==list[i]&&$2%16==0) print "/dev/"$4;}' /proc/partitions + ) | strip_live_media } # Synopsis: send_list_of_disks @@ -34,8 +46,10 @@ function send_list_of_disks() # /dev/md0 function list_all_partitions() { + ( awk -vli="$(awk '{if($2=="sd") print $1;}' /proc/devices)" 'BEGIN{m=split(li,list," ")}{for(i=1;i<=m;i++) if($1==list[i]&&$2%16!=0) print "/dev/"$4;}' /proc/partitions awk -vli="$(awk '{if($2=="md") print $1;}' /proc/devices)" 'BEGIN{m=split(li,list," ")}{for(i=1;i<=m;i++) if($1==list[i]) print "/dev/"$4;}' /proc/partitions + ) | strip_live_media } # Synopsis: list_dm_partitions |