← Back
Editing: post-refresh
#!/bin/sh # Run any steps that should occur after the snap is refreshed here. # Note that we use || true to ignore permission denied errors. # Only copy if the directory exists to prevent refresh errors (e.g. in Ubuntu Core systems). if [ -d /etc/update-motd.d ]; then cp -f "$SNAP/resources/99-livepatch-kernel-upgrade-required" /etc/update-motd.d/99-livepatch-kernel-upgrade-required || true fi if [ -d /etc/kernel/postinst.d ]; then cp -f "$SNAP/resources/livepatch-kernel-installed" /etc/kernel/postinst.d/livepatch-kernel-installed || true fi if [ -d /etc/apt/apt.conf.d ]; then cp -f "$SNAP/resources/20canonical-livepatch" /etc/apt/apt.conf.d/20canonical-livepatch || true fi # Migrate machine token to the new shared directory if it exists at the legacy location. if [ -f "$SNAP_COMMON/machine-token" ]; then mkdir -p -m 0700 "$SNAP_COMMON/livepatch-token" || true if [ ! -f "$SNAP_COMMON/livepatch-token/machine-token" ]; then mv -f "$SNAP_COMMON/machine-token" "$SNAP_COMMON/livepatch-token/machine-token" || true else rm -f "$SNAP_COMMON/machine-token" || true fi chmod 0700 "$SNAP_COMMON/livepatch-token" || true chmod 0600 "$SNAP_COMMON/livepatch-token/machine-token" 2>/dev/null || true fi
Save File
Cancel