From 297b0a325460bf97f0df107e0d1c97ff2868c18d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 17 Jan 2018 00:56:06 +0100 Subject: [PATCH] Cleanup release packages Signed-off-by: David Oberhollenzer --- pkg/linux/build | 4 +--- pkg/release-alix/build | 35 ++++++++++++++--------------------- pkg/release-alix/depends | 2 -- pkg/release-alix/syslinux.cfg | 6 ++++++ pkg/release-rpi3/build | 24 ++++++++++++++---------- 5 files changed, 35 insertions(+), 36 deletions(-) create mode 100644 pkg/release-alix/syslinux.cfg diff --git a/pkg/linux/build b/pkg/linux/build index 7614af0..2734cec 100755 --- a/pkg/linux/build +++ b/pkg/linux/build @@ -41,9 +41,7 @@ deploy() { local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-) local LINUX_TGT=$(head -2 "$CFGFILE" | tail -1 | cut -b 3-) - mkdir -p "$DEPLOY/boot" - pushd $BUILD - install -m 755 "arch/$LINUX_CPU/boot/$LINUX_TGT" "$DEPLOY/boot/vmlinuz-$VERSION" + install -m 755 "arch/$LINUX_CPU/boot/$LINUX_TGT" "$DEPLOY/vmlinuz-$VERSION" popd } diff --git a/pkg/release-alix/build b/pkg/release-alix/build index bb8cf8b..d3627f0 100755 --- a/pkg/release-alix/build +++ b/pkg/release-alix/build @@ -3,32 +3,25 @@ build() { local BUILD="$2" local DEPLOY="$3" - local ROOTFS_SQFS=$(find $PKGDEPLOYDIR/rootfs-${CFG}/ -name '*.img') + # copy output of immediate dependencies + while read pkgname; do + if [ -e "$PKGDEPLOYDIR/$pkgname" ]; then + cp -ru ${PKGDEPLOYDIR}/${pkgname}/* "$BUILD" + fi + done < "$SCRIPTDIR/pkg/release-${CFG}/depends" - local fname=$(find $PKGDEPLOYDIR/linux/ -name 'vmlinuz*') - local linux_image=$(basename $fname) - local rootfs_image=$(basename $ROOTFS_SQFS) + # copy additional files from this package, subsitute filenames + local linux_image=$(basename $BUILD/vmlinuz*) + local rootfs_image="rootfs.img" - cp -r "$fname" "$BUILD" - cp "$ROOTFS_SQFS" "$BUILD" - cp "$SCRIPTDIR/pkg/release-${CFG}/install.sh" "$BUILD" - cp "$SCRIPTDIR/pkg/release-${CFG}/genimage.sh" "$BUILD" cp "/usr/share/syslinux/mbr.bin" "$BUILD" - sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$BUILD/install.sh" - sed -i 's/KERNELFILE/'$linux_image'/g' "$BUILD/install.sh" + for script in install.sh genimage.sh syslinux.cfg; do + cp "$SCRIPTDIR/pkg/release-${CFG}/$script" "$BUILD" - sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$BUILD/genimage.sh" - sed -i 's/KERNELFILE/'$linux_image'/g' "$BUILD/genimage.sh" - -cat > "$BUILD/syslinux.cfg" << _EOF -timeout 0 -totaltimeout 50 -default linux -label linux - kernel /$linux_image - append root=/dev/sda1 root_sfs=/$rootfs_image -_EOF + sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$BUILD/$script" + sed -i 's/KERNELFILE/'$linux_image'/g' "$BUILD/$script" + done } deploy() { diff --git a/pkg/release-alix/depends b/pkg/release-alix/depends index 73a53db..09bbde6 100644 --- a/pkg/release-alix/depends +++ b/pkg/release-alix/depends @@ -1,4 +1,2 @@ rootfs-alix -bbstatic -initrd linux diff --git a/pkg/release-alix/syslinux.cfg b/pkg/release-alix/syslinux.cfg new file mode 100644 index 0000000..a96f097 --- /dev/null +++ b/pkg/release-alix/syslinux.cfg @@ -0,0 +1,6 @@ +timeout 0 +totaltimeout 50 +default linux +label linux + kernel /KERNELFILE + append root=/dev/sda1 root_sfs=/ROOTFSFILE diff --git a/pkg/release-rpi3/build b/pkg/release-rpi3/build index 816f27c..6d7b78e 100755 --- a/pkg/release-rpi3/build +++ b/pkg/release-rpi3/build @@ -3,20 +3,24 @@ build() { local BUILD="$2" local DEPLOY="$3" - local ROOTFS_SQFS=$(find $PKGDEPLOYDIR/rootfs-${CFG}/ -name '*.img') + # copy output of immediate dependencies + mkdir -p "$BUILD/boot" - local rootfs_image=$(basename $ROOTFS_SQFS) - local bootdir="$BUILD/boot" - - mkdir -p "$bootdir" - cp -r ${PKGDEPLOYDIR}/linux-rpi3/* "$bootdir" - cp -r ${PKGDEPLOYDIR}/boot-rpi3/* "$bootdir" - cp "$SCRIPTDIR/pkg/release-${CFG}/cmdline.txt" "$bootdir" - cp "$ROOTFS_SQFS" "$bootdir" - sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$bootdir/cmdline.txt" + while read pkgname; do + if [ -e "$PKGDEPLOYDIR/$pkgname" ]; then + cp -ru ${PKGDEPLOYDIR}/${pkgname}/* "$BUILD/boot" + fi + done < "$SCRIPTDIR/pkg/release-${CFG}/depends" + # copy files from this package + cp "$SCRIPTDIR/pkg/release-${CFG}/cmdline.txt" "$BUILD/boot" cp "$SCRIPTDIR/pkg/release-${CFG}/install.sh" "$BUILD" cp "$SCRIPTDIR/pkg/release-${CFG}/genimage.sh" "$BUILD" + + # substitute file names in scripts + local rootfs_image="rootfs.img" + + sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$BUILD/boot/cmdline.txt" } deploy() {