aboutsummaryrefslogtreecommitdiff
path: root/rc.lib
blob: c7c8f84156e3eeec57a3e42a8949c2e4c28a5a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 ;}