Lakka-LibreELEC/scripts/install

181 lines
5.1 KiB
Plaintext
Raw Normal View History

#!/bin/bash
2018-07-16 18:45:36 +00:00
# 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)
2009-03-18 12:02:53 +00:00
2019-06-16 01:45:52 +00:00
. config/options "${1}"
2009-03-18 12:02:53 +00:00
2019-06-16 01:45:52 +00:00
if [ -z "${1}" ]; then
die "usage: ${0} package_name [parent_pkg]"
2009-03-18 12:02:53 +00:00
fi
if [ -z "${PKG_NAME}" ]; then
die "$(print_color CLR_ERROR "${1}: no package.mk file found")"
fi
2019-06-16 01:45:52 +00:00
if [ -z "${INSTALL}" ] ; then
die "error: '\${INSTALL}' not set! this script is not intended to be run manually"
fi
2019-06-16 01:45:52 +00:00
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=
2015-08-03 12:53:32 +00:00
fi
2019-06-16 01:45:52 +00:00
[ -z "${TARGET}" ] && TARGET="target"
PARENT_PKG="${2:-${PKG_NAME}:${TARGET}}"
pkg_lock "${PKG_NAME}:${TARGET}" "install" "${PARENT_PKG}"
2019-06-16 01:45:52 +00:00
STAMP=${STAMPS_INSTALL}/${PKG_NAME}/install_${TARGET}
if [ -f ${STAMP} ]; then
pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "install" "already installed"
exit 0
fi
2009-03-18 12:02:53 +00:00
2019-06-16 01:45:52 +00:00
mkdir -p ${STAMPS_INSTALL}/${PKG_NAME}
2019-06-16 01:45:52 +00:00
${SCRIPTS}/build "${1}" "${PARENT_PKG}"
if is_sequential_build || [ "${PARENT_PKG}" = "initramfs:target" ]; then
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
fi
fi
if [ "${TARGET}" = "init" ] ; then
2019-06-16 01:45:52 +00:00
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"
2022-06-28 19:44:17 +00:00
print_qa_checks
acquire_update_lock image
2019-06-16 01:45:52 +00:00
mkdir -p ${INSTALL}
if [ "${TARGET}" = "target" ] ; then
2019-06-16 01:45:52 +00:00
for PKG_TMP_DIR in ${PKG_DIR} \
${PROJECT_DIR}/${PROJECT}/packages/${PKG_NAME} \
${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/${PKG_NAME} \
; do
2019-06-16 01:45:52 +00:00
[ -d ${PKG_TMP_DIR} ] || continue
2019-06-16 01:45:52 +00:00
if [ -d ${PKG_TMP_DIR}/profile.d ]; then
mkdir -p ${INSTALL}/etc/profile.d
cp ${PKG_TMP_DIR}/profile.d/*.conf ${INSTALL}/etc/profile.d
fi
2019-06-16 01:45:52 +00:00
if [ -d ${PKG_TMP_DIR}/tmpfiles.d ]; then
mkdir -p ${INSTALL}/usr/lib/tmpfiles.d
cp ${PKG_TMP_DIR}/tmpfiles.d/*.conf ${INSTALL}/usr/lib/tmpfiles.d
fi
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2019-06-16 01:45:52 +00:00
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
2020-02-13 11:44:31 +00:00
pkg_call_exists_opt pre_install && pkg_call
2015-08-03 12:53:32 +00:00
fi
if [ -n "${PKG_INSTALL}" -a -d "${PKG_INSTALL}" ]; then
tar \
-C "${PKG_INSTALL}" \
--exclude=./usr/local/include \
--exclude=./usr/local/lib/cmake \
--exclude=./usr/local/lib/pkgconfig \
--exclude=./usr/local/share/aclocal \
--exclude=./usr/local/share/pkgconfig \
--exclude=./usr/include \
--exclude=./usr/lib/cmake \
--exclude=./usr/lib/pkgconfig \
--exclude=./usr/share/aclocal \
--exclude=./usr/share/pkgconfig \
--exclude=./include \
--exclude=./lib/cmake \
--exclude=./lib/pkgconfig \
--exclude=./share/aclocal \
--exclude=./share/pkgconfig \
--exclude=./.* \
--exclude='*.a' \
--exclude='*.la' \
-cf - . | tar -C "${INSTALL}" -xf -
2015-08-03 12:53:32 +00:00
fi
if [ "${TARGET}" = "target" ] ; then
2020-02-13 11:44:31 +00:00
pkg_call_exists_opt post_install && pkg_call
2015-08-03 12:53:32 +00:00
fi
release_update_lock
2019-06-16 01:45:52 +00:00
touch ${STAMP}
pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "install" "installed"