forked from OpenELEC/OpenELEC.tv
-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathuninstall
executable file
·105 lines (87 loc) · 3.34 KB
/
uninstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2016 Stephan Raue ([email protected])
#
# OpenELEC 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.
#
# OpenELEC 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 OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. config/options $1
if [ -z "$1" ]; then
echo "usage: $0 package_name[:<host|target|init|bootstrap>]"
exit 1
fi
PACKAGE_NAME=$(echo $1 | awk -F : '{print $1}')
TARGET=$(echo $1 | awk -F : '{print $2}')
if [ -z "$TARGET" ]; then
TARGET="target"
fi
if [ -n "$PKG_ARCH" -a ! "$PKG_ARCH" = "any" ]; then
echo "$PKG_ARCH" | grep -q "$TARGET_ARCH" || exit 0
echo "$PKG_ARCH" | grep -q "\-$TARGET_ARCH" && exit 0
fi
STAMP=$STAMPS/$PACKAGE_NAME/build_$TARGET
if [ -f $STAMP ]; then
# include buildfile
. $PKG_DIR/package.mk
# virtual packages dont must be build, they only contains dependencies, so dont go further here
if [ ! "$PKG_SECTION" = "virtual" ]; then
# setup configure script
if [ -z "$PKG_CONFIGURE_SCRIPT" ]; then
PKG_CONFIGURE_SCRIPT="$ROOT/$PKG_BUILD/configure"
else
PKG_CONFIGURE_SCRIPT="$ROOT/$PKG_BUILD/$PKG_CONFIGURE_SCRIPT"
fi
if [ -z "$PKG_CMAKE_SCRIPT" ]; then
PKG_CMAKE_SCRIPT="$ROOT/$PKG_BUILD/CMakeLists.txt"
else
PKG_CMAKE_SCRIPT="$ROOT/$PKG_BUILD/$PKG_CMAKE_SCRIPT"
fi
# ensure $PKG_BUILD is there. (installer? PKG_URL="")
if [ ! -d $PKG_BUILD ] ; then
exit 0
fi
cd $PKG_BUILD
if [ "$TARGET" = "target" ]; then
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
cd .$TARGET_NAME
fi
elif [ "$TARGET" = "host" ]; then
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
cd .$HOST_NAME
fi
elif [ "$TARGET" = "init" ]; then
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
cd .$TARGET_NAME-init
fi
elif [ "$TARGET" = "bootstrap" ]; then
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
cd .$TARGET_NAME-bootstrap
fi
fi
MAKEUNINSTALL="$ROOT/$TOOLCHAIN/bin/make -j1 DESTDIR=$SYSROOT_PREFIX uninstall"
if [ "$TARGET" = "target" ]; then
$MAKEUNINSTALL $PKG_MAKEINSTALL_OPTS_TARGET
elif [ "$TARGET" = "host" ]; then
make uninstall $PKG_MAKEINSTALL_OPTS_HOST
elif [ "$TARGET" = "init" ]; then
make uninstall DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_INIT
elif [ "$TARGET" = "bootstrap" ]; then
$MAKEUNINSTALL $PKG_MAKEINSTALL_OPTS_BOOTSTRAP
fi
cd $ROOT
fi # ! "$PKG_SECTION" = "virtual"
if [ -f "$STAMP" ]; then
rm -f $STAMP
fi
fi