Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1060 - (show 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 #!/bin/bash
2 # $Id$
3
4 source /etc/installer.conf
5 source ${INSTALLER_DIR}/include/hwdetection.sh
6
7 : ${INSTALL_ROOT="/mnt/magellan"}
8 KNOWN_DISKS="ROOT BOOT SWAP HOME TMP USER VAR SVR OPT"
9
10 # root device
11 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 # swap device
13 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
15 # boot
16 if [[ -z ${PARTITION_DISK_BOOT} ]]
17 then
18 # delete the entry
19 sed -i '/^\/dev\/BOOT.*/d' ${INSTALL_ROOT}/etc/fstab
20 else
21 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 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 disk_uuid=$(get_uuid ${disk_part})
39 disk_fs=$(eval echo \$PARTITION_FS_${disk})
40
41 if [[ ! -z ${disk_part} ]]
42 then
43 if [[ -z $(grep [[:space:]]${dest}[[:space:]] ${INSTALL_ROOT}/etc/fstab) ]]
44 then
45 echo "UUID=${disk_uuid}\t${dest}\t\t${disk_fs}\t\tdefaults,noatime\t0 0" >> ${INSTALL_ROOT}/etc/fstab
46 else
47 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 fi
49 fi
50 done

Properties

Name Value
svn:executable *