Skip to content

Commit

Permalink
various apk related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowrt committed Feb 6, 2024
1 parent d340b09 commit bcbe380
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ opkg_target = \
$(call opkg,$(mkfs_cur_target_dir)) \
-f $(mkfs_cur_target_dir).conf

apk_target = $(call apk,$(mkfs_cur_target_dir))
apk_target = $(call apk,$(mkfs_cur_target_dir)) --no-scripts


target-dir-%: FORCE
ifdef CONFIG_USE_APK
Expand Down
3 changes: 1 addition & 2 deletions include/rootfs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ apk = \
--keys-dir $(TOPDIR) \
--no-cache \
--no-logfile \
--no-scripts \
--preserve-env \
--repository file://$(PACKAGE_DIR_ALL)/packages.adb

Expand Down Expand Up @@ -92,6 +91,7 @@ define prepare_rootfs
exit 1; \
fi; \
done; \
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status); \
fi; \
for script in ./etc/init.d/*; do \
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
Expand All @@ -103,7 +103,6 @@ define prepare_rootfs
echo "Disabling" $$(basename $$script); \
fi; \
done || true \
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status)
)

@-find $(1) -name CVS -o -name .svn -o -name .git -o -name '.#*' | $(XARGS) rm -rf
Expand Down
3 changes: 1 addition & 2 deletions package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(curdir)/merge-index
ifneq ($(CONFIG_USE_APK),)
$(file >$(TMP_DIR)/apk_install_list,\
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))

$(call apk,$(TARGET_DIR)) add --initdb --arch $(ARCH_PACKAGES) $$(cat $(TMP_DIR)/apk_install_list)
$(call apk,$(TARGET_DIR)) add --no-scripts --initdb --arch $(ARCH_PACKAGES) $$(cat $(TMP_DIR)/apk_install_list)
else
$(file >$(TMP_DIR)/opkg_install_list,\
$(call opkg_package_files,\
Expand Down
9 changes: 7 additions & 2 deletions package/base-files/files/lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ config_list_foreach() {
}

default_prerm() {
update_alternatives remove
local root="${IPKG_INSTROOT}"
local pkgname="$(basename ${1%.*})"
local ret=0

update_alternatives remove "$pkgname"

local shell="$(command -v bash)"
for i in $(grep -s "^/etc/init.d/" "$root/lib/apk/packages/${pkgname}.list"); do
Expand Down Expand Up @@ -258,6 +262,7 @@ add_group_and_user() {

update_alternatives() {
local action="$1"
local pkgname="$2"

if [ -f "$root/lib/apk/packages/${pkgname}.alternatives" ]; then
for pkg_alt in $(cat $root/lib/apk/packages/${pkgname}.alternatives); do
Expand Down Expand Up @@ -314,7 +319,7 @@ default_postinst() {
add_group_and_user "${pkgname}"
else
filelist="${root}/lib/apk/packages/${pkgname}.list"
update_alternatives install
update_alternatives install "${pkgname}"
fi

if [ -d "$root/rootfs-overlay" ]; then
Expand Down

0 comments on commit bcbe380

Please sign in to comment.