Skip to content

Commit

Permalink
move output dir creation.
Browse files Browse the repository at this point in the history
Better to error out before build.
  • Loading branch information
obgr committed Dec 3, 2023
1 parent 4d276a9 commit 6557b1b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ if ! test -d "$BUILD_DIR" ; then
git clone https://github.com/armbian/build $BUILD_DIR
fi

IMG_DIR="../images"
if [[ ! -e $IMG_DIR ]]; then
echo "Creating Output directory $IMG_DIR"
mkdir $IMG_DIR
elif [[ ! -d $IMG_DIR ]]; then
echo "$IMG_DIR exists but not a directory"
exit 20 # Not a directory
fi

ROOT_DIR=$(pwd)
TAG=$(git describe --always --tags)
NAME="rebuild-${VERSION}-${TAG}"
Expand All @@ -45,9 +54,5 @@ cd "$BUILD_DIR"
DOCKER_EXTRA_ARGS="--cpus=12" ./compile.sh rebuild
IMG=$(ls -1 output/images/ | grep "img.xz$")

IMGPATH="../images"
if [[ ! -e $IMGPATH ]]; then
mkdir $IMGPATH
fi
mv "$BUILD_DIR"/output/images/"$IMG" "${IMGPATH}/${NAME}.img.xz"
mv "$BUILD_DIR"/output/images/"$IMG" "${IMG_DIR}/${NAME}.img.xz"
echo "🍰 Finished building ${NAME}"

0 comments on commit 6557b1b

Please sign in to comment.