Skip to content

Commit

Permalink
Install ALPINE_BASE_PKGS first if requested
Browse files Browse the repository at this point in the history
When a package has a pre-install script that adds users, the pre-install
actually requires alpine-baselayout-data/busybox to successfully work,
but this dependency isn't written anywhere.

After bringing this up on IRC rather than adding the dependency everywhere
it was decided to make sure alpine-baselayout is installed first instead,
so do this.

--initdb can be used multiple times with no ill side effects, but
--updatedb is annoying and not actually useful (will automatically
refresh every 4 hours, but starting from an empty directory it'll
always fetch it anyway), so just remove it.

Co-Authored-By: Jakub Jirutka <[email protected]>
  • Loading branch information
martinetd and jirutka committed Aug 20, 2023
1 parent 536e1df commit c7fa42d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions alpine-make-rootfs
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,8 @@ case "$ROOTFS_DEST" in
esac
[ -z "$FS_SKEL_DIR" ] || host_pkgs="$host_pkgs rsync"

rootfs_pkgs="$PACKAGES"
if [ "$DEFAULT_PKGS" = 'yes' ]; then
rootfs_pkgs="$ALPINE_BASE_PKGS $rootfs_pkgs"
fi
[ "$rootfs_pkgs" ] || die 'No packages specified to be installed!'
[ "$PACKAGES" ] || [ "$DEFAULT_PKGS" = 'yes' ] || \
die 'No packages specified to be installed!'

rootfs="$ROOTFS_DEST"
if [ "$ROOTFS_DEST" = '-' ]; then
Expand Down Expand Up @@ -384,7 +381,10 @@ else
dump_alpine_keys "$rootfs"/etc/apk/keys/
fi

_apk add --root "$rootfs" --update-cache --initdb $rootfs_pkgs >&2
if [ "$DEFAULT_PKGS" = 'yes' ]; then
_apk add --root "$rootfs" --initdb $ALPINE_BASE_PKGS >&2
fi
_apk add --root "$rootfs" --initdb $PACKAGES >&2

if ! [ -f "$rootfs"/etc/alpine-release ]; then
if _apk info --root "$rootfs" --quiet alpine-release >/dev/null; then
Expand Down

0 comments on commit c7fa42d

Please sign in to comment.