forked from hetzneronline/installimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.functions.sh
42 lines (36 loc) · 887 Bytes
/
helper.functions.sh
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
41
42
#!/usr/bin/env bash
#
# helper functions
#
# (c) 2016-2018, Hetzner Online GmbH
#
execute_command_wo_debug() {
if installed_os_uses_systemd; then
systemd_nspawn_wo_debug "$@"
return $?
fi
execute_chroot_command_wo_debug "$@"
}
execute_command() {
if installed_os_uses_systemd; then
systemd_nspawn "$@"
return $?
fi
execute_chroot_command "$@"
}
grub_install_devices() {
for ((i=1; i<=COUNT_DRIVES; i++)); do
[[ "$SWRAID" == '0' ]] && ((i != 1)) && continue
eval echo "\$DRIVE$i"
done
}
# Hetzner images come with an empty resume file
disable_resume() {
if [[ -s "$FOLD/hdd/etc/initramfs-tools/conf.d/resume" ]]; then
debug '# disable resume'
echo 'RESUME=none' > "$FOLD/hdd/etc/initramfs-tools/conf.d/resume"
return 0
fi
debug '# not disabling resume, /etc/initramfs-tools/conf.d/resume not empty'
}
# vim: ai:ts=2:sw=2:et