mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
scripts/unpack: common directory unpacking is not thread-safe
emby and emby4 both unzip into ${BUILD}/system, which is fun when both add-ons are being unpacked concurrently.
This commit is contained in:
parent
93f2479fe5
commit
cc9dfe5875
@ -52,24 +52,40 @@ fi
|
|||||||
if [ -d "$SOURCES/${PKG_NAME}" -o -d "$PKG_DIR/sources" ]; then
|
if [ -d "$SOURCES/${PKG_NAME}" -o -d "$PKG_DIR/sources" ]; then
|
||||||
build_msg "CLR_UNPACK" "UNPACK" "${PKG_NAME}" "indent"
|
build_msg "CLR_UNPACK" "UNPACK" "${PKG_NAME}" "indent"
|
||||||
|
|
||||||
|
# unpack into a unique location as unpacking into a single ${BUILD} directory is not thread-safe
|
||||||
|
PKG_UNPACK_DIR="${BUILD}/.unpack/${PKG_NAME}"
|
||||||
|
rm -fr "${PKG_UNPACK_DIR}"
|
||||||
|
mkdir -p "${PKG_UNPACK_DIR}"
|
||||||
|
|
||||||
pkg_call_exists pre_unpack && pkg_call pre_unpack
|
pkg_call_exists pre_unpack && pkg_call pre_unpack
|
||||||
|
|
||||||
if pkg_call_exists unpack; then
|
if pkg_call_exists unpack; then
|
||||||
pkg_call unpack
|
pkg_call unpack
|
||||||
else
|
else
|
||||||
if [ -n "$PKG_URL" ]; then
|
if [ -n "$PKG_URL" ]; then
|
||||||
$SCRIPTS/extract "${PKG_NAME}" $BUILD
|
${SCRIPTS}/extract "${PKG_NAME}" "${PKG_UNPACK_DIR}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$PKG_BUILD" ]; then
|
_pkg_build="$(basename "${PKG_BUILD}")"
|
||||||
if [ -n "$PKG_SOURCE_DIR" ]; then
|
[ -d "${PKG_UNPACK_DIR}/${_pkg_build}"* ] && mv "${PKG_UNPACK_DIR}/${_pkg_build}"* "${PKG_BUILD}"
|
||||||
mv $BUILD/$PKG_SOURCE_DIR "$PKG_BUILD"
|
|
||||||
elif [ -d "$PKG_BUILD"* ]; then
|
if [ ! -d "${PKG_BUILD}" ]; then
|
||||||
mv "$PKG_BUILD"* "$PKG_BUILD"
|
if [ -n "${PKG_SOURCE_DIR}" ]; then
|
||||||
|
if [ -d "${PKG_UNPACK_DIR}"/${PKG_SOURCE_DIR} ]; then
|
||||||
|
mv "${PKG_UNPACK_DIR}"/${PKG_SOURCE_DIR} "${PKG_BUILD}"
|
||||||
|
else
|
||||||
|
# fallback
|
||||||
|
mv "${BUILD}"/${PKG_SOURCE_DIR} "${PKG_BUILD}"
|
||||||
|
fi
|
||||||
|
elif [ -d "${PKG_BUILD}"* ]; then
|
||||||
|
mv "${PKG_BUILD}"* "${PKG_BUILD}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm -fr "${PKG_UNPACK_DIR}"
|
||||||
|
|
||||||
if [ -d "$PKG_DIR/sources" ]; then
|
if [ -d "$PKG_DIR/sources" ]; then
|
||||||
[ ! -d "$PKG_BUILD" ] && mkdir -p "$PKG_BUILD"
|
[ ! -d "$PKG_BUILD" ] && mkdir -p "$PKG_BUILD"
|
||||||
cp -PRf "$PKG_DIR/sources/"* "$PKG_BUILD"
|
cp -PRf "$PKG_DIR/sources/"* "$PKG_BUILD"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user