root / snf-image-helper / tasks / 30MountImage.in @ 10bf026d
History | View | Annotate | Download (1.4 kB)
1 | 0a35a4ab | Nikos Skalkotos | #! /bin/bash |
---|---|---|---|
2 | c349d1b3 | Nikos Skalkotos | |
3 | 7e5d635b | Nikos Skalkotos | # Copyright (C) 2011 GRNET S.A. |
4 | 7e5d635b | Nikos Skalkotos | # |
5 | 7e5d635b | Nikos Skalkotos | # This program is free software; you can redistribute it and/or modify |
6 | 7e5d635b | Nikos Skalkotos | # it under the terms of the GNU General Public License as published by |
7 | 7e5d635b | Nikos Skalkotos | # the Free Software Foundation; either version 2 of the License, or |
8 | 7e5d635b | Nikos Skalkotos | # (at your option) any later version. |
9 | 7e5d635b | Nikos Skalkotos | # |
10 | 7e5d635b | Nikos Skalkotos | # This program is distributed in the hope that it will be useful, but |
11 | 7e5d635b | Nikos Skalkotos | # WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 7e5d635b | Nikos Skalkotos | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | 7e5d635b | Nikos Skalkotos | # General Public License for more details. |
14 | 7e5d635b | Nikos Skalkotos | # |
15 | 7e5d635b | Nikos Skalkotos | # You should have received a copy of the GNU General Public License |
16 | 7e5d635b | Nikos Skalkotos | # along with this program; if not, write to the Free Software |
17 | 7e5d635b | Nikos Skalkotos | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | 7e5d635b | Nikos Skalkotos | # 02110-1301, USA. |
19 | 7e5d635b | Nikos Skalkotos | |
20 | c349d1b3 | Nikos Skalkotos | ### BEGIN TASK INFO |
21 | c349d1b3 | Nikos Skalkotos | # Provides: MountImage |
22 | c349d1b3 | Nikos Skalkotos | # RunBefore: UmountImage |
23 | c349d1b3 | Nikos Skalkotos | # Short-Description: Mount the partition that hosts the image |
24 | 6a95db10 | Vangelis Koukis | ### END TASK INFO |
25 | c349d1b3 | Nikos Skalkotos | |
26 | c349d1b3 | Nikos Skalkotos | set -e |
27 | bad5ca1f | Nikos Skalkotos | . "@commondir@/common.sh" |
28 | c349d1b3 | Nikos Skalkotos | |
29 | 8704ee47 | Nikos Skalkotos | if [ ! -d "$SNF_IMAGE_TARGET" ]; then |
30 | 8704ee47 | Nikos Skalkotos | log_error "Target dir:\`$SNF_IMAGE_TARGET' is missing" |
31 | c349d1b3 | Nikos Skalkotos | fi |
32 | c349d1b3 | Nikos Skalkotos | |
33 | 27acc2e4 | Nikos Skalkotos | if [ -z "$SNF_IMAGE_PROPERTY_ROOT_PARTITION" ]; then |
34 | 27acc2e4 | Nikos Skalkotos | log_error "Root Partition image property not defined" |
35 | c349d1b3 | Nikos Skalkotos | fi |
36 | c349d1b3 | Nikos Skalkotos | |
37 | 27acc2e4 | Nikos Skalkotos | rootdev="${SNF_IMAGE_DEV}${SNF_IMAGE_PROPERTY_ROOT_PARTITION}" |
38 | 27acc2e4 | Nikos Skalkotos | |
39 | 27acc2e4 | Nikos Skalkotos | if [ ! -b "$rootdev" ]; then |
40 | 27acc2e4 | Nikos Skalkotos | log_error "Image root partition device:\`$rootdev' is not a block device" |
41 | 27acc2e4 | Nikos Skalkotos | fi |
42 | 27acc2e4 | Nikos Skalkotos | |
43 | 27acc2e4 | Nikos Skalkotos | mount "$rootdev" "$SNF_IMAGE_TARGET" -o rw |
44 | c349d1b3 | Nikos Skalkotos | |
45 | c349d1b3 | Nikos Skalkotos | exit 0 |
46 | 5d3735b5 | Nikos Skalkotos | |
47 | c349d1b3 | Nikos Skalkotos | # vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |