+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions installer-clientside/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Building the installer

This is sort of a mess. Make sure to do things in roughly exactly this
order. Otherwise things will go wrong. If you understand Node release
engineering I want to hear from you. Actually I don't, I just want a PR for
it. Thanks.
This is sort of a mess, but at least it's in a script now. If you understand
Node release engineering I want to hear from you. Actually I don't, I just want
a PR for it. Thanks.

* `pushd x1p-js; npm i; npm run build; popd`
* `pushd ../; make; ln -s ...whatever.../latest.x1p; popd`
* `pushd install-gui; npm i; bash pack-em-all.sh; popd`
Make sure the user running the following command is a member of the docker
group. Running with `sudo` will result in dubious ownership errors, so the
script will exit if you try to do so.
```./build.sh```

The output files should then be found in `install-gui/out/`

# Local MQTT test server

Expand Down
31 changes: 31 additions & 0 deletions installer-clientside/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#! /bin/bash

### THIS ONLY WORKS IF THE USER HAS BEEN ADDED TO THE DOCKER GROUP
### RUNNING THIS WITH `sudo ./build.sh` RESULTS IN DUBIOUS OWNERSHIP
### ERRORS WHEN BUILDING THE FIRMWARE
if [ "$EUID" -eq 0 ]; then
echo "Please do not run as root/with sudo. Exiting..."
exit 1
fi

cd ..
# check if x1plusbuild docker image exists
if ! docker image ls --format '{{.Repository}}' | grep -q '^x1plusbuild$'; then
echo "x1plusbuild docker image not found, building..."
docker build -t x1plusbuild scripts/docker/ || exit 1
fi

# build the installer
echo "Building the electron app..."
docker run -u "$(id -u)" -v "$(pwd)":/work x1plusbuild bash -c 'cd installer-clientside/x1p-js && npm i && npm run build' || exit 1

# build the firmware
echo "Building the latest firmware..."
[ -L latest.x1p ] && rm latest.x1p # delete the symlink to the old firmware before building the new one
docker run -u "$(id -u)" -v "$(pwd)":/work x1plusbuild bash -c 'make && ln -s "$(jq -r '.cfwVersion' ota.json).x1p" latest.x1p' || exit 1

# package the installer with the latest build of the firmware
echo "Packaging everything..."
docker run -u "$(id -u)" -v "$(pwd)":/work x1plusbuild bash -c 'cd installer-clientside/install-gui && npm i && bash pack-em-all.sh' || exit 1

cd installer-clientside || exit 1
26 changes: 26 additions & 0 deletions installer-clientside/install-gui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,32 @@ const legacyInstallSteps: InstallStep[] = [
];

const firmwareRInstallSteps: InstallStep[] = [
{
label: "SD card validation",
fn: async () => {
// Get the format of the sd card (expecting FAT32)
console.log("install: checking sd card format...");
props.intraStatus = "Checking SD card format...";
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("The SD card's partition scheme is unsupported. Format the SD card from the on-printer menu, then restart the installer.");
throw `The SD card's partition scheme is unsupported. Format the SD card from the on-printer menu, then restart the installer.`;
}
console.log("install: sd card is FAT32 formatted");

// confirm there is enough free space on the card
console.log("install: checking free space on sd card...");
props.intraStatus = "Checking free space on sd card...";
let numGB = 2 // number of GB
let gigabytes = 1048576 // bytes in a GB
result = await printer.sshClient.execCommand(`[ $(df -k /mnt/sdcard | awk 'NR==2 {print $4}') -gt ${numGB * gigabytes} ]`);
if (result.code != 0) {
console.log("Not enough space on card!");
throw `Not enough free space on card (>${numGB}GB required)!`;
}
console.log(`install: sd card has enough free space(>${numGB}GB required)`);
}
},
{
label: "Copying X1Plus setup files",
fn: async () => {
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载