-
Notifications
You must be signed in to change notification settings - Fork 80
/
install
executable file
·169 lines (132 loc) · 5.02 KB
/
install
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv)
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
. config/options "${1}"
if [ -z "${1}" ]; then
die "usage: ${0} package_name [parent_pkg]"
fi
# Skip excluded packages
listcontains "${EXCLUDE_PKGS}" "${PKG_NAME}" && {
echo "Skipping ${PKG_NAME} it's listed in EXCLUDE_PKGS"
exit 0
}
if [ -z "${PKG_NAME}" ]; then
die "$(print_color CLR_ERROR "${1}: no package.mk file found")"
fi
if [ -z "${INSTALL}" ] ; then
die "error: '\${INSTALL}' not set! this script is not intended to be run manually"
fi
if [ -n "${PKG_ARCH}" ]; then
listcontains "${PKG_ARCH}" "!${TARGET_ARCH}" && exit 0
listcontains "${PKG_ARCH}" "${TARGET_ARCH}" || listcontains "${PKG_ARCH}" "any" || exit 0
fi
# set defaults
if [ "${1//:/}" != "${1}" ]; then
TARGET="${1#*:}"
else
TARGET=
fi
[ -z "${TARGET}" ] && TARGET="target"
PARENT_PKG="${2:-${PKG_NAME}:${TARGET}}"
pkg_lock "${PKG_NAME}:${TARGET}" "install" "${PARENT_PKG}"
STAMP=${STAMPS_INSTALL}/${PKG_NAME}/install_${TARGET}
if [ -f ${STAMP} ]; then
pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "install" "already installed"
exit 0
fi
mkdir -p ${STAMPS_INSTALL}/${PKG_NAME}
${SCRIPTS}/build "${1}" "${PARENT_PKG}"
if [ "${TARGET}" = "target" ] ; then
for p in ${PKG_DEPENDS_TARGET}; do
${SCRIPTS}/install "${p}" "${PARENT_PKG}"
done
elif [ "${TARGET}" = "init" ] ; then
for p in ${PKG_DEPENDS_INIT}; do
${SCRIPTS}/install "${p}" "${PARENT_PKG}"
done
INSTALL=${BUILD}/initramfs
fi
pkg_lock_status "ACTIVE" "${PKG_NAME}:${TARGET}" "install"
build_msg "CLR_INSTALL" "INSTALL" "${PKG_NAME} $(print_color CLR_TARGET "(${TARGET})")" "indent"
mkdir -p ${INSTALL}
if [ "${TARGET}" = "target" ] ; then
for PKG_TMP_DIR in ${PKG_DIR} \
${PROJECT_DIR}/${PROJECT}/packages/${PKG_NAME} \
${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/${PKG_NAME} \
; do
[ -d ${PKG_TMP_DIR} ] || continue
if [ -d ${PKG_TMP_DIR}/profile.d ]; then
mkdir -p ${INSTALL}/etc/profile.d
cp ${PKG_TMP_DIR}/profile.d/* ${INSTALL}/etc/profile.d
fi
if [ -d ${PKG_TMP_DIR}/tmpfiles.d ]; then
mkdir -p ${INSTALL}/usr/lib/tmpfiles.d
cp ${PKG_TMP_DIR}/tmpfiles.d/* ${INSTALL}/usr/lib/tmpfiles.d
fi
if [ -d ${PKG_TMP_DIR}/autostart ]; then
mkdir -p ${INSTALL}/usr/lib/autostart/common
cp ${PKG_TMP_DIR}/autostart/* ${INSTALL}/usr/lib/autostart/common
chmod 0755 ${INSTALL}/usr/lib/autostart/common/*
fi
if [ -d ${PKG_TMP_DIR}/daemons ]; then
mkdir -p ${INSTALL}/usr/lib/autostart/daemons
cp ${PKG_TMP_DIR}/daemons/* ${INSTALL}/usr/lib/autostart/daemons
fi
if [ -d ${PKG_TMP_DIR}/system.d ]; then
mkdir -p ${INSTALL}/usr/lib/systemd/system
cp -Pr ${PKG_TMP_DIR}/system.d/*.* ${INSTALL}/usr/lib/systemd/system
fi
if [ -d ${PKG_TMP_DIR}/udev.d ]; then
mkdir -p ${INSTALL}/usr/lib/udev/rules.d
cp ${PKG_TMP_DIR}/udev.d/*.rules ${INSTALL}/usr/lib/udev/rules.d
fi
if [ -d ${PKG_TMP_DIR}/hwdb.d ]; then
mkdir -p ${INSTALL}/usr/lib/udev/hwdb.d
cp ${PKG_TMP_DIR}/hwdb.d/*.hwdb ${INSTALL}/usr/lib/udev/hwdb.d
fi
if [ -d ${PKG_TMP_DIR}/sleep.d ]; then
mkdir -p ${INSTALL}/usr/lib/systemd/system-sleep
cp ${PKG_TMP_DIR}/sleep.d/* ${INSTALL}/usr/lib/systemd/system-sleep
fi
if [ -d ${PKG_TMP_DIR}/sleep.d.serial ]; then
mkdir -p ${INSTALL}/usr/lib/systemd/system-sleep.serial
cp ${PKG_TMP_DIR}/sleep.d.serial/* ${INSTALL}/usr/lib/systemd/system-sleep.serial
fi
if [ -d ${PKG_TMP_DIR}/sysctl.d ]; then
mkdir -p ${INSTALL}/usr/lib/sysctl.d
cp ${PKG_TMP_DIR}/sysctl.d/*.conf ${INSTALL}/usr/lib/sysctl.d
fi
if [ -d ${PKG_TMP_DIR}/modules-load.d ]; then
mkdir -p ${INSTALL}/usr/lib/modules-load.d
cp ${PKG_TMP_DIR}/modules-load.d/*.conf ${INSTALL}/usr/lib/modules-load.d
fi
if [ -d ${PKG_TMP_DIR}/sysconf.d ]; then
mkdir -p ${INSTALL}/etc/sysconf.d
cp ${PKG_TMP_DIR}/sysconf.d/*.conf ${INSTALL}/etc/sysconf.d
fi
if [ -d ${PKG_TMP_DIR}/debug.d ]; then
mkdir -p ${INSTALL}/usr/share/debugconf
cp ${PKG_TMP_DIR}/debug.d/*.conf ${INSTALL}/usr/share/debugconf
fi
if [ -d ${PKG_TMP_DIR}/modprobe.d ]; then
mkdir -p ${INSTALL}/usr/lib/modprobe.d
cp ${PKG_TMP_DIR}/modprobe.d/*.conf ${INSTALL}/usr/lib/modprobe.d
fi
done
fi
# install
if [ "${TARGET}" = "target" ] ; then
pkg_call_exists pre_install && pkg_call pre_install
fi
if [ "${TARGET}" = "target" -a -d ${PKG_BUILD}/.install_pkg ]; then
cp -PR ${PKG_BUILD}/.install_pkg/* ${INSTALL}
elif [ "${TARGET}" = "init" -a -d ${PKG_BUILD}/.install_init ]; then
cp -PR ${PKG_BUILD}/.install_init/* ${INSTALL}
fi
if [ "${TARGET}" = "target" ] ; then
pkg_call_exists post_install && pkg_call post_install
fi
touch ${STAMP}
pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "install" "installed"