aboutsummaryrefslogtreecommitdiff
path: root/rc.lib
diff options
context:
space:
mode:
Diffstat (limited to 'rc.lib')
-rw-r--r--rc.lib29
1 files changed, 29 insertions, 0 deletions
diff --git a/rc.lib b/rc.lib
new file mode 100644
index 0000000..c7c8f84
--- /dev/null
+++ b/rc.lib
@@ -0,0 +1,29 @@
+#
+# rc.lib
+#
+
+# vim:filetype=sh
+# shellcheck disable=1090
+
+# Functions for rc.boot and rc.shutdown
+
+out() { printf "\033[1;36m->\033[0;00m\033[1m$1\033[0;00m\n" ;}
+error() { printf "\033[1;31m-> ERROR: \033[0;00m\033[1m$1\033[0;00m\n" ;}
+welcome() { printf '\033[1;36m->\033[m\033[1m Welcome to\033[35m Carbs Linux\033[m\033[1m!\n' ;}
+
+mnt() {
+ mountpoint -q "$1" || {
+ dir=$1
+ shift
+ mount "$@" "$dir"
+ }
+}
+
+emergency_shell() {
+ error "Cannot continue init due to errors above, starting emergency shell"
+ error "When ready, type 'exit' to continue the boot."
+
+ /bin/sh -l
+}
+
+run_hooks() { for file in "$@" ; do [ -f "$file" ] && . "$file"; done ;}