Skip to content

Commit

Permalink
add check that resize2fs in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
rzrbld committed Nov 11, 2022
1 parent 8181ff4 commit bb03af4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gadget_cdrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def __init__(self):

self._disp = disp
self._font = ImageFont.truetype(FONT, 13)
self._font_hdd = ImageFont.truetype(FONT, 32)
self._font_hdd = ImageFont.truetype(FONT, 26)


def refresh(self, state):
Expand All @@ -249,11 +249,18 @@ def refresh(self, state):
image = Image.new('1', (self._disp.WIDTH_RES, self._disp.HEIGHT_RES), "WHITE")
draw = ImageDraw.Draw(image)

if state.get_mode() in (MODE_HDD, MODE_SHUTDOWN, MODE_INIT):
if state.get_mode() in (MODE_HDD, MODE_SHUTDOWN):
draw.text((0,0), mode_text, font=self._font_hdd)
self._disp.display_image(image)
return

if state.get_mode() in (MODE_INIT):
draw.text((0,0), "INIT. plz wait.", font=self._font)
draw.text((0,15), "bpi will be", font=self._font)
draw.text((0,30), "auto reboot", font=self._font)
self._disp.display_image(image)
return

iso_name = state.inserted_iso()
if iso_name is None:
iso_name = ""
Expand Down
7 changes: 7 additions & 0 deletions init_iso_img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ if [ -f "$FILE" ]; then
exit 0
fi

resize2fs_status="$(systemctl is-enabled armbian-resize-filesystem)"
if [[ $resize2fs_status == "enabled" ]]; then
sleep 5
./$0
exit 1
fi

free="$(df -k / | tail -n1 | awk '{print $4}')"
size=$(($free-(1024*1024*2)))
if [ "$size" -lt "$((free/2))" ]; then
Expand Down

0 comments on commit bb03af4

Please sign in to comment.