summaryrefslogtreecommitdiffstats
path: root/linhes/mkinitcpio-openswap/openswap.install
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2022-11-11 03:23:55 (GMT)
committerBritney Fransen <brfransen@gmail.com>2022-11-11 03:23:55 (GMT)
commit98920007f3377fc8adcf40791b97dff55a7af0d9 (patch)
tree4857e7d97a0b0ac4d666936f77675361319ffda8 /linhes/mkinitcpio-openswap/openswap.install
parent8896dbb865bfecfd6dd9277d07db8f1453c607a5 (diff)
downloadlinhes_pkgbuild-98920007f3377fc8adcf40791b97dff55a7af0d9.zip
linhes_pkgbuild-98920007f3377fc8adcf40791b97dff55a7af0d9.tar.gz
linhes_pkgbuild-98920007f3377fc8adcf40791b97dff55a7af0d9.tar.bz2
mkinitcpio-openswap: initial inclusion
Diffstat (limited to 'linhes/mkinitcpio-openswap/openswap.install')
-rw-r--r--linhes/mkinitcpio-openswap/openswap.install27
1 files changed, 27 insertions, 0 deletions
diff --git a/linhes/mkinitcpio-openswap/openswap.install b/linhes/mkinitcpio-openswap/openswap.install
new file mode 100644
index 0000000..95d59a3
--- /dev/null
+++ b/linhes/mkinitcpio-openswap/openswap.install
@@ -0,0 +1,27 @@
+build ()
+{
+ grep "swap_device=" /etc/openswap.conf > "$BUILDROOT/openswap.conf"
+ grep "crypt_swap_name=" /etc/openswap.conf >> "$BUILDROOT/openswap.conf"
+ grep "keyfile_device=" /etc/openswap.conf >> "$BUILDROOT/openswap.conf"
+ grep "keyfile_filename=" /etc/openswap.conf >> "$BUILDROOT/openswap.conf"
+ grep "keyfile_device_mount_options=" /etc/openswap.conf >> "$BUILDROOT/openswap.conf"
+ grep "cryptsetup_options=" /etc/openswap.conf >> "$BUILDROOT/openswap.conf"
+
+ source "$BUILDROOT/openswap.conf"
+
+ if [ -z "$swap_device" ]; then
+ warning "swap_device variable is not set"
+ fi
+
+ if [ -z "$crypt_swap_name" ]; then
+ warning "crypt_swap_name variable is not set"
+ fi
+
+ add_runscript
+}
+help ()
+{
+cat<<HELPEOF
+ This hook opens a swap at boot time
+HELPEOF
+}