summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LICENSE21
-rw-r--r--openswap.conf6
-rw-r--r--openswap.hook8
-rw-r--r--openswap.install5
4 files changed, 33 insertions, 7 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000000..870dd64204a6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Fabio Tea
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/openswap.conf b/openswap.conf
index e9a790a877e9..0b11f9e4edff 100644
--- a/openswap.conf
+++ b/openswap.conf
@@ -7,6 +7,10 @@ crypt_swap_name=cryptswap
keyfile_device=/dev/mapper/cryptroot
keyfile_filename=etc/keyfile-cryptswap
+## additional arguments are given to mount for keyfile_device
+## has to start with --options (if so desired)
+#keyfile_device_mount_options="--options=subvol=__active/__"
+
## additional arguments are given to cryptsetup
## --allow-discards options is desired in case swap is on SSD partition
-miscellaneous="--type luks"
+cryptsetup_options="--type luks"
diff --git a/openswap.hook b/openswap.hook
index 24331482913f..ead4c4f869bb 100644
--- a/openswap.hook
+++ b/openswap.hook
@@ -2,7 +2,7 @@ run_hook ()
{
## read openswap configurations
source openswap.conf
-
+
if [ -z "$keyfile_device" ] || [ -z "$keyfile_filename" ]
then
## case when no keyfile provided in configurations
@@ -10,8 +10,8 @@ run_hook ()
else
## case when keyfile is provided in configurations
mkdir openswap_keymount
- mount "$keyfile_device" openswap_keymount
- cryptsetup open $miscellaneous --key-file "openswap_keymount/$keyfile_filename" "$swap_device" "$crypt_swap_name"
+ mount $keyfile_device_mount_options "$keyfile_device" openswap_keymount
+ cryptsetup open $cryptsetup_options --key-file "openswap_keymount/$keyfile_filename" "$swap_device" "$crypt_swap_name"
umount openswap_keymount
fi
-} \ No newline at end of file
+}
diff --git a/openswap.install b/openswap.install
index db04155fe4cc..95d59a3d6d32 100644
--- a/openswap.install
+++ b/openswap.install
@@ -4,7 +4,8 @@ build ()
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 "miscellaneous=" /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"
@@ -23,4 +24,4 @@ help ()
cat<<HELPEOF
This hook opens a swap at boot time
HELPEOF
-} \ No newline at end of file
+}