Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1021 - (hide annotations) (download) (as text)
Sun May 30 17:39:27 2010 UTC (13 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1415 byte(s)
-fixed header
-support for uuids
-fixed fstab handling
1 niro 773 #!/bin/bash
2 niro 1021 # $Id$
3 niro 773
4 niro 1021 source include/hwdetection.sh
5    
6 niro 773 : ${INSTALL_ROOT="/mnt/magellan"}
7     KNOWN_DISKS="ROOT BOOT SWAP HOME TMP USER VAR SVR OPT"
8    
9     # root device
10 niro 1021 sed -i "s:^/dev/ROOT.*:$(get_uuid ${PARTITION_DISK_ROOT})\t/\t\t${PARTITION_FS_ROOT}\t\tdefaults,noatime\t0 0:" ${INSTALL_ROOT}/etc/fstab
11 niro 773 # swap device
12 niro 1021 sed -i "s:^/dev/SWAP.*:$(get_uuid ${PARTITION_DISK_SWAP})\tswap\t\tswap\t\tpri=1\t\t\t0 0:" ${INSTALL_ROOT}/etc/fstab
13 niro 773
14     # boot
15     if [[ -z ${PARTITION_DISK_BOOT} ]]
16     then
17     # delete the entry
18     sed -i 's/\/dev\/ROOT.*/d' ${INSTALL_ROOT}/etc/fstab
19     else
20 niro 1021 sed -i "s:^/dev/BOOT.*:$(get_uuid ${PARTITION_DISK_BOOT})\t/boot\t\t${PARTITION_FS_BOOT}\t\tnoauto,noatime\t1 1:" ${INSTALL_ROOT}/etc/fstab
21 niro 773 fi
22    
23     # then all other
24     for disk in ${KNOWN_DISKS}
25     do
26     case ${disk} in
27     HOME) dest=/home ;;
28     TMP) dest=/tmp ;;
29     USER) dest=/usr ;;
30     VAR) dest=/var ;;
31     SVR) dest=/svr ;;
32     OPT) dest=/opt ;;
33     *) continue ;;
34     esac
35    
36     disk_part=$(eval echo \$PARTITION_DISK_${disk})
37 niro 1021 disk_uuid=$(get_uuid ${disk_part})
38 niro 773 disk_fs=$(eval echo \$PARTITION_FS_${disk})
39    
40     if [[ ! -z ${disk_part} ]]
41     then
42 niro 1021 if [[ -z $(grep [[:space:]]${dest}[[:space:]] ${INSTALL_ROOT}/etc/fstab) ]]
43 niro 773 then
44 niro 1021 echo "${disk_uuid}\t${dest}\t\t${disk_fs}\t\tdefaults,noatime\t0 0" >> ${INSTALL_ROOT}/etc/fstab
45 niro 773 else
46 niro 1021 sed -i "s:.*[[:space:]]${dest}[[:space:]].*:${disk_uuid}\t${dest}\t\t${disk_fs}\t\tdefaults,noatime\t0 0:" ${INSTALL_ROOT}/etc/fstab
47 niro 773 fi
48     fi
49     done

Properties

Name Value
svn:executable *