xref: /aosp_15_r20/external/toybox/mkroot/packages/lfs-sources (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1#!/bin/echo Try "mkroot/mkroot.sh lfs"
2
3[ -z "$(which mksquashfs)" ] && echo "no squashfs" && exit 1
4
5# Download osuosl's rollup tarball of all the LFS packages.
6
7download 45a27da2ee443a8e35a7e29db8a0c6877bbb98bb \
8  http://ftp.osuosl.org/pub/lfs/lfs-packages/lfs-packages-12.1.tar
9
10# This one's a little weird, we're creating a target-agonstic squashfs image
11# not part of the initramfs.
12
13setupfor lfs-packages
14LFS="$OUTPUT/lfs" LFSRC="$LFS/src"
15rm -rf "$LFS" && mkdir -p "$LFSRC/tzdata" &&
16# Fixup names
17tar xfC tzdata*.tar.gz "$LFSRC/tzdata" && # Horrible package, no subdirectory!
18rm tzdata*.tar.gz &&
19mv {expect*,expect-0}.tar.gz &&           # broken name (no - before version)
20rm -f tcl*-html.tar.gz &&                 # Broken _and_ duplicate name
21mv {tcl*,tcl-0}.tar.gz &&
22mkdir sub || exit 1
23# extract tarballs to package name in output and apply patches (if any)
24for i in *.tar*; do
25  PKG="${i/-[0-9]*/}"
26  echo process $PKG
27  tar xfC $i sub && mv sub/* "$LFSRC/$PKG" || exit 1
28  for j in $PKG*.patch; do
29    [ -e "$j" ] && { ( cd "$LFSRC/$PKG" && patch -p1) < "$j" || exit 1 ; }
30  done
31done
32
33# Archive the sources
34
35mksquashfs "$LFSRC" "$TOP"/lfs.sqf -noappend -all-root >/dev/null
36