summaryrefslogtreecommitdiffstats
path: root/rescue/restore-image-lib.sh
blob: 3451f7be57bcf0db727f920a2000a29c4943440e (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash

TITLE="%s Installer"
BACKTITLE="%s"
MIN_DISKSIZE=5000000

debug="/dev/null"

function _msgbox()
{
	dialog --timeout 60 --backtitle "$BACKTITLE" --title "$TITLE" --msgbox \
		"$1" 0 0

	return $?
}

function _infobox()
{
	dialog --backtitle "$BACKTITLE" --title "$TITLE" --sleep 2 \
		--infobox "$1" 0 0

	return $?
}

function _yesno()
{
	dialog --backtitle "$BACKTITLE" --title "$TITLE" \
		--yes-label "Yes" --no-label "No" --yesno "$1" 0 0

	return $?
}

function _mount()
{
	mount $1 $2 > $debug 2>&1

	return $?
}

function _umount()
{
	umount $1 > $debug 2>&1

	return $?
}

function _bind()
{
	mount --bind $1 $2 > $debug 2>&1

	return $?
}

function _eject()
{
	eject $1 > $debug 2>&1

	return $?
}

function _shutdown()
{
	[ -e /tmp/no-shutdown ] && exit
	clear
	sync
	echo s > /proc/sysrq-trigger
	echo o > /proc/sysrq-trigger
	exit
}

function _reboot()
{
	[ -e /tmp/no-shutdown ] && exit
	clear
	sync
	echo s > /proc/sysrq-trigger
	echo b > /proc/sysrq-trigger
	exit
}