Skip to content

Instantly share code, notes, and snippets.

@Mrigank11
Created January 17, 2019 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mrigank11/c8791189e7e4692345d198f9dfb84906 to your computer and use it in GitHub Desktop.
Save Mrigank11/c8791189e7e4692345d198f9dfb84906 to your computer and use it in GitHub Desktop.
#backup.hook
[Trigger]
Operation = Upgrade
Operation = Remove
Type = Package
Target = linux
[Action]
Depends = coreutils
Depends = bash
When = PreTransaction
Exec = /usr/bin/bash -c 'mkdir /tmp/workdir && mkdir /tmp/kernel_backup && cp -r /usr/lib/modules/$(uname -r) /tmp/kernel_backup/'
#restore.hook
[Trigger]
Operation = Upgrade
Operation = Remove
Type = Package
Target = linux
[Action]
Depends = coreutils
Depends = bash
When = PostTransaction
Exec = /usr/bin/bash -c 'mount -t overlay overlay -o upperdir=/tmp/kernel_backup,lowerdir=/usr/lib/modules,workdir=/tmp/workdir /usr/lib/modules'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment