Commit 4cfedbe 1 parent d4bb307 commit 4cfedbe Copy full SHA for 4cfedbe
File tree 4 files changed +22
-5
lines changed
4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 17
17
submodules : recursive
18
18
19
19
- name : Install dependencies
20
- run : sudo apt-get update && sudo apt-get install -y binfmt-support file kpartx lsof p7zip-full parted qemu qemu-user-static unzip wget xz-utils
20
+ run : sudo apt-get update && sudo apt-get install -y binfmt-support file kpartx lsof p7zip-full parted qemu qemu-user-static unzip wget xz-utils units
21
21
shell : bash
22
22
23
23
- name : Run pimod OpenWRT example
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ RUN apt-get update && \
16
16
qemu-user-static \
17
17
unzip \
18
18
wget \
19
- xz-utils
19
+ xz-utils \
20
+ units
20
21
21
22
RUN mkdir /pimod
22
23
COPY . /pimod/
Original file line number Diff line number Diff line change 14
14
steps :
15
15
- run : sudo apt-get update
16
16
shell : bash
17
- - run : sudo apt-get install -y binfmt-support file kpartx parted qemu qemu-user-static unzip p7zip-full wget xz-utils
17
+ - run : sudo apt-get install -y binfmt-support file kpartx parted qemu qemu-user-static unzip p7zip-full wget xz-utils units
18
18
shell : bash
19
19
- run : sudo ${{ github.action_path }}/pimod.sh ${{ inputs.pifile }}
20
20
shell : bash
Original file line number Diff line number Diff line change 1
1
# PUMP increases the image's size about the given amount of megabytes.
2
2
#
3
- # Usage: PUMP SIZE_IN_MB
3
+ # Usage: PUMP SIZE
4
4
PUMP () {
5
5
if [[ -b " ${DEST_IMG} " ]]; then
6
6
echo -e " \033[0;31m### Error: Block device ${DEST_IMG} cannot be pumped.\033[0m"
7
7
return 1
8
8
fi
9
9
10
10
echo -e " \033[0;32m### PUMP ${1} \033[0m"
11
- dd if=/dev/zero bs=" ${1} " count=1 >> " ${DEST_IMG} "
11
+
12
+ BS=" 1M"
13
+
14
+ # units does not print to stderr, thus test call before using output
15
+ echo -n " pump conversion to ${BS} * "
16
+ units -t " ${1} B" " ${BS} B"
17
+
18
+ COUNT=$( units -t ${1} B ${BS} B)
19
+
20
+ # Ceil the number if a decimal is given.
21
+ if [[ " ${COUNT} " == * .* ]]; then
22
+ COUNT=$(( $(echo "${COUNT} " | cut - d. - f1 ) + 1 ))
23
+ fi
24
+
25
+ echo " pump ceil: ${BS} * ${COUNT} "
26
+
27
+ dd if=/dev/zero bs=" ${BS} " count=" ${COUNT} " >> " ${DEST_IMG} "
12
28
13
29
# Fix the GPT if necessary and resize the partition afterwards.
14
30
# The fix is currently kind of hackish..
You can’t perform that action at this time.
0 commit comments