mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-02 01:18:08 +01:00
Ever since an old patch version, it has (for reasonable security reasons) not supported patched with ../ in the filename. Many of our patches have been relying on this behaviour being OK, because we start off with an ancient patch version that didn't perform such checks. As soon as we need this behaviour after we build a newer patch though, we will have problems. So, let's change the policy. Patches are relative to where tarballs are extracted, rather than the "working directory" - e.g. have patches for `coreutils-9.4/src/cp.c` instead of `src/cp.c`. Keeping this consistent has a few implications; - patches are applied from the build/ directory in bash era now, with `-p0` - when patches are manually applied in the bash era, use `-p` as required, usually `-p1` - in kaem era where patches are always manually applied, `-p1` is used
60 lines
1.3 KiB
Bash
Executable file
60 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
|
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
|
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
set -ex
|
|
|
|
# Check tarball checksums
|
|
checksum-transcriber sources
|
|
sha256sum -c sources.SHA256SUM
|
|
|
|
mkdir build
|
|
cd build
|
|
|
|
# Extract
|
|
ungz --file ${DISTFILES}/${pkg}.tar.gz --output ${pkg}.tar
|
|
untar --file ${pkg}.tar
|
|
rm ${pkg}.tar
|
|
cd ${pkg}
|
|
|
|
# Prepare
|
|
cp ../../mk/main.mk Makefile
|
|
catm gzip.c.new ../../files/stat_override.c gzip.c
|
|
cp gzip.c.new gzip.c
|
|
|
|
# Remove generated crc table from util.c
|
|
patch -Np1 -i ../../patches/removecrc.patch
|
|
|
|
# Since IO redirection is not available yet, patch makecrc.c so that it writes
|
|
# C code to file crc.c that can be appended to util.c
|
|
patch -Np1 -i ../../patches/makecrc-write-to-file.patch
|
|
|
|
tcc -static -o makecrc sample/makecrc.c
|
|
./makecrc
|
|
catm util.c.new util.c crc.c
|
|
cp util.c.new util.c
|
|
|
|
# Build
|
|
make
|
|
|
|
# Install
|
|
cp gzip ${BINDIR}/gzip
|
|
cp gzip ${BINDIR}/gunzip
|
|
chmod 755 ${BINDIR}/gzip
|
|
chmod 755 ${BINDIR}/gunzip
|
|
|
|
cd ../..
|
|
|
|
# Checksums
|
|
if match x${UPDATE_CHECKSUMS} xTrue; then
|
|
sha256sum -o ${pkg}.checksums \
|
|
/usr/bin/gzip
|
|
|
|
cp ${pkg}.checksums ${SRCDIR}
|
|
else
|
|
sha256sum -c ${pkg}.checksums
|
|
fi
|