Add git commit information into the image. Fixes #43
This commit is contained in:
parent
7c65ab3d7d
commit
afe64f3b1f
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
|
|
||||||
|
@ -128,6 +129,7 @@ if suite == 'buster':
|
||||||
else:
|
else:
|
||||||
systemd_timesyncd = 'systemd-timesyncd'
|
systemd_timesyncd = 'systemd-timesyncd'
|
||||||
|
|
||||||
|
gitcommit = subprocess.getoutput("git show -s --pretty='format:%C(auto)%h (%s, %ad)' --date=short ")
|
||||||
|
|
||||||
### Write results:
|
### Write results:
|
||||||
|
|
||||||
|
@ -164,7 +166,8 @@ with open('raspi_master.yaml', 'r') as in_file:
|
||||||
.replace('__WIRELESS_FIRMWARE__', wireless_firmware) \
|
.replace('__WIRELESS_FIRMWARE__', wireless_firmware) \
|
||||||
.replace('__SERIAL_CONSOLE__', serial) \
|
.replace('__SERIAL_CONSOLE__', serial) \
|
||||||
.replace('__HOST__', hostname) \
|
.replace('__HOST__', hostname) \
|
||||||
.replace('__TOUCH_MACHINE_ID__', touch_machine_id)
|
.replace('__TOUCH_MACHINE_ID__', touch_machine_id) \
|
||||||
|
.replace('__GITCOMMIT__', gitcommit)
|
||||||
|
|
||||||
out_text = align_replace(out_text, '__FIX_FIRMWARE_PKG_NAME__', fix_firmware_cmds)
|
out_text = align_replace(out_text, '__FIX_FIRMWARE_PKG_NAME__', fix_firmware_cmds)
|
||||||
out_text = align_replace(out_text, '__EXTRA_ROOT_SHELL_CMDS__', extra_root_shell_cmds)
|
out_text = align_replace(out_text, '__EXTRA_ROOT_SHELL_CMDS__', extra_root_shell_cmds)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# See https://wiki.debian.org/RaspberryPi3 for known issues and more details.
|
# See https://wiki.debian.org/RaspberryPi3 for known issues and more details.
|
||||||
|
# image.yml based on revision: __GITCOMMIT__
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- mkimg: "{{ output }}"
|
- mkimg: "{{ output }}"
|
||||||
|
@ -170,3 +171,8 @@ steps:
|
||||||
shell: |
|
shell: |
|
||||||
rm -f /etc/machine-id /var/lib/dbus/machine-id
|
rm -f /etc/machine-id /var/lib/dbus/machine-id
|
||||||
__TOUCH_MACHINE_ID__
|
__TOUCH_MACHINE_ID__
|
||||||
|
|
||||||
|
# Create /etc/raspi-image-id to know, from what commit the image was built
|
||||||
|
- chroot: /
|
||||||
|
shell: |
|
||||||
|
echo "image based on revision: __GITCOMMIT__ " > "/etc/raspi-image-id"
|
||||||
|
|
Loading…
Reference in New Issue