1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 11:09:46 +01:00

Create regular package for root filesystem, use pkg2sqfs in release

This commit overhauls the rootfs package to create a regular package
for the root filesystem instead of creating a packaged squashfs. The
release packages then use pkg2sqfs to turn it into a squashfs image.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-04-18 12:42:11 +02:00
parent cdc4d8710e
commit 5bc2523af5
4 changed files with 34 additions and 25 deletions

View file

@ -2,9 +2,10 @@ DEPENDS="rootfs linux"
SUBPKG="release"
build() {
pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" -R "$REPODIR" $DEPENDS
pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" -R "$REPODIR" linux
pkg2sqfs -c xz "$REPODIR/rootfs.pkg" "$OS_RELEASE/rootfs.img"
# copy additional files from this package, subsitute filenames
# copy helper scripts
local linux_image="$OS_RELEASE/vmlinuz"
local rootfs_image="$OS_RELEASE/rootfs.img"

View file

@ -2,7 +2,8 @@ DEPENDS="rootfs linux"
SUBPKG="release"
build() {
pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" -R "$REPODIR" $DEPENDS
pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" -R "$REPODIR" linux
pkg2sqfs -c xz "$REPODIR/rootfs.pkg" "$OS_RELEASE/rootfs.img"
# copy helper scripts
local linux_image="vmlinuz"

View file

@ -2,7 +2,9 @@ DEPENDS="rootfs boot-rpi boot-rpi-dtbo boot-rpi-dtb linux"
SUBPKG="release"
build() {
pkg install -om -r "$PKGBUILDDIR/boot" -R "$REPODIR" $DEPENDS
pkg install -om -r "$PKGBUILDDIR/boot" -R "$REPODIR" \
boot-rpi boot-rpi-dtbo boot-rpi-dtb linux
pkg2sqfs -c xz "$REPODIR/rootfs.pkg" "boot/rootfs.img"
# copy files from this package
cp "$SCRIPTDIR/pkg/$PKGNAME/install.sh" "$PKGBUILDDIR"

View file

@ -1,40 +1,45 @@
DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
# generate pseudo file listing for squashfs
pkg install -l sqfs -R "$REPODIR" -r "$TCDIR/$TARGET" $DEPENDS |\
sort -u > "$PKGDEPLOYDIR/pseudo"
local listing="$PKGDEPLOYDIR/$PKGNAME.files"
local desc="$PKGDEPLOYDIR/$PKGNAME.desc"
# generate package description and file listing
pkg install -l pkg -R "$REPODIR" -r "$TCDIR/$TARGET" $DEPENDS |\
sort -u > "$listing"
touch "$desc"
# move configuration to preserve directory
mkdir -pv "$TCDIR/$TARGET/cfg/preserve" "$TCDIR/$TARGET/cfg/overlay"
echo <<_EOF >> "$PKGDEPLOYDIR/pseudo"
cfg m 755 0 0
cfg/preserve m 755 0 0
cfg/preserve/etc m 755 0 0
cfg/preserve/usr m 755 0 0
cfg/preserve/var_lib m 755 0 0
cfg/overlay m 755 0 0
_EOF
mv "$TCDIR/$TARGET/etc" "$TCDIR/$TARGET/cfg/preserve/etc"
mv "$TCDIR/$TARGET/usr" "$TCDIR/$TARGET/cfg/preserve/usr"
mv "$TCDIR/$TARGET/var/lib" "$TCDIR/$TARGET/cfg/preserve/var_lib"
rm -rf "$TCDIR/$TARGET/var"
mkdir -p $TCDIR/$TARGET/{etc,var,usr}
sed -i 's#etc/#cfg/preserve/etc/#g' "$listing"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$listing"
sed -i 's#usr/#cfg/preserve/usr/#g' "$listing"
sed -i 's#etc/#cfg/preserve/etc/#g' "$PKGDEPLOYDIR/pseudo"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$PKGDEPLOYDIR/pseudo"
sed -i 's#usr/#cfg/preserve/usr/#g' "$PKGDEPLOYDIR/pseudo"
egrep -v "^(dir|file|slink) (var|etc|usr)" "$listing" > "./temp"
mv "./temp" "$listing"
cat <<_EOF >> "$listing"
dir etc 0755 0 0
dir var 0755 0 0
dir usr 0755 0 0
dir cfg 0755 0 0
dir cfg/preserve 0755 0 0
dir cfg/preserve/etc 0755 0 0
dir cfg/preserve/usr 0755 0 0
dir cfg/preserve/var_lib 0755 0 0
dir cfg/overlay 0755 0 0
_EOF
}
deploy() {
mksquashfs "$TCDIR/$TARGET" "$PKGDEPLOYDIR/rootfs.img" -comp xz \
-no-progress -no-xattrs -pf "$PKGDEPLOYDIR/pseudo"
rm "$PKGDEPLOYDIR/pseudo"
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
return
}
check_update() {