Skip to content

Commit ba3e18a

Browse files
authored
Merge pull request #74 from hnez/flexible-rauc-migrate
meta-lxatac-software: bundles: hook.sh: migrate user-specified files
2 parents 461ee86 + f2d7a30 commit ba3e18a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ bundle on your TAC:
2727

2828
If that does not work you may want to [re-install via USB](#installing-images-via-usb).
2929

30+
If you've made changes to your TACs configuration that you want to preserve,
31+
which are not covered by the default update migration logic,
32+
you can add a list of additional files to migrate to the
33+
`/etc/rauc/migrate.d`:
34+
35+
root@lxatac-00010:~ cat /etc/rauc/migrate.d/git_config.conf
36+
/etc/gitconfig
37+
/home/root/.gitconfig
38+
39+
If that is not enough customization for you then read on to learn
40+
how to build fully-custom images for your LXA TAC.
41+
3042
Building the image as-is
3143
------------------------
3244

meta-lxatac-software/recipes-core/bundles/files/hook.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -exu -o pipefail
44

5+
EXTRA_MIGRATE_LISTS_DIR="/etc/rauc/migrate.d"
56
CERT_AVAILABLE_DIR="${RAUC_SLOT_MOUNT_POINT}/etc/rauc/certificates-available"
67
CERT_ENABLED_DIR="${RAUC_SLOT_MOUNT_POINT}/etc/rauc/certificates-enabled"
78

@@ -44,6 +45,22 @@ function migrate () {
4445
cp -a "$1" "${RAUC_SLOT_MOUNT_POINT}/$1"
4546
}
4647

48+
function process_migrate_lists () {
49+
if [ ! -d "${EXTRA_MIGRATE_LISTS_DIR}" ]; then
50+
return
51+
fi
52+
53+
for migrate_list in "${EXTRA_MIGRATE_LISTS_DIR}"/*.conf; do
54+
# Migrate files in the list line by line
55+
while read -r line; do
56+
migrate "${line}"
57+
done < "${migrate_list}"
58+
59+
# Also migrate the list itself
60+
migrate "${migrate_list}"
61+
done
62+
}
63+
4764
case "$1" in
4865
slot-post-install)
4966
enable_certificates
@@ -63,6 +80,12 @@ case "$1" in
6380
migrate /home/root/.bash_history
6481
migrate /home/root/.ssh/authorized_keys
6582
migrate /var/cache/lxa-iobus/lss-cache
83+
84+
# Also allow the running system to specify additional files to
85+
# migrate to the new slot via files in /etc/rauc/migrate.d.
86+
# The files should contain one file per line that should be
87+
# migrated to the new slot.
88+
process_migrate_lists
6689
;;
6790
*)
6891
exit 1

0 commit comments

Comments
 (0)