summaryrefslogtreecommitdiff
path: root/src/backend/f_generic.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-11-04 06:12:14 +0000
committerV3n3RiX <venerix@redcorelinux.org>2017-11-04 06:12:14 +0000
commit8fbf0baee6a6b82876d43cef4abc34d021252d25 (patch)
tree23103fd1ff0aae03ab20229a035573c1df16a5fa /src/backend/f_generic.sh
parent8d25c02e51386bb0f463349e85400df9e07d94a7 (diff)
add Makefilev1.1710
Diffstat (limited to 'src/backend/f_generic.sh')
-rw-r--r--src/backend/f_generic.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/backend/f_generic.sh b/src/backend/f_generic.sh
new file mode 100644
index 0000000..d692c46
--- /dev/null
+++ b/src/backend/f_generic.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+checkifroot () {
+ if [[ "$(whoami)" != root ]] ; then
+ eerror "I won't do that, unless you're root!"
+ exit 1
+ fi
+}
+
+checkkerncfg () {
+ if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then
+ einfo "Kernel config OK, moving on"
+ else
+ eerror "I won't do that with the current kernel"
+ eerror "I want a kernel with OVERLAYFS && SQUASHFS && LOOP DEVICES enabled"
+ exit 1
+ fi
+}
+
+checkiflive () {
+ if [[ -L /dev/mapper/live-base ]] ; then
+ eerror "I won't do that on a live system"
+ exit 1
+ fi
+}
+
+checkjailsum () {
+ if [[ -f "$jailx64" && -f "$jailx64sum" ]] ; then
+ if [[ "$(md5sum -c "$jailx64sum")" ]] ; then
+ einfo "Jail integrity OK, moving on"
+ else
+ eerror "I won't do that with a corrupted jail"
+ exit 1
+ fi
+ else
+ eerror "I won't do that with a missing jail"
+ exit 1
+ fi
+}
+
+jaildkmsbuild () {
+ checkifroot
+ if [[ -x /usr/sbin/dkms ]] ; then
+ for i in $(dkms status | cut -d " " -f1,2 | sed -e 's/,//g' | sed -e 's/ /\//g' | sed -e 's/://g') ; do
+ dkms install $i
+ done
+ fi
+}