From 5bc2523af5c3f29ab9e535a8f72c1df932154856 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 18 Apr 2019 12:42:11 +0200 Subject: [PATCH] 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 --- pkg/release-alix/build | 5 +++-- pkg/release-qemu/build | 3 ++- pkg/release-rpi3/build | 4 +++- pkg/rootfs/build | 47 +++++++++++++++++++++++------------------- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/pkg/release-alix/build b/pkg/release-alix/build index 905ed1a..af0f9bc 100755 --- a/pkg/release-alix/build +++ b/pkg/release-alix/build @@ -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" diff --git a/pkg/release-qemu/build b/pkg/release-qemu/build index a6936dd..da0b8cf 100755 --- a/pkg/release-qemu/build +++ b/pkg/release-qemu/build @@ -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" diff --git a/pkg/release-rpi3/build b/pkg/release-rpi3/build index 9e0e8d6..d4cb367 100755 --- a/pkg/release-rpi3/build +++ b/pkg/release-rpi3/build @@ -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" diff --git a/pkg/rootfs/build b/pkg/rootfs/build index 49d6e1f..8618eeb 100755 --- a/pkg/rootfs/build +++ b/pkg/rootfs/build @@ -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() {