-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions
40 lines (34 loc) · 898 Bytes
/
functions
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
30
31
32
33
34
35
36
37
38
39
40
msg() {
# bold
printf '\033[1m=> %s\033[m\n' "$@"
}
msg_ok() {
# bold/green
printf '\033[1m\033[32m OK\033[m\n'
}
msg_error() {
# bold/red
printf '\033[1m\033[31mERROR: %s\033[m\n' "$@"
}
msg_warn() {
# bold/yellow
printf '\033[1m\033[33mWARNING: %s\033[m\n' "$@"
}
emergency_shell() {
printf '\n'
printf 'Cannot continue due to errors above, starting emergency shell.\n'
printf 'When ready type exit to continue booting.\n'
/bin/sh -l
}
cmd() {
for cmd in "$@"; do
command -pv "$cmd" >/dev/null 2>&1 || return "$?"
done
}
mnt() {
# If the filesystem is already mounted, mount it again with
# 'remount' so that it uses the correct mount options. This is
# usually the case when dealing with an initramfs for example.
mountpoint -q "$4" && set -- "remount,$1" "$2" "$3" "$4"
mount -o "$1" -t "$2" "$3" "$4"
}