alpm hook to automatically copy kernel image and initial RAM disk(s) to external USB drive.
This software is Arch Linux specific (but you may try to adapt it to other Linux distributions). Its main goal is to copy kernel image and accompanying files to external USB drive(s) (including SD cards) whenever those files have changed during system upgrade/downgrade.
Download source code from git repository:
$ git clone https://github.com/mmarzantowicz/extusbinst.git
Run make and make install (second command may require root privileges):
$ make
...
$ sudo make install
By default make and make install does not require any arguments and in such case it builds linux.hook for kernel package called linux. If you have other kernel packages installed (e.g. linux-lts) and would like their files to be copied to external drive as well, you can specify HOOKS argument:
$ make HOOKS="linux.hook linux-lts.hook"
In order to install your files in different directory than /etc, you can do:
$ sudo make install DESTDIR=/path/to/somewhere
Please not that it may be required to adjust value of HookDir in /etc/pacman.conf when installing hooks in non standard directory (default is /etc/pacman.d/hooks/).
A configuration file called extusbinst is created in /etc/conf.d/. Before using this hooks, you must change its content according to your needs.
Below is a simple configuration with two external USB drives mounted at /mnt/usb-boot-1 and /mnt/usb-boot-2:
BOOTABLE_DEVICES=(
'/mnt/usb-boot-1'
'/mnt/usb-boot-2'
)
NOTE: Before upgrading kernel package (or any other packages that will trigger rebuild of initial RAM disk), you must mount your USB drives under specified directories. Otherwise you will see complains from alpm hook.
NOTE: Please note that your USB drive must be bootable (see here) in order to load kernel image and initial RAM disk from given USB drive.
Please open a Github issue with as much information as possible.
- Only one initial RAM disk
/boot/initramfs-<package>.imgis copied to USB drive (fallback initramfs is not supported yet). - Colored output does not always work