Skip to content

Commit

Permalink
fix: Determine remote-os build version from git
Browse files Browse the repository at this point in the history
Use script directory to determine git version and git hash.
The output directory might be outside the git branch, e.g. in the Docker
build image.

This also fixes a build issue in #46 where the Docker build failed
calling `git rev-parse` in the wrong directory.
  • Loading branch information
zehnm committed May 20, 2020
1 parent bb6d71d commit 5cb0888
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rpi0/git-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ VERSION_FILE=$1
DEF_VER=UNKNOWN
LF='
'
cd $(dirname $0)

if test -f "$VERSION_FILE"
then
Expand All @@ -40,7 +41,6 @@ then
# BUILD_VERSION=$(echo "$BUILD_VERSION" | sed -e 's/-/./g');
:
else
# TODO add version logic for develop and feature branches?
BUILD_VERSION="$DEF_VER"
fi

Expand Down
11 changes: 4 additions & 7 deletions rpi0/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ if [ -e ${TARGET_DIR}/etc/inittab ]; then
tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
fi

echo "Creating systemd services"
ln -fs ../../../../usr/lib/systemd/system/[email protected] $1/etc/systemd/system/multi-user.target.wants/[email protected]

ln -fs ../../../../usr/lib/systemd/system/backlight.service $1/etc/systemd/system/multi-user.target.wants/backlight.service

ln -fs ../../../../usr/lib/systemd/system/sharp-init.service $1/etc/systemd/system/multi-user.target.wants/sharp-init.service

ln -fs ../../../../usr/lib/systemd/system/app.service $1/etc/systemd/system/multi-user.target.wants/app.service


rm -rf $1/var/log/journal

#rm -r $1/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service

#rm -r $1/etc/systemd/system/multi-user.target.wants/dhcpcd.service

# Determine build version
BUILD_VERSION=$("$SCRIPT_DIR/git-version.sh" "$BR2_EXTERNAL/version")

# We need the Git hash of remote-os and not of the buildroot submodule!
GIT_HASH=`cd $1; git rev-parse HEAD`

echo "Setting build version in YIO env variable: $BUILD_VERSION"
sed -i "s/\$BUILD_VERSION/$BUILD_VERSION/g" $1/etc/profile.d/yio.sh

# We need the Git hash of remote-os and not of the buildroot submodule!
GIT_HASH=`cd $SCRIPT_DIR; git rev-parse HEAD`

echo "Setting Git hash in YIO env variable: $GIT_HASH"
sed -i "s/\$GIT_HASH/$GIT_HASH/g" $1/etc/profile.d/yio.sh

0 comments on commit 5cb0888

Please sign in to comment.