30MountImage.in 1.4 KB
Newer Older
1
#! /bin/bash
Nikos Skalkotos's avatar
Nikos Skalkotos committed
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (C) 2011 GRNET S.A. 
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.

Nikos Skalkotos's avatar
Nikos Skalkotos committed
20
21
22
23
### BEGIN TASK INFO
# Provides:		MountImage
# RunBefore:		UmountImage
# Short-Description:	Mount the partition that hosts the image
24
### END TASK INFO
Nikos Skalkotos's avatar
Nikos Skalkotos committed
25
26

set -e
27
. "@commondir@/common.sh"
Nikos Skalkotos's avatar
Nikos Skalkotos committed
28

29
30
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
    log_error "Target dir:\`$SNF_IMAGE_TARGET' is missing"
Nikos Skalkotos's avatar
Nikos Skalkotos committed
31
32
fi

33
34
if [ -z "$SNF_IMAGE_PROPERTY_ROOT_PARTITION" ]; then
    log_error "Root Partition image property not defined"
Nikos Skalkotos's avatar
Nikos Skalkotos committed
35
36
fi

37
38
39
40
41
42
43
rootdev="${SNF_IMAGE_DEV}${SNF_IMAGE_PROPERTY_ROOT_PARTITION}"

if [ ! -b "$rootdev" ]; then
    log_error "Image root partition device:\`$rootdev' is not a block device"
fi

mount "$rootdev" "$SNF_IMAGE_TARGET" -o rw
Nikos Skalkotos's avatar
Nikos Skalkotos committed
44
45

exit 0
46

Nikos Skalkotos's avatar
Nikos Skalkotos committed
47
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :