Skip to content

Commit

Permalink
Merge pull request #74 from OneFinityCNC/v1.1.1-dev
Browse files Browse the repository at this point in the history
Merge the "v1.1.1-dev" branch
  • Loading branch information
dacarley authored Sep 14, 2022
2 parents 5acdc5f + 0ea001e commit 09095a0
Show file tree
Hide file tree
Showing 162 changed files with 8,347 additions and 9,202 deletions.
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))

NODE_MODS := $(DIR)/node_modules
PUG := $(NODE_MODS)/.bin/pug
STYLUS := $(NODE_MODS)/.bin/stylus

TARGET_DIR := build/http
HTML := index
Expand All @@ -16,14 +15,12 @@ GPLAN_MOD := rpi-share/camotics/gplan.so
GPLAN_TARGET := src/py/camotics/gplan.so
GPLAN_IMG := gplan-dev.img

RSYNC_EXCLUDE := \*.pyc __pycache__ \*.egg-info \\\#* \*~ .\\\#\*
RSYNC_EXCLUDE := $(patsubst %,--exclude %,$(RSYNC_EXCLUDE))
RSYNC_OPTS := $(RSYNC_EXCLUDE) -rv --no-g --delete --force
VERSION := $(shell jq -r '.version' package.json)
PY_VERSION := $(shell jq -r '.version' package.json | sed -E 's|([0-9]+)\.([0-9]+)\.([0-9]+)(-(b)eta\.(.*))?|\1.\2.\3\5\6|g')
PKG_NAME := dist/bbctrl-$(PY_VERSION).tar.bz2
FINAL_PKG_NAME := dist/onefinity-$(VERSION).tar.bz2

VERSION := $(shell sed -n 's/^.*"version": "\([^"]*\)",.*$$/\1/p' package.json)
PKG_NAME := bbctrl-$(VERSION)

SUBPROJECTS := avr boot pwr jig
SUBPROJECTS := avr boot pwr

ifndef HOST
HOST=onefinity
Expand All @@ -38,6 +35,7 @@ all: $(HTML) $(RESOURCES)

pkg: all $(AVR_FIRMWARE) bbserial
./setup.py sdist
mv $(PKG_NAME) $(FINAL_PKG_NAME)

bbserial:
$(MAKE) -C src/bbserial
Expand All @@ -61,8 +59,8 @@ $(AVR_FIRMWARE):
$(MAKE) -C src/avr

update: pkg
http_proxy= curl -i -X PUT -H "Content-Type: multipart/form-data" \
-F "firmware=@dist/$(PKG_NAME).tar.bz2" -F "password=$(PASSWORD)" \
curl -i -X PUT -H "Content-Type: multipart/form-data" \
-F "firmware=@$(FINAL_PKG_NAME)" -F "password=$(PASSWORD)" \
http://$(HOST)/api/firmware/update
@-tput sgr0 && echo # Fix terminal output

Expand Down
File renamed without changes.
File renamed without changes.
10,871 changes: 6,718 additions & 4,153 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "bbctrl",
"version": "1.1.0",
"name": "onefinity",
"version": "1.1.1",
"homepage": "https://onefinitycnc.com/",
"repository": "https://github.com/OneFinityCNC/onefinity",
"license": "GPL-3.0+",
"scripts": {
"postinstall": "cd src/svelte-components && npm i"
},
"devDependencies": {
"@aws-sdk/client-ssm": "^3.168.0",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"aws-cli": "^0.0.2",
"browserify": "^17.0.0",
"eslint": "^8.23.0",
"eslint-config-standard-with-typescript": "^22.0.0",
Expand All @@ -23,6 +25,8 @@
"jstransformer-scss": "^2.0.0",
"jstransformer-stylus": "^1.5.0",
"lodash.merge": "4.6.2",
"pug-cli": "^1.0.0-alpha6"
"node-fetch": "^2.6.7",
"pug-cli": "^1.0.0-alpha6",
"semver": "^7.3.7"
}
}
5 changes: 3 additions & 2 deletions scripts/create-sdcard-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ async function main() {

const { uid } = statSync(".");

const devices = runCommand("df -T msdos")
const devices = runCommand("df -H -T msdos")
.split("\n")
.filter(line => !line.includes("Filesystem"))
.map(line => {
const [ disk ] = line.split(/\s+/);
return {
Expand All @@ -38,5 +39,5 @@ async function main() {
runCommand(`dd if=${device} of=${IMAGE_FILENAME} status=progress`, {
stdio: "inherit"
});
runCommand(`chown ${uid} 1f.img`);
runCommand(`chown ${uid} ${IMAGE_FILENAME}`);
}
29 changes: 24 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ UPDATE_AVR=true
UPDATE_PY=true
REBOOT=false

remove_services() {
for service in "$@"
do
systemctl stop "${service}.service"
systemctl disable "${service}.service"
find /etc/systemd -name "${service}.service" -exec rm -f {} \;
done
}

while [ $# -gt 0 ]; do
case "$1" in
--no-avr) UPDATE_AVR=false ;;
Expand All @@ -27,7 +36,13 @@ if $UPDATE_AVR; then
./installer/scripts/avr109-flash.py src/avr/bbctrl-avr-firmware.hex
fi

# Update config.txt
# Set a default time-zone, if one has not been set
timedatectl | grep 'Time zone: Etc/UTC' >/dev/null
if [ $? -eq 0 ]; then
timedatectl set-timezone America/Los_Angeles
fi

# Update /boot/config.txt
./installer/scripts/edit-boot-config \
disable_overscan=1 \
framebuffer_width=1280 \
Expand Down Expand Up @@ -85,6 +100,8 @@ if [ $? -ne 0 ]; then
update-locale en_US.UTF-8
fi

localectl set-locale LC_TIME=en_US.UTF-8

# Setup USB stick automount
diff ./installer/config/11-automount.rules /etc/udev/rules.d/11-automount.rules >/dev/null
if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -177,9 +194,10 @@ if $UPDATE_PY; then
fi

# Install the service that turns off the screen during shutdown
cp ./installer/config/bbctrl-poweroff.service /etc/systemd/system/
remove_services bbctrl-poweroff onefinity-poweroff
cp ./installer/config/onefinity-poweroff.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable bbctrl-poweroff
systemctl enable onefinity-poweroff

# Expand the file system if necessary
chmod +x ./installer/scripts/resize_root_fs.sh
Expand All @@ -189,8 +207,9 @@ if [ $? -eq 0 ]; then
fi

# Install our logrotate config
cp ./installer/config/bbctrl-logrotate /etc/logrotate.d/bbctrl
chown root:root /etc/logrotate.d/bbctrl
rm -f /etc/logrotate.d/{bbctrl,onefinity}
cp ./installer/config/onefinity-logrotate /etc/logrotate.d/onefinity
chown root:root /etc/logrotate.d/onefinity

# Ensure logrotate runs on every boot (for systems with no network, thus bad clock)
if [ ! -e /etc/cron.d/reboot ]; then
Expand Down
19 changes: 0 additions & 19 deletions scripts/next-rc

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/prep-controller-for-imaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const inquirer = require("inquirer");
const { runCommand, logErrorAndExit, initSignalHandlers, assertInstalled, info } = require("./util");

const PACKAGES_TO_PURGE = [
"aptitude",
"dphys-swapfile",
"gdb",
"geoip-database",
Expand Down Expand Up @@ -47,6 +48,7 @@ async function main() {
});

ssh("apt-get update");
ssh("apt-get install usbutils");
ssh(`apt-get purge -y ${PACKAGES_TO_PURGE.join(" ")}`);
ssh("apt-get autoremove -y");
ssh("touch /root/.prep-controller-completed");
Expand Down
1 change: 1 addition & 0 deletions scripts/prep-sd-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const REQUIRED_TOOLS = [
];

const SYSTEM_FILES = [
"/media/*",
"/tmp/*",
"/usr/**/__pycache__",
"/usr/**/*.py[co]",
Expand Down
Loading

0 comments on commit 09095a0

Please sign in to comment.