Jan Kundrát | 1cfb198 | 2017-10-30 18:05:47 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | case "$1" in |
| 4 | slot-post-install) |
| 5 | case "$RAUC_SLOT_CLASS" in |
| 6 | cfg) |
Jan Kundrát | 68f98ad | 2019-11-01 20:18:04 +0100 | [diff] [blame] | 7 | # whitelist so that we don't copy cruft or lost+found |
| 8 | for ITEM in \ |
Jan Kundrát | 54ed52b | 2020-01-29 21:08:37 +0100 | [diff] [blame] | 9 | calibration \ |
Jan Kundrát | 68f98ad | 2019-11-01 20:18:04 +0100 | [diff] [blame] | 10 | etc \ |
Jan Kundrát | 1c6643e | 2019-11-01 19:39:34 +0100 | [diff] [blame] | 11 | journald-remote \ |
Jan Kundrát | 1354165 | 2021-03-24 22:24:18 +0100 | [diff] [blame] | 12 | network \ |
Jan Kundrát | 68f98ad | 2019-11-01 20:18:04 +0100 | [diff] [blame] | 13 | random-seed \ |
Jan Kundrát | 34d2f48 | 2021-01-11 19:24:09 +0100 | [diff] [blame] | 14 | sysrepo \ |
Jan Kundrát | 68f98ad | 2019-11-01 20:18:04 +0100 | [diff] [blame] | 15 | ssh-user-auth \ |
| 16 | ; do |
Jan Kundrát | 1c6643e | 2019-11-01 19:39:34 +0100 | [diff] [blame] | 17 | if [[ -d /cfg/${ITEM} || -f /cfg/${ITEM} ]]; then |
Jan Kundrát | 68f98ad | 2019-11-01 20:18:04 +0100 | [diff] [blame] | 18 | cp -a /cfg/${ITEM} ${RAUC_SLOT_MOUNT_POINT}/ |
Jan Kundrát | 2af054a | 2018-06-06 13:45:04 +0200 | [diff] [blame] | 19 | fi |
| 20 | done |
Jan Kundrát | 1cfb198 | 2017-10-30 18:05:47 +0100 | [diff] [blame] | 21 | ;; |
| 22 | *) |
| 23 | echo "Internal error: hook mismatched" |
| 24 | exit 11 |
| 25 | esac |
| 26 | ;; |
| 27 | *) |
| 28 | echo "Internal error: unrecognized hook" |
| 29 | exit 11 |
| 30 | ;; |
| 31 | esac |
| 32 | |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 33 | if [[ -f /lib/libsysrepo.so.0.7 ]]; then |
| 34 | # Updating from old sysrepo with incompatible repository layout |
| 35 | rm -rf ${RAUC_SLOT_MOUNT_POINT}/etc/sysrepo |
| 36 | # No more netopeer2-keystored, different config |
| 37 | rm -rf ${RAUC_SLOT_MOUNT_POINT}/etc/keystored |
Jan Kundrát | da1efbc | 2024-06-11 15:46:40 +0200 | [diff] [blame] | 38 | echo "sysrepo configuration not preserved (incompatible layout, too old version, standalone keystored)" |
Jan Kundrát | 34d2f48 | 2021-01-11 19:24:09 +0100 | [diff] [blame] | 39 | elif [[ -d /cfg/etc/sysrepo ]]; then |
| 40 | # switch from "persisting whole /etc/sysrepo" to "exporting config via JSON" |
| 41 | rm -rf ${RAUC_SLOT_MOUNT_POINT}/etc/sysrepo |
Jan Kundrát | da1efbc | 2024-06-11 15:46:40 +0200 | [diff] [blame] | 42 | echo "sysrepo configuration not preserved (copy of the whole /etc/sysrepo)" |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 43 | fi |
| 44 | |
Jan Kundrát | 1cfb198 | 2017-10-30 18:05:47 +0100 | [diff] [blame] | 45 | exit 0 |