2013-07-19 00:35:52 +00:00
|
|
|
#!/bin/bash
|
2011-01-09 22:32:01 +00:00
|
|
|
|
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)
|
2018-09-08 19:41:33 +00:00
|
|
|
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2018-12-18 03:43:28 +00:00
|
|
|
. config/options "$1"
|
2009-03-18 12:02:53 +00:00
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2019-02-08 17:17:43 +00:00
|
|
|
die "usage: $0 package_name [parent_pkg]"
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-18 03:43:28 +00:00
|
|
|
if [ -z "${PKG_NAME}" ]; then
|
|
|
|
die "$(print_color CLR_ERROR "${1}: no package.mk file found")"
|
|
|
|
fi
|
|
|
|
|
2013-07-12 12:37:01 +00:00
|
|
|
if [ -z "$INSTALL" ] ; then
|
2018-11-03 23:57:34 +00:00
|
|
|
die "error: '\$INSTALL' not set! this script is not intended to be run manually"
|
2013-07-12 12:37:01 +00:00
|
|
|
fi
|
2013-12-15 23:13:15 +00:00
|
|
|
|
2018-12-18 03:43:28 +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
|
|
|
|
|
2013-12-15 23:13:15 +00:00
|
|
|
# set defaults
|
2017-10-09 04:25:52 +00:00
|
|
|
if [ "${1//:/}" != "${1}" ]; then
|
|
|
|
TARGET="${1#*:}"
|
|
|
|
else
|
|
|
|
TARGET=
|
2015-08-03 12:53:32 +00:00
|
|
|
fi
|
2017-10-09 04:25:52 +00:00
|
|
|
[ -z "$TARGET" ] && TARGET="target"
|
2019-02-08 17:17:43 +00:00
|
|
|
PARENT_PKG="${2:-${PKG_NAME}:${TARGET}}"
|
|
|
|
|
2019-06-16 00:13:39 +00:00
|
|
|
pkg_lock "${PKG_NAME}:${TARGET}" "install" "${PARENT_PKG}"
|
2013-12-15 23:13:15 +00:00
|
|
|
|
2019-06-16 00:13:39 +00:00
|
|
|
STAMP=$STAMPS_INSTALL/$PKG_NAME/install_$TARGET
|
|
|
|
[ -f $STAMP ] && pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "install" "already installed"
|
2015-08-03 12:55:11 +00:00
|
|
|
[ -f $STAMP ] && exit 0
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2019-06-16 00:13:39 +00:00
|
|
|
mkdir -p $STAMPS_INSTALL/$PKG_NAME
|
2014-01-27 02:34:44 +00:00
|
|
|
|
2019-02-08 17:17:43 +00:00
|
|
|
$SCRIPTS/build "${1}" "${PARENT_PKG}"
|
2013-07-17 04:12:14 +00:00
|
|
|
|
2013-12-15 23:13:15 +00:00
|
|
|
if [ "$TARGET" = target ] ; then
|
2014-02-04 19:44:18 +00:00
|
|
|
for p in $PKG_DEPENDS_TARGET; do
|
2019-02-08 17:17:43 +00:00
|
|
|
$SCRIPTS/install "${p}" "${PARENT_PKG}"
|
2013-12-15 23:13:15 +00:00
|
|
|
done
|
|
|
|
elif [ "$TARGET" = init ] ; then
|
2014-02-04 19:44:18 +00:00
|
|
|
for p in $PKG_DEPENDS_INIT; do
|
2019-02-08 17:17:43 +00:00
|
|
|
$SCRIPTS/install "${p}" "${PARENT_PKG}"
|
2013-12-15 23:13:15 +00:00
|
|
|
done
|
|
|
|
INSTALL=$BUILD/initramfs
|
2013-08-04 14:47:51 +00:00
|
|
|
fi
|
|
|
|
|
2019-06-16 00:13:39 +00:00
|
|
|
pkg_lock_status "ACTIVE" "${PKG_NAME}:${TARGET}" "install"
|
2019-02-08 17:17:43 +00:00
|
|
|
|
2019-06-16 00:13:39 +00:00
|
|
|
build_msg "CLR_INSTALL" "INSTALL" "${PKG_NAME} $(print_color CLR_TARGET "(${TARGET})")" "indent"
|
2018-12-18 03:43:28 +00:00
|
|
|
|
2013-12-15 23:13:15 +00:00
|
|
|
mkdir -p $INSTALL
|
|
|
|
|
|
|
|
if [ "$TARGET" = target ] ; then
|
2018-09-08 19:41:33 +00:00
|
|
|
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/*.conf $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/*.conf $INSTALL/usr/lib/tmpfiles.d
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d $PKG_TMP_DIR/system.d ]; then
|
|
|
|
mkdir -p $INSTALL/usr/lib/systemd/system
|
|
|
|
cp $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/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
|
2013-08-18 12:09:30 +00:00
|
|
|
fi
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
# install
|
2015-08-03 12:53:32 +00:00
|
|
|
if [ "$TARGET" = target ] ; then
|
2019-01-21 13:15:11 +00:00
|
|
|
pkg_call_exists pre_install && pkg_call pre_install
|
2015-08-03 12:53:32 +00:00
|
|
|
fi
|
2014-01-27 02:34:44 +00:00
|
|
|
|
2015-08-03 12:53:32 +00:00
|
|
|
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
|
2014-01-27 02:34:44 +00:00
|
|
|
|
2015-08-03 12:53:32 +00:00
|
|
|
if [ "$TARGET" = target ] ; then
|
2019-01-21 13:15:11 +00:00
|
|
|
pkg_call_exists post_install && pkg_call post_install
|
2015-08-03 12:53:32 +00:00
|
|
|
fi
|
2013-07-17 04:12:14 +00:00
|
|
|
|
2015-08-03 12:53:32 +00:00
|
|
|
touch $STAMP
|
2019-02-08 17:17:43 +00:00
|
|
|
|
2019-06-16 00:13:39 +00:00
|
|
|
pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "install" "installed"
|