Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1060 - (hide annotations) (download) (as text)
Mon May 31 20:59:48 2010 UTC (13 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1484 byte(s)
-fixed a typo in sed command

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

Properties

Name Value
svn:executable *