Skip to content

Commit 9c5d244

Browse files
committed
Draft.
1 parent d3d305c commit 9c5d244

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

_prog-ops/ops-custom.sh

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,46 @@ _custom() {
33
}
44

55
_custom-expand() {
6-
true
6+
local currentExitStatus
7+
currentExitStatus="0"
8+
9+
_messageNormal '_custom-expand: dd'
10+
11+
# ATTENTION: Expand ONLY the additional amount needed for custom additions . This is APPENDED .
12+
! dd if=/dev/zero bs=1M count=1000 >> "$scriptLocal"/vm.img && _messageFAIL
13+
14+
# Alternatively, it may be possible, but STRONGLY DISCOURAGED, to pad the file to a size. This, however, assumes the upstream 'ubdist/OS', etc, has not unexpectedly grown larger, which is still a VERY BAD assumption.
15+
# https://unix.stackexchange.com/questions/196715/how-to-pad-a-file-to-a-desired-size
16+
17+
18+
_messageNormal '_custom-expand: growpart'
19+
! _openLoop && _messagePlain_bad 'fail: openLoop' && _messageFAIL
20+
21+
export ubVirtPlatform="x64-efi"
22+
#_determine_rawFileRootPartition
23+
24+
export ubVirtImagePartition="p5"
25+
26+
local current_imagedev=$(cat "$scriptLocal"/imagedev)
27+
local current_rootpart=$(echo "$ubVirtImagePartition" | tr -dc '0-9')
28+
29+
! _messagePlain_probe_cmd sudo -n growpart "$current_imagedev" "$current_rootpart" && _messageFAIL
30+
31+
unset ubVirtPlatform
32+
unset ubVirtImagePartition
33+
34+
! _closeLoop && _messagePlain_bad 'fail: closeLoop' && _messageFAIL
35+
36+
_messageNormal '_custom-expand: btrfs resize'
37+
! _openChRoot && _messagePlain_bad 'fail: openChRoot' && _messageFAIL
38+
39+
40+
! _messagePlain_probe_cmd _chroot btrfs filesystem resize max / && _messageFAIL
41+
42+
43+
! _closeChRoot && _messagePlain_bad 'fail: closeChRoot' && _messageFAIL
44+
45+
return 0
746
}
847

948
_custom-repo() {

0 commit comments

Comments
 (0)