#!/bin/sh -e kinstall_t() { # install -Dm* -t alternative # usage: kinstall_t 755 /usr/bin file file2 file3 mod=$1 dir=$2; mkdir -p "$dir" shift 2 for file; do cp "$file" "$dir" chmod "$mod" "$dir/$file" done } patch -p0 < CVE-2020-28928.patch [ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc AR=$CPT_CROSS_TRIPLET-ar cpt-configure \ --syslibdir=/usr/lib make make DESTDIR="$1" install mkdir -p "$1/usr/bin" ARCH=$(sed -n '/^ARCH =/s/.* //p' config.mak) ln -sf libc.so "$1/usr/lib/ld-musl-$ARCH.so.1" ln -s "../lib/ld-musl-$ARCH.so.1" "$1/usr/bin/ldd" # Install BSD compatibility headers. kinstall_t 755 "$1/usr/include/sys" cdefs.h queue.h tree.h # Install getconf. "${CC:=cc}" --static getconf.c -o "$1/usr/bin/getconf" "$CC" -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o "${AR:-ar}" r "$1/usr/lib/libssp_nonshared.a" __stack_chk_fail_local.o # Install getent kinstall_t 755 "$1/usr/bin" getent