-
Notifications
You must be signed in to change notification settings - Fork 26
/
repit-fs-swap.sh
78 lines (59 loc) · 1.79 KB
/
repit-fs-swap.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
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
#####################################################
# Lanchon REPIT - File System Handler #
# Copyright 2016, Lanchon #
#####################################################
#####################################################
# Lanchon REPIT is free software licensed under #
# the GNU General Public License (GPL) version 3 #
# and any later version. #
#####################################################
### swap
checkTools_fs_swap() {
# only require tools if actually needed
#checkTool mkswap
:
}
processPar_swap_wipe_dry() {
local n=$1
local dev=$2
local oldStart=$3
local oldSize=$4
local newStart=$5
local newSize=$6
info "will format the partition as swap area"
checkTool mkswap
}
processPar_swap_wipe_wet() {
local n=$1
local dev=$2
local oldStart=$3
local oldSize=$4
local newStart=$5
local newSize=$6
processParRecreate $n $oldStart $oldSize $newStart $newSize
info "formatting the partition as swap area"
mkswap $dev
}
processPar_swap_keep_dry() {
local n=$1
local dev=$2
local oldStart=$3
local oldSize=$4
local newStart=$5
local newSize=$6
if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then
fatal "cannot move or resize swap partitions "\
"(it makes no sense, please wipe the partition instead; note that you can still move the contents of any partition by using the 'raw' type)"
fi
}
processPar_swap_keep_wet() {
local n=$1
local dev=$2
local oldStart=$3
local oldSize=$4
local newStart=$5
local newSize=$6
if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then
fatal "assertion failed: cannot move or resize swap partitions"
fi
}