Magellan Linux

Annotation of /tags/installer-0_1_2/include/read_disk.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1072 - (hide annotations) (download) (as text)
Mon May 31 22:52:06 2010 UTC (14 years ago) by niro
File MIME type: application/x-sh
File size: 1900 byte(s)
tagged 'installer-0_1_2'
1 niro 773 #!/bin/bash
2 niro 1026 # $Id$
3 niro 773
4 niro 1034 source /etc/installer.conf
5     source ${INSTALLER_DIR}/include/hwdetection.sh
6 niro 773
7     # use C locale
8     export LC_ALL=C
9    
10     nocdrom()
11     {
12     local i
13     local item="$1"
14    
15     for i in ${ALL_CDROMS}
16     do
17     [[ ${i} = ${item} ]] && return 1
18     done
19    
20     return 0
21     }
22    
23     query_partition_disk_setup()
24     {
25     local i
26     local partition
27     local filesystem
28     local mountpoint
29     local command="$1"
30     local given_partition="$2"
31    
32     for i in ${PARTITION_DISK_SETUP}
33     do
34     partition=$(echo ${i} | cut -d: -f1)
35     filesystem=$(echo ${i} | cut -d: -f2)
36     mountpoint=$(echo ${i} | cut -d: -f3)
37    
38     if [[ ${partition} = ${given_partition} ]]
39     then
40     case ${command} in
41     --filesystem) echo "${filesystem}"; return 0;;
42     --mountpoint) echo "${mountpoint}"; return 0;;
43     --delete) export PARTITION_DISK_SETUP="${PARTITION_DISK_SETUP/${i}/}"; return 0;;
44     esac
45     fi
46     done
47     }
48    
49 niro 1026 # all disks, but exclude all ramdisks
50 niro 773 ALL_DISKS="$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d' )"
51     ALL_CDROMS="$(get_hwinfo cdrom)"
52    
53     for disk in ${ALL_DISKS}
54     do
55     # exclude cdroms
56     nocdrom ${disk} || continue
57    
58 niro 1026 echo "${disk}|${disk}"
59 niro 773
60 niro 1026 while read partition blurb
61 niro 773 do
62     # size
63 niro 1026 size="$(sfdisk -s ${partition})"
64     # fstype
65     fstype="$(mount -f --guess-fstype ${partition})"
66 niro 773 # bootable flag
67 niro 1026 boot="$(fdisk -l ${disk} | grep ${partition} | grep \* | sed 's/.*\(*\).*/b/')"
68 niro 1035 # mountpoint, but detect any swap
69     mountpoint="$(query_partition_disk_setup --mountpoint ${partition})"
70     # filesystem to format
71     format="$(query_partition_disk_setup --filesystem ${partition})"
72 niro 773
73 niro 1026 # do not print unkown disk with a size of 1
74     # these disks are containers for secondary partition types
75     if [[ ${fstype} = unknown ]] && [ ${size} -eq 1 ]
76     then
77     continue
78     fi
79    
80 niro 773 echo -n "|${partition}"
81     echo -n "|${size}"
82 niro 1026 echo -n "|${fstype}"
83 niro 773 echo -n "|${boot}"
84     echo -n "|${mountpoint}"
85     echo -n "|${format}"
86     echo
87    
88     done << EOF
89 niro 1026 $(get_hwinfo partition | grep ${disk})
90 niro 773 EOF
91     done

Properties

Name Value
svn:executable *