+
Skip to content

Conversation

shitwolfymakes
Copy link
Contributor

This PR add a new step to the client-side installer. The new step does the following:

  1. Checks the filesystem on the SD card to ensure it is already formatted as FAT32. If not, it stops the installation process and notifies the user.
  2. Checks the available space on the SD card to ensure there is enough room to install X1+. The default install size is ~1.5Gb, so I set the check for >2GB to leave room to grow, and an easy way to modify that check in the code later on. If there is not enough room on the SD card, it stops the installation process and notifies the user.

This PR could be extended to implement #107, but if that is a no-go then that issue can be closed as rejected with the merge of this PR in its current state.

I have tested the new installer and confirmed that it's working.

let result = await printer.sshClient.execCommand("SDCARDDEV=$(df -Th /mnt/sdcard | awk 'NR==2 {print $1}') ; fsck.vfat -n $SDCARDDEV | grep -q FAT32");
if (result.code != 0) {
console.log("SD card is NOT FAT32 formatted!");
throw `SD card is NOT FAT32 formatted!`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not just error, we should tell the user what to do. use the same language as installer/install.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I've fixed this in a4a0db9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that commit does not appear to be on the branch to pull?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fsck.vfat is not really the way to do this (blkid probably is fine), but more to the point, this does not actually check the same thing as install.py, nor does it check the partition table; this check could pass and install.py could still reject the SD card.

relatedly, this seems like the sort of thing that we could detect before tripping on the installer? it seems in particular like the sort of thing that could error in connectSsh, before the user even gets as far as clicking install and then having to exit and restart the installer to recover...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that commit does not appear to be on the branch to pull?

My bad, committed it to a different branch on accident. Good catch! Fixed with b01b9e4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fsck.vfat is not really the way to do this (blkid probably is fine), but more to the point, this does not actually check the same thing as install.py, nor does it check the partition table; this check could pass and install.py could still reject the SD card.

relatedly, this seems like the sort of thing that we could detect before tripping on the installer? it seems in particular like the sort of thing that could error in connectSsh, before the user even gets as far as clicking install and then having to exit and restart the installer to recover...

The check here is basically identical? validate_sd() checks if the filesystem is vfat. The command I wrote goes a step further and confirms that the fs is FAT32, as vfat applies to FAT32, FAT16, etc.

We could check earlier in the install process, but adding it here offered the cleanest drop-in of new code, without affecting anything else.

@riptidewave93
Copy link
Contributor

LGTM but one small bit of feedback

@shitwolfymakes
Copy link
Contributor Author

@jwise ready to merge unless you want me to add formatting as a hidden advanced object while I'm working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载