Magellan Linux

Annotation of /trunk/installer/include/read_disk.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1034 - (hide annotations) (download) (as text)
Sun May 30 18:29:43 2010 UTC (13 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 2137 byte(s)
-added ncurses-gui
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     #
33     #--overwrite
34    
35     for i in ${PARTITION_DISK_SETUP}
36     do
37     partition=$(echo ${i} | cut -d: -f1)
38     filesystem=$(echo ${i} | cut -d: -f2)
39     mountpoint=$(echo ${i} | cut -d: -f3)
40    
41     if [[ ${partition} = ${given_partition} ]]
42     then
43     case ${command} in
44     --filesystem) echo "${filesystem}"; return 0;;
45     --mountpoint) echo "${mountpoint}"; return 0;;
46     --delete) export PARTITION_DISK_SETUP="${PARTITION_DISK_SETUP/${i}/}"; return 0;;
47     esac
48     fi
49     done
50     }
51    
52 niro 1026 # all disks, but exclude all ramdisks
53 niro 773 ALL_DISKS="$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d' )"
54     ALL_CDROMS="$(get_hwinfo cdrom)"
55    
56     for disk in ${ALL_DISKS}
57     do
58     # exclude cdroms
59     nocdrom ${disk} || continue
60    
61 niro 1026 echo "${disk}|${disk}"
62 niro 773
63 niro 1026 # while read partition size id boot
64     while read partition blurb
65 niro 773 do
66     # size
67 niro 1026 size="$(sfdisk -s ${partition})"
68     # fstype
69     fstype="$(mount -f --guess-fstype ${partition})"
70 niro 773 # bootable flag
71 niro 1026 boot="$(fdisk -l ${disk} | grep ${partition} | grep \* | sed 's/.*\(*\).*/b/')"
72 niro 773 # # swap
73     # if [[ ${id} = 82 ]]
74     # then
75     # mountpoint="swap"
76     # format="swap"
77     # export PARTITION_DISK_SETUP="${PARTITION_DISK_SETUP} ${disk}:swap:swap"
78     # else
79     # mountpoint, but detect any swap
80 niro 1026 mountpoint="$(query_partition_disk_setup --mountpoint ${partition})"
81 niro 773 # filesystem to format
82 niro 1026 format="$(query_partition_disk_setup --filesystem ${partition})"
83 niro 773 # fi
84    
85 niro 1026 # do not print unkown disk with a size of 1
86     # these disks are containers for secondary partition types
87     if [[ ${fstype} = unknown ]] && [ ${size} -eq 1 ]
88     then
89     continue
90     fi
91    
92 niro 773 echo -n "|${partition}"
93     echo -n "|${size}"
94 niro 1026 echo -n "|${fstype}"
95 niro 773 echo -n "|${boot}"
96     echo -n "|${mountpoint}"
97     echo -n "|${format}"
98     echo
99    
100     done << EOF
101 niro 1026 $(get_hwinfo partition | grep ${disk})
102 niro 773 EOF
103     done

Properties

Name Value
svn:executable *