Skip to content

Commit 28cd59b

Browse files
committed
hack_pkg_conflicts: do not execute on buildroot
1 parent be97b56 commit 28cd59b

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ This file can also be used to include a list of extra packages which will be inc
2323
### hack_pkg_conflicts (imagebuilder)
2424
Define a list of packages to be removed in PKG_CONFLICTS.
2525
Include then the `preinst` defined in `hack_pkg_conflicts.mk` to do the package removal, like in the example below:
26-
Warn: To use it with asu, the server must support this hack.
27-
Warn: To use it with the firmware-selector (by now) be sure to include the profile as first in the package's list.
26+
Warn: To use it with asu, the server must support this hack.
2827
```
2928
include $(TOPDIR)/rules.mk
3029

hack_pkg_conflicts.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PKG_NAME:=profile-$(PROFILE_COMMUNITY)-$(PROFILE_NAME)
88
define Package/$(PKG_NAME)/preinst
99
#!/bin/sh
1010
[ -z "$${IPKG_INSTROOT}" ] && exit 0
11+
[ -f "$${TOPDIR}/version" ] && exit 0
1112
echo "########################################################################## Inside package $(PKG_NAME) preinst"
1213
grep -q IB_MODIFIED_BY_$(PKG_NAME) $${TOPDIR}/Makefile && exit 0
1314
echo "########################################################################## Backup original Makefile"
@@ -25,7 +26,7 @@ echo "##########################################################################
2526
need_run=0
2627
for p in $(PKG_CONFLICTS); do
2728
i=$$(echo $$p | sed 's|-||')
28-
echo "Verifing the removal of package: $${i}"
29+
echo "Verifying the removal of package: $${i}"
2930
present=$$(echo $$build_packages | sed 's|\s|\n|g' | grep $$i | grep -v "\-$$i" )
3031
removed=$$(echo $$build_packages | sed 's|\s|\n|g' | grep "\-$$i")
3132
if [ -n "$${removed}" ]; then
@@ -41,12 +42,13 @@ for p in $(PKG_CONFLICTS); do
4142
done
4243
if [ $${need_run} = 0 ]; then
4344
echo "Continue build without hack"
45+
rm /tmp/hack_pkg_conflicts $${TOPDIR}/Makefile.orig
4446
cp $${TOPDIR}/Makefile.orig $${TOPDIR}/Makefile
4547
exit 0
4648
fi
4749
echo "########################################################################## Determine make's target"
48-
R=$$(for cmd in $$(ls -l /proc/*/exe | grep make | sed 's|.*/proc/\(.*\)/exe.*|\1|' | tr '\n' ' ' | tr -d '\0' ) ; do cat "/proc/$${cmd}/cmdline"; done)
49-
make_target=$$(echo "$${R}" | grep -q makemanifest && echo 'manifest' || echo 'image')
50+
cmdline_args=$$(for cmd in $$(ls -l /proc/*/exe | grep make | sed 's|.*/proc/\(.*\)/exe.*|\1|' | tr '\n' ' ' | tr -d '\0' ) ; do cat "/proc/$${cmd}/cmdline"; done)
51+
make_target=$$(echo "$${cmdline_args}" | grep -q makemanifest && echo 'manifest' || echo 'image')
5052
echo "make_target: $${make_target}"
5153
echo "########################################################################## Add PKG_CONFLICTS to be removed in the main Makefile"
5254
sed -i 's|\($$(USER_PACKAGES)\) \($$(BUILD_PACKAGES)\)|\1 $(PKG_CONFLICTS) \2|' $${TOPDIR}/Makefile

0 commit comments

Comments
 (0)