Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1021 - (show 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 #!/bin/bash
2 # $Id$
3
4 source include/hwdetection.sh
5
6 : ${INSTALL_ROOT="/mnt/magellan"}
7 KNOWN_DISKS="ROOT BOOT SWAP HOME TMP USER VAR SVR OPT"
8
9 # root device
10 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 # swap device
12 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
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 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 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 disk_uuid=$(get_uuid ${disk_part})
38 disk_fs=$(eval echo \$PARTITION_FS_${disk})
39
40 if [[ ! -z ${disk_part} ]]
41 then
42 if [[ -z $(grep [[:space:]]${dest}[[:space:]] ${INSTALL_ROOT}/etc/fstab) ]]
43 then
44 echo "${disk_uuid}\t${dest}\t\t${disk_fs}\t\tdefaults,noatime\t0 0" >> ${INSTALL_ROOT}/etc/fstab
45 else
46 sed -i "s:.*[[:space:]]${dest}[[:space:]].*:${disk_uuid}\t${dest}\t\t${disk_fs}\t\tdefaults,noatime\t0 0:" ${INSTALL_ROOT}/etc/fstab
47 fi
48 fi
49 done

Properties

Name Value
svn:executable *