summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs')
-rwxr-xr-xmeta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs67
1 files changed, 67 insertions, 0 deletions
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
new file mode 100755
index 0000000000..d1a595b268
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
@@ -0,0 +1,67 @@
1#!/bin/bash
2
3# Yocto ADT Installer
4#
5# Copyright 2010-2011 by Intel Corp.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24
25extract_rootfs()
26{
27
28 native_sysroot=$3
29 target_sysroot=$2
30 PSEUDO_COMMAND="$native_sysroot/usr/bin/pseudo"
31 TAR_OPTS="-xjf"
32 PSEUDO_OPTS="-P $native_sysroot/usr"
33
34
35 rm -rf $PSEUDO_LOCALSTATEDIR
36
37 if [ -d "$target_sysroot" ]; then
38 echo_info "\nTarget sysroot location: $target_sysroot, already exists! If you continue installation, this folder will be re-created."
39 confirm_install $4
40 rm -rf "$target_sysroot"
41 fi
42
43 if [ ! -d "$target_sysroot" ]; then
44 echo_info "Creating directory $target_sysroot..."
45 mkdir -p "$target_sysroot"
46 fi
47
48 pseudo_state_dir="$target_sysroot/../$(basename "$target_sysroot").pseudo_state"
49 mkdir -p "$pseudo_state_dir"
50 touch "$pseudo_state_dir/pseudo.pid"
51 PSEUDO_LOCALSTATEDIR="$pseudo_state_dir"
52 export PSEUDO_LOCALSTATEDIR
53
54 echo_info "Extracting rootfs: $1, using pseudo..."
55 $PSEUDO_COMMAND $PSEUDO_OPTS tar -C $2 "$TAR_OPTS" $LOCAL_DOWNLOAD/$1 &>> $YOCTOADT_INSTALL_LOG_FILE
56 check_result
57}
58
59#Main part
60. scripts/util
61
62#Parameter detail is listed below:
63#Param 4: Silent install or customize install
64#Param 3: OECORE_NATIVE_SYSROOT
65#Param 2: user defined rootfs extraction directory
66#param 1: sysroot image name
67extract_rootfs $1 $2 $3 $4