blob: 55d82b91820af22fe50feec57a1f27cffe76067a [file] [log] [blame]
Jan Kundrát1cfb1982017-10-30 18:05:47 +01001#!/bin/sh
2
3case "$1" in
4 slot-post-install)
5 case "$RAUC_SLOT_CLASS" in
6 cfg)
Jan Kundrát68f98ad2019-11-01 20:18:04 +01007 # whitelist so that we don't copy cruft or lost+found
8 for ITEM in \
Jan Kundrát54ed52b2020-01-29 21:08:37 +01009 calibration \
Jan Kundrát68f98ad2019-11-01 20:18:04 +010010 etc \
Jan Kundrát1c6643e2019-11-01 19:39:34 +010011 journald-remote \
Jan Kundrát68f98ad2019-11-01 20:18:04 +010012 random-seed \
13 ssh-user-auth \
14 ; do
Jan Kundrát1c6643e2019-11-01 19:39:34 +010015 if [[ -d /cfg/${ITEM} || -f /cfg/${ITEM} ]]; then
Jan Kundrát68f98ad2019-11-01 20:18:04 +010016 cp -a /cfg/${ITEM} ${RAUC_SLOT_MOUNT_POINT}/
Jan Kundrát2af054a2018-06-06 13:45:04 +020017 fi
18 done
Jan Kundrát1cfb1982017-10-30 18:05:47 +010019 ;;
20 *)
21 echo "Internal error: hook mismatched"
22 exit 11
23 esac
24 ;;
25 *)
26 echo "Internal error: unrecognized hook"
27 exit 11
28 ;;
29esac
30
Jan Kundrát2f100fc2020-11-02 22:10:16 +010031if [[ -f /lib/libsysrepo.so.0.7 ]]; then
32 # Updating from old sysrepo with incompatible repository layout
33 rm -rf ${RAUC_SLOT_MOUNT_POINT}/etc/sysrepo
34 # No more netopeer2-keystored, different config
35 rm -rf ${RAUC_SLOT_MOUNT_POINT}/etc/keystored
36 echo "sysrepo configuration not preserved"
37fi
38
Jan Kundrát1cfb1982017-10-30 18:05:47 +010039exit 0