Compare commits

...
Sign in to create a new pull request.

131 commits

Author SHA1 Message Date
jalr
e6f23d798c Merge branch 'fix-conditional-build' into 'main'
Fix conditional build

See merge request fablab/labsync!83
2023-10-05 19:11:44 +00:00
Jakob Lechner
f6070572fa
Build security-scanner image only when necessary 2023-10-04 15:50:13 +00:00
Jakob Lechner
8e8647fdbd
Fix path matching 2023-10-04 15:33:44 +00:00
Jakob Lechner
0acc97e09e
Print docker images 2023-10-04 15:33:42 +00:00
jalr
ec6ab11c75 Merge branch 'build-docker-image-conditionally' into 'main'
Build docker image only when necessary

See merge request fablab/labsync!82
2023-10-02 15:37:59 +00:00
Jakob Lechner
a649d9686e
Build docker image only when necessary 2023-10-01 20:26:16 +00:00
jalr
f4eee886e9 Merge branch 'prusa-slicer' into 'main'
Prusa slicer

See merge request fablab/labsync!81
2023-09-28 17:35:32 +00:00
Jakob Lechner
71122c46b6
Add Ultimaker2 to Prusa slicer 2023-09-14 22:31:04 +00:00
Jakob Lechner
9e1f29dfd9
Download PrusaSlicer from GitHub 2023-09-14 22:31:02 +00:00
Jakob Lechner
d372cd9f09
Move prusa-slicer to own role 2023-09-14 21:47:22 +00:00
jalr
c04f57309b Merge branch 'lightburn-without-docker' into 'main'
Lightburn without docker

See merge request fablab/labsync!80
2023-09-14 19:57:10 +00:00
Jakob Lechner
dbb05df99f
Remove tags 2023-09-14 19:23:01 +00:00
Jakob Lechner
27ec180b79
Use lightburn without docker 2023-09-14 19:22:55 +00:00
Jakob Lechner
1e0e997f17
Update tags
The `dedicated` runner was removed
2023-07-13 10:22:20 +00:00
jalr
23529c78d9 Merge branch 'fix-ci' into 'main'
Rename CI token variable

See merge request fablab/labsync!79
2023-07-13 02:13:56 +00:00
Jakob Lechner
76da536bbd
Rename CI token variable 2023-07-13 02:10:45 +00:00
jalr
8f69e9a2d4 Merge branch 'update-inkscape-silhouette' into 'main'
Update inkscape-silhouette

See merge request fablab/labsync!78
2023-04-11 18:35:26 +00:00
Jakob Lechner
6f52c72093
Update inkscape-silhouette 2023-04-06 23:09:12 +00:00
jalr
ce78ff70c1 Merge branch 'remove-platformio' into 'main'
Disable platformio

See merge request fablab/labsync!77
2023-03-12 21:20:40 +00:00
Jakob Lechner
2db45a612b
Disable platformio
pip install without venv is not possible on bookworm. As I don't want to
fix it now, let's remove it until I have time to fix it properly.
2023-03-12 21:19:45 +00:00
jalr
61a68b6b4c Merge branch 'fix-security-scanner' into 'main'
Use virtualenv for security-scanner

See merge request fablab/labsync!76
2023-03-09 23:55:40 +00:00
Jakob Lechner
f64f9028bb
Use virtualenv 2023-03-09 23:54:57 +00:00
jalr
1dd450e0ee Merge branch 'bookworm' into 'main'
Debian bookworm

See merge request fablab/labsync!75
2023-03-03 01:04:50 +00:00
Jakob Lechner
1c158dcca2
Add font viewer 2023-02-17 18:17:37 +00:00
Jakob Lechner
2835e9380a
Remove firmware-and-graphics package
as it is not available on bookworm.
2023-02-12 00:44:22 +00:00
Jakob Lechner
db9fc6af8b
Remove HTTPS Everywhere
It is no longer maintained by EFF and deprecated in favour of native
browser support.
2023-02-11 23:10:35 +00:00
Jakob Lechner
14e7d09c69
Set wiki as homepage 2023-02-11 22:48:05 +00:00
Jakob Lechner
9c822bbba7
Update to Debian bookworm 2023-02-11 22:48:03 +00:00
jalr
1e2beafd0f Merge branch 'fix-scp-error' into 'main'
Fix Ansible file transfer issue

See merge request fablab/labsync!74
2023-01-01 16:44:05 +00:00
Jakob Lechner
5c507550a1
Fix Ansible file transfer issue
Fixes `failed to transfer file` issue

See https://github.com/hashicorp/packer/issues/11783
2023-01-01 15:04:13 +00:00
jalr
14f8fbf150 Merge branch 'tabbed-box-maker' into 'main'
Add tabbed box maker

See merge request fablab/labsync!73
2022-05-19 16:21:07 +00:00
Jakob Lechner
0394230c58
Add tabbed box maker
https://github.com/paulh-rnd/TabbedBoxMaker
2022-05-13 19:35:03 +00:00
jalr
de50264c09 Merge branch 'revert-trigger-labsync-generator' into 'main'
Revert "Trigger labsync generator when upload is done"

See merge request fablab/labsync!72
2022-01-07 04:32:43 +00:00
Jakob Lechner
632387dfd1
Revert "Trigger labsync generator when upload is done"
This reverts commit d443e880d5.

While the pipeline is still running, labsync generator can't retrieve
its result as it is not yet marked as successfully finished.

Therefore, it is easier to use a webhook instead
2022-01-07 04:22:12 +00:00
Jakob Lechner
b5417f998a
Use main as default branch 2022-01-07 01:45:54 +00:00
jalr
0d0ec877eb Merge branch 'prusaslicer' into 'master'
Add Prusa slicer settings

See merge request fablab/labsync!71
2022-01-07 01:36:22 +00:00
Jakob Lechner
ca6efe499a
Add Prusa slicer settings 2022-01-07 00:02:45 +00:00
jalr
77d075e3a6 Merge branch 'lightburn' into 'master'
Replace MetalCut with LightBurn

Closes #18

See merge request fablab/labsync!70
2022-01-06 23:21:22 +00:00
Jakob Lechner
7c96f8ce13
Replace MetalCut with LightBurn
As we replaced the Ruida controller with a Duet 3 Mini 5+
2022-01-06 18:15:44 +00:00
jalr
ead80800c6 Merge branch 'implement-generator-trigger' into 'master'
Trigger labsync generator when upload is done

See merge request fablab/labsync!69
2022-01-06 12:15:12 +00:00
Jakob Lechner
d443e880d5
Trigger labsync generator when upload is done 2022-01-06 12:14:02 +00:00
jalr
35232ca3c0 Merge branch 'fix-missing-sfdisk-in-initramfs' into 'master'
Fix missing sfdisk binary in initramfs

See merge request fablab/labsync!68
2022-01-04 19:40:15 +00:00
Jakob Lechner
49463b2775
Fix partition size calculation 2022-01-04 18:16:49 +00:00
Jakob Lechner
6174d4beac
Fix missing sfdisk binary in initramfs
It's now part of `fdisk` package
2022-01-04 17:01:24 +00:00
jalr
82eb6ca0a7 Merge branch 'bullseye' into 'master'
Bullseye

Closes #24

See merge request fablab/labsync!67
2022-01-04 11:13:27 +00:00
jalr
aa2072c11d Use python3 compatible inkscape-silhouette plugin 2021-12-28 13:35:04 +00:00
jalr
cccc411fab Replace package python-usb with python3-usb 2021-12-28 01:49:11 +00:00
jalr
e5fe1ea800 Change debian-security source 2021-12-28 01:49:11 +00:00
jalr
fdc0441013 Use python3 for ansible 2021-12-28 01:49:11 +00:00
jalr
8519cbbd05 Allow rsa keys for ssh 2021-12-28 01:49:11 +00:00
jalr
49f8c7879d Update to Debian bullseye 2021-12-28 01:49:11 +00:00
jalr
b2dc17fa20 Merge branch 'fix-build-packer' into 'master'
Fix packer not being found in builder image

See merge request fablab/labsync!66
2021-07-18 09:39:54 +00:00
7de5bf2a04
Fix packer not being found in builder image 2021-07-18 11:07:44 +02:00
jalr
ef6d9c5d5c Merge branch 'fix-google-fonts' into 'master'
Update google fonts download url

See merge request fablab/labsync!65
2021-05-15 18:33:43 +00:00
jalr
a5a60f5ab7 Update google fonts download url 2021-05-15 17:41:10 +02:00
jalr
9ebab8df96 Merge branch 'remove-opentracker' into 'master'
Remove opentracker

Closes #22

See merge request fablab/labsync!64
2020-08-16 12:02:15 +00:00
056b50b4d1
Remove opentracker
Fixes #22 when tftpgen migration is done.
2020-08-14 13:57:34 +02:00
jalr
e5a27b3ffd Merge branch 'platformio' into 'master'
Add platformio (fixes #16)

Closes #16

See merge request fablab/labsync!62
2020-08-13 16:07:36 +00:00
jalr
e2a76b6be0 Merge branch 'simplify-builder' into 'master'
builder: Use packer and ansible from alpine

See merge request fablab/labsync!63
2020-08-13 16:06:33 +00:00
jalr
112a2a4d94 Merge branch 'editorconfig' into 'master'
Use EditorConfig instead of vim configuration

See merge request fablab/labsync!60
2020-08-13 16:04:41 +00:00
ebc3ed539d
Add platformio 2020-08-06 17:27:46 +02:00
151de4521f
builder: Use packer and ansible from alpine 2020-08-06 17:19:16 +02:00
6211d3f7f5
Use EditorConfig instead of vim configuration 2020-08-06 17:15:13 +02:00
jalr
dc5259c469 Merge branch 'fix-build' into 'master'
Fix build

See merge request fablab/labsync!59
2020-07-24 22:16:33 +00:00
d36e99e27f
Install awscli from alpine in builder 2020-07-23 18:53:35 +02:00
bff3b42838
Fix pip not being present in builder 2020-07-23 18:19:03 +02:00
jalr
d684b888a5 Merge branch 's3webseed' into 'master'
S3 webseed

See merge request fablab/labsync!58
2020-01-24 20:58:32 +00:00
Jakob Lechner
77ba548a73 squashfs: Use zstd instead of lzo 2020-01-24 21:54:55 +01:00
Jakob Lechner
762869b77c Write image names to image.txt 2020-01-24 21:54:55 +01:00
Jakob Lechner
7ec88bfe39 Add CI_COMMIT_REF_SLUG as s3 path component 2020-01-24 21:54:55 +01:00
Jakob Lechner
e45191e3c2 Add s3 upload 2020-01-24 21:54:55 +01:00
Jakob Lechner
e43f34991d Use yaml for packer job description 2020-01-24 21:54:55 +01:00
Jakob Lechner
33ccd59f2c Fix missing permissions on docker socket 2020-01-24 21:54:55 +01:00
Jakob Lechner
564a2c48d2 Update packer and ansible version 2020-01-24 21:54:55 +01:00
aedcc9d9bc Minimise docker layers 2020-01-24 21:54:55 +01:00
jalr
3e89556ae6 Merge branch 'local-vimrc' into 'master'
Add local vimrc to unify code style

See merge request fablab/labsync!57
2019-11-21 17:57:17 +00:00
f9b09360bf
Add local vimrc to unify code style 2019-11-20 13:13:29 +00:00
1d7af34c83 Merge branch 'fonts' into 'master'
Add google fonts

Closes #14

See merge request fablab/labsync!54
2019-11-01 17:40:07 +00:00
e4013d569f Merge branch 'artwork' into 'master'
Update artwork

See merge request fablab/labsync!53
2019-11-01 17:23:43 +00:00
14bcfc7807 Merge branch 'secure-packer' into 'master'
Verify packer checksum and signature

See merge request fablab/labsync!56
2019-11-01 14:22:57 +00:00
0357b8dc22 Merge branch 'artifacts-index' into 'master'
Add manual artifacts index to work around gitlab api limitations

See merge request fablab/labsync!55
2019-11-01 13:58:38 +00:00
50a4a2c9d4
Add manual artifacts index to work around gitlab api limitations 2019-11-01 13:03:41 +00:00
b80b030d36
Verify packer checksum and signature 2019-11-01 12:56:09 +00:00
36fde02e09
Add google fonts 2019-10-31 20:59:03 +00:00
611966044c
Update artwork 2019-10-31 18:15:23 +00:00
jalr
cee9979679 Merge branch 'fix-localboot' into 'master'
Fix localboot

See merge request fablab/labsync!52
2019-09-26 19:48:37 +00:00
jalr
a80d3cbe64 Update packer 2019-09-20 00:39:06 +02:00
jalr
b4f8c5601a Fix vg not active on local boot 2019-09-19 21:33:25 +02:00
jalr
1466bc09d1 Set GRUB timeout to 1s for local boot 2019-09-19 21:32:51 +02:00
jalr
4b6bafbae5 Merge branch 'fix-mktorrent' into 'master'
mktorrent binary was renamed

See merge request fablab/labsync!51
2019-08-15 21:34:01 +00:00
jalr
370e4e62a3 mktorrent binary was renamed 2019-08-15 23:33:24 +02:00
jalr
23996e299f Merge branch 'fix-docker-in-ci' into 'master'
Fix docker in ci

See merge request fablab/labsync!50
2019-08-15 20:50:20 +00:00
jalr
5b51b2d742 Use generator instead of pagination 2019-08-15 22:49:43 +02:00
jalr
20202f12fa Tag local images with branch name per default 2019-08-15 22:49:04 +02:00
jalr
0a6d9ee69e Disable TLS for Docker 2019-08-15 22:19:58 +02:00
jalr
92e124ffdc Merge branch 'buster' into 'master'
Buster

See merge request fablab/labsync!49
2019-08-15 20:06:14 +00:00
jalr
01186e458a Add haveged to initramfs 2019-06-21 17:16:36 +02:00
jalr
29bb770672 Revert "Replace aria2c with wget"
This reverts commit 208b96d8b6.
2019-06-21 17:12:32 +02:00
jalr
208b96d8b6 Replace aria2c with wget
for downloading the torrent file
2019-06-13 21:24:51 +02:00
jalr
0c4fc7bfc8 Force replacement of mke2fs 2019-05-29 21:47:52 +02:00
jalr
686147685f Exclude apt lists and packages 2019-05-29 21:47:03 +02:00
jalr
0097e0a85b Use python3; Update ansible 2019-05-29 21:10:14 +02:00
jalr
69b7cace48 spawn a shell on pause 2019-05-29 21:10:14 +02:00
jalr
e0c020f531 Fix entry etc already used 2019-04-03 22:05:29 +02:00
jalr
7ff816bea1 Add cups 2019-04-03 21:37:29 +02:00
jalr
6cd4cd2b05 Add slic3r for prusa 2019-04-03 21:37:29 +02:00
jalr
b4fbbf26ce Use debian package to install docker 2019-04-03 21:37:29 +02:00
jalr
1c3b583d80 Use debian package to install cura 2019-04-03 21:09:30 +02:00
jalr
600d1e537b Tag docker images with CI_COMMIT_REF_SLUG 2019-04-03 21:09:29 +02:00
jalr
b92561806e Update debian stretch to buster 2019-04-03 21:09:29 +02:00
jalr
751a4661b5 Merge branch 'fix-security-scanner' into 'master'
Fix security scanner

See merge request fablab/labsync!48
2019-01-15 20:54:56 +00:00
jalr
a8851a23d3 Fix security scanner 2019-01-15 21:53:47 +01:00
jalr
dba60b2917 Merge branch 'downgrade-docker' into 'master'
Downgrade docker because device-mapper driver is broken

See merge request fablab/labsync!47
2018-11-23 03:34:48 +00:00
jalr
2265bfd66a Downgrade docker because device-mapper driver is broken 2018-11-22 23:51:08 +01:00
jalr
a0f77e294e Merge branch 'firefox' into 'master'
add firefox config and extensions

See merge request fablab/labsync!44
2018-11-08 23:12:14 +00:00
jalr
1c1c00aeb7 Merge branch 'customizable-greeting' into 'master'
make greeting at guest login customizable

See merge request fablab/labsync!15
2018-11-08 21:17:07 +00:00
jalr
96b24590bf Merge branch 'background-image' into 'master'
move wallpaper to more suitable location

See merge request fablab/labsync!45
2018-11-08 21:16:50 +00:00
b0e3e6d240
firefox: add settings for experienced users 2018-11-08 20:27:59 +00:00
b61b7bd9b8
firefox: only accept cookies from visited third parties 2018-11-08 20:26:16 +00:00
b2a5fb222c
replace ssh-key 2018-11-08 20:22:35 +00:00
ae708d423e
always download latest extension version 2018-11-08 20:21:41 +00:00
12dadfa52d
move wallpaper to more suitable location 2018-11-08 16:22:11 +00:00
27d96070df
add firefox config and extensions 2018-11-08 16:15:03 +00:00
aa84b39665
make guest login greeting customizable 2018-11-08 16:14:00 +00:00
49bc44cad2 Merge branch 'fix-labsync-seeder' into 'master'
Fix labsync seeder

See merge request fablab/labsync!40
2018-10-25 15:56:37 +00:00
47a69024e5
do not fail if squashfs torrent does not exist 2018-10-25 14:30:39 +00:00
9df091f954
remove squashfs symlink before creating it again 2018-10-25 14:30:38 +00:00
620da5bddd
always restart labsync-seeder.service 2018-10-25 14:30:38 +00:00
f223a349da
keep aria2 control file and use it for labsync-seeder service 2018-10-25 14:30:37 +00:00
jalr
eb38c404bb Merge branch 'firefox' into 'master'
Add firefox role

Closes #11

See merge request fablab/labsync!43
2018-10-23 20:04:56 +00:00
jalr
8181dab07c Add firefox role
Includes firefox localizations, fixes #11
2018-10-23 22:03:58 +02:00
76 changed files with 2541 additions and 1777 deletions

9
.editorconfig Normal file
View file

@ -0,0 +1,9 @@
root = true
[packer/initramfs/labsync*]
indent_style = tab
indent_size = 4
[Dockerfile]
indent_style = tab
indent_size = 4

2
.gitignore vendored
View file

@ -2,4 +2,6 @@
/**/ansible/inventories/test/
/bin
/images
/images.txt
/tmp
packer/*.json

View file

@ -3,36 +3,44 @@ image: docker:latest
variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
PACKER_VERSION: 1.2.0
PACKER_VERSION: 1.4.3
ANNOUNCE: http://labsync.lab.fablab-nea.de:6969/announce
WEBSEED: http://labsync.lab.fablab-nea.de/labsync/$CI_COMMIT_REF_NAME/$CI_PIPELINE_ID/images
DOCKER_IMAGE_BUILDER: ${CI_REGISTRY_IMAGE}/labsync-builder:$CI_COMMIT_REF_SLUG
DOCKER_IMAGE_SECURITY_SCANNER: ${CI_REGISTRY_IMAGE}/security-scanner:$CI_COMMIT_REF_SLUG
DOCKER_IMAGE_BUILDER: ${CI_REGISTRY_IMAGE}/labsync-builder:main
DOCKER_IMAGE_SECURITY_SCANNER: ${CI_REGISTRY_IMAGE}/security-scanner:main
DOCKER_TLS_CERTDIR: ""
stages:
- prepare
- check
- build
dockerimage_builder:
stage: prepare
before_script:
- apk add --no-cache make
services:
- docker:dind
variables:
DOCKER_IMAGE_BUILDER: ${CI_REGISTRY_IMAGE}/labsync-builder:$CI_COMMIT_REF_SLUG
script:
- docker pull $DOCKER_IMAGE_BUILDER || true
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- make builderimg
- docker push $DOCKER_IMAGE_BUILDER
tags:
- fablab
- ssd
except:
refs:
- schedules
- echo "DOCKER_IMAGE_BUILDER=$DOCKER_IMAGE_BUILDER" >> build.env
artifacts:
reports:
dotenv: build.env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
- if:
changes:
paths:
- builder/**/*
compare_to: main
when: on_success
dockerimage_security_scanner:
stage: prepare
@ -42,15 +50,22 @@ dockerimage_security_scanner:
- docker:dind
script:
- docker pull $DOCKER_IMAGE_SECURITY_SCANNER || true
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- make secscanimg
- docker push $DOCKER_IMAGE_SECURITY_SCANNER
tags:
- fablab
- ssd
except:
refs:
- schedules
- echo "DOCKER_IMAGE_SECURITY_SCANNER=${CI_REGISTRY_IMAGE}/security-scanner:$CI_COMMIT_REF_SLUG" >> build.env
artifacts:
reports:
dotenv: build.env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
- if:
changes:
paths:
- security-scanner/**/*
compare_to: main
when: on_success
security_scanner:
stage: check
@ -58,7 +73,7 @@ security_scanner:
script:
- set -x
- export GITLAB_URL="$(echo "$CI_PROJECT_URL" | grep -Eo '^https?://[^/]*')"
- security-scanner $target
- /code/venv/bin/python -m security_scanner $target
only:
refs:
- schedules
@ -66,41 +81,54 @@ security_scanner:
variables:
- $task == "security-scanner"
- $target
tags:
- dedicated
.squashfs_template: &squashfs_template
stage: build
before_script:
- apk add --no-cache make
services:
- docker:dind
lightburn-download:
stage: prepare
image: alpine
script:
- make images/debian-stretch.squashfs
- mkdir -p packer/ansible/roles/lightburn/files
- 'wget -O packer/ansible/roles/lightburn/files/lightburn.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_SERVER_URL}/api/v4/projects/fablab%2Flightburn-patched/jobs/artifacts/main/download?job=patch-Linux64"'
artifacts:
paths:
- images
tags:
- fablab
- ssd
- packer/ansible/roles/lightburn/files/lightburn.zip
expire_in: 4 hours
.squashfs_template: &squashfs_template
image: $DOCKER_IMAGE_BUILDER
stage: build
services:
- docker:dind
script:
- echo DOCKER_IMAGE_BUILDER=$DOCKER_IMAGE_BUILDER
- echo DOCKER_IMAGE_SECURITY_SCANNER=$DOCKER_IMAGE_SECURITY_SCANNER
- scripts/packer.sh debian-bookworm
- aws --endpoint-url "$AWS_ENDPOINT_URL" s3 cp images/ "s3://$AWS_BUCKET/$CI_COMMIT_REF_SLUG/$CI_JOB_ID/" --recursive --no-progress
artifacts:
paths:
- images.txt
- images/*.dpkg-list
- images/*.initramfs
- images/*.linux
#- images/*.squashfs
- images/*.torrent
squashfs_featurebranch:
<<: *squashfs_template
variables:
COMPRESSION_LEVEL: 5
COMPRESSION_LEVEL: 4
except:
variables:
- $task == "security-scanner"
refs:
- master
- main
squashfs_master:
squashfs_main:
<<: *squashfs_template
variables:
COMPRESSION_LEVEL: 7
COMPRESSION_LEVEL: 15
only:
refs:
- master
- main
except:
variables:
- $task == "security-scanner"

View file

@ -1,9 +1,11 @@
PACKER_VERSION ?= 1.2.0
ANNOUNCE ?= http://10.2.2.1:6969/announce
PACKER_VERSION ?= 1.5.1
ANSIBLE_VERSION ?= 2.9.2
WEBSEED ?= http://10.2.2.1
DOCKER_IMAGE_BUILDER ?= labsync-builder
DOCKER_IMAGE_SECURITY_SCANNER ?= security-scanner
CI_COMMIT_REF_SLUG ?= $(shell git name-rev --name-only HEAD)
DOCKER_IMAGE_BUILDER ?= labsync-builder:$(CI_COMMIT_REF_SLUG)
DOCKER_IMAGE_SECURITY_SCANNER ?= security-scanner:$(CI_COMMIT_REF_SLUG)
CWD=$(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
@ -20,7 +22,7 @@ qemu_network = 10.2.2.0
qemu_netmask = 24
qemu_vm_ip = 10.2.2.10
qemu_disk = tmp/qemu-disk.img
qemu_target ?= debian-stretch
qemu_target ?= debian-bookworm
qemu_kernel = $(qemu_target).linux
qemu_torrent = $(qemu_target).torrent
qemu_initramfs = $(shell \
@ -33,7 +35,7 @@ fi \
ci_environment=$(shell env | sed -n 's/^\(CI_.*\)=.*/-e \1/p')
.PHONY: default
default: builderimg images/debian-stretch.squashfs
default: builderimg images/debian-bookworm.squashfs
.PHONY: clean
clean:
@ -42,7 +44,13 @@ clean:
.PHONY: builderimg
builderimg:
docker build --pull -t "$(DOCKER_IMAGE_BUILDER)" --cache-from "$(DOCKER_IMAGE_BUILDER)" --build-arg "PACKER_VERSION=$(PACKER_VERSION)" builder
docker build \
--pull \
-t "$(DOCKER_IMAGE_BUILDER)" \
--cache-from "$(DOCKER_IMAGE_BUILDER)" \
--build-arg "PACKER_VERSION=$(PACKER_VERSION)" \
--build-arg "ANSIBLE_VERSION=$(ANSIBLE_VERSION)" \
builder
.PHONY: secscanimg
secscanimg:
@ -52,48 +60,42 @@ images:
[ ! -d "$@" ] && mkdir "$@"
touch "$@"
images/debian-stretch.squashfs: images
images/debian-bookworm.squashfs: images
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "${PWD}/packer:/workdir" \
-v "${PWD}/aria2c:/workdir/aria2c" \
-v "${PWD}/images:/images" \
-e "user=`id -u`" \
-e "group=`id -g`" \
-v "${PWD}:${PWD}" \
-w "${PWD}" \
-e "IMAGES=${PWD}/images" \
-e "ANNOUNCE=$(ANNOUNCE)" \
-e "WEBSEED=$(WEBSEED)" \
-e "COMPRESSION_LEVEL=$(COMPRESSION_LEVEL)" \
$(ci_environment) \
"$(DOCKER_IMAGE_BUILDER)" \
debian-stretch
scripts/packer.sh \
debian-bookworm
images/debian-stretch.torrent: images
images/debian-bookworm.torrent: images
docker run \
--rm \
-v "${PWD}/images:/images" \
-e "user=`id -u`" \
-e "group=`id -g`" \
-e "ANNOUNCE=$(ANNOUNCE)" \
-v "${PWD}:${PWD}" \
-w "${PWD}" \
-e "WEBSEED=$(WEBSEED)" \
-e "TASK=torrent" \
"$(DOCKER_IMAGE_BUILDER)" \
debian-stretch
scripts/torrent.sh \
debian-bookworm
.PHONY: ansible
ansible:
docker run \
--rm \
-v "${PWD}/packer/ansible:/ansible" \
-e "user=`id -u`" \
-e "group=`id -g`" \
-e "ANNOUNCE=$(ANNOUNCE)" \
-u `id -u`:`id -g` \
-e "WEBSEED=$(WEBSEED)" \
-e "TASK=ansible" \
-v "${SSH_AUTH_SOCK}:/var/run/ssh_auth_sock" \
-e "SSH_AUTH_SOCK=/var/run/ssh_auth_sock" \
-w /ansible \
"$(DOCKER_IMAGE_BUILDER)" \
/usr/bin/ansible-playbook \
-i inventories \
$(if $(ANSIBLE_TAGS),-t $(ANSIBLE_TAGS),) \
-l $(ANSIBLE_LIMIT) \
@ -102,24 +104,24 @@ ansible:
# updates the initramfs
# only used for development
images/debian-stretch.initramfs.dev: tmp/initramfs-extracted/debian-stretch packer/initramfs/labsync
cp packer/initramfs/labsync tmp/initramfs-extracted/debian-stretch/scripts/labsync
(cd tmp/initramfs-extracted/debian-stretch && find . | cpio -H newc -o | gzip > $(CWD)/images/debian-stretch.initramfs.dev)
images/debian-bookworm.initramfs.dev: tmp/initramfs-extracted/debian-bookworm packer/initramfs/labsync
cp packer/initramfs/labsync tmp/initramfs-extracted/debian-bookworm/scripts/labsync
(cd tmp/initramfs-extracted/debian-bookworm && find . | cpio -H newc -o | gzip > $(CWD)/images/debian-bookworm.initramfs.dev)
tmp:
[ ! -d "$@" ] && mkdir "$@" || true
tmp/initramfs-extracted/debian-stretch: images/debian-stretch.initramfs
rm -rf tmp/initramfs-extracted/debian-stretch
mkdir -p tmp/initramfs-extracted/debian-stretch
(cd tmp/initramfs-extracted/debian-stretch && zcat "$(CWD)/images/debian-stretch.initramfs" | cpio -i)
touch tmp/initramfs-extracted/debian-stretch
tmp/initramfs-extracted/debian-bookworm: images/debian-bookworm.initramfs
rm -rf tmp/initramfs-extracted/debian-bookworm
mkdir -p tmp/initramfs-extracted/debian-bookworm
(cd tmp/initramfs-extracted/debian-bookworm && zcat "$(CWD)/images/debian-bookworm.initramfs" | cpio -i)
touch tmp/initramfs-extracted/debian-bookworm
$(qemu_disk): tmp
qemu-img create "$@" 20G
tmp/netboot.tar.gz: tmp
wget -c -O "$@" https://cdn-aws.deb.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/netboot.tar.gz
wget -c -O "$@" https://cdn-aws.deb.debian.org/debian/dists/bookworm/main/installer-amd64/current/images/netboot/netboot.tar.gz
touch "$@"
tmp/tftproot: tmp/netboot.tar.gz

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Before After
Before After

View file

@ -1,36 +1,18 @@
FROM docker
RUN apk add --no-cache \
ansible \
aws-cli \
ca-certificates \
coreutils \
libffi \
mktorrent \
openssh-client \
openssl \
python2 \
rsync \
squashfs-tools \
&& apk add --no-cache --virtual .build-deps \
gcc \
libffi-dev \
make \
musl-dev \
openssl-dev \
py2-pip \
python-dev \
&& pip install --upgrade pip \
&& pip install ansible==2.7.0 \
&& apk del .build-deps
ARG PACKER_VERSION
RUN mkdir -p /usr/local/bin \
&& wget -O /tmp/packer.zip -c https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip \
&& unzip /tmp/packer.zip -d /usr/local/bin \
&& rm -f /tmp/packer.zip \
&& mkdir /workdir
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk add --no-cache \
packer
WORKDIR /workdir
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View file

@ -1,66 +0,0 @@
#!/bin/sh
set -e
make_torrent() {
(cd /images
if [ "$NAME" = "" ]; then
# remove file extension
NAME="$(echo "$1" | sed 's/\.[^.]*//')"
fi
if [ "$WEBSEED" = "" ]; then
echo '$WEBSEED not provided' >&2
exit 1
fi
if [ "$ANNOUNCE" = "" ]; then
echo '$ANNOUNCE not provided' >&2
exit 1
fi
TORRENT_FILE="$NAME.torrent"
WEBSEED_URL="$WEBSEED/$1"
if [ -e "$TORRENT_FILE" ]; then rm "$TORRENT_FILE"; fi
mktorrent-borg \
-n "$NAME" \
-a "$ANNOUNCE" \
-o "$TORRENT_FILE" \
-l 22 \
-w "$WEBSEED_URL" \
"$1"
if [ "$user" != "" ] && [ "$group" != "" ]; then
chown "$user:$group" "$TORRENT_FILE"
fi
)
}
run_packer() {
packer build "$NAME.json"
if [ "$user" != "" ] && [ "$group" != "" ]; then
chown $user:$group "/images/${NAME}."*
fi
}
NAME="$1"
if [ "$NAME" = "" ]; then
echo 'no name supplied, stopping.' >&2
exit 1
fi
export NAME
if [ -z "$TASK" ] || [ "$TASK" == "packer" ]; then
run_packer
fi
if [ -z "$TASK" ] || [ "$TASK" == "torrent" ]; then
make_torrent "$NAME.squashfs"
fi
if [ "$TASK" == "ansible" ]; then
cd /ansible
/usr/bin/ansible-playbook "$@"
fi

View file

@ -7,9 +7,3 @@ services:
- 10.2.2.1:80:80
volumes:
- ./images:/usr/share/nginx/html:ro
opentracker:
build: opentracker
image: opentracker:alpine
ports:
- 10.2.2.1:6969:6969

View file

@ -1,5 +0,0 @@
FROM alpine
RUN apk add --no-cache opentracker
ENTRYPOINT ["/usr/bin/opentracker"]

View file

@ -6,13 +6,18 @@
- role: superuser
- role: auth
- role: labsync
- role: network-manager
- role: windowmanager
- role: l10n
- role: network-manager
- role: firefox
- role: windowmanager
- role: inkscape
- role: lightburn
- role: prusa-slicer
- role: fablab
- role: hardware
- role: docker
- role: cups
- role: fonts
vars:
auth:
sudo:
@ -39,14 +44,78 @@
url: "https://github.com/t-oster/VisiCut/releases/download/1.7_310/visicut_1.7-310-gcf8c087-1_all.deb"
cura:
version: 3.3.1
metalcut:
socket: laser.lab.fablab-nea.de:9000
dockerimage: r.jalr.de/fablab/metalcut
lightburn:
dockerimage: r.jalr.de/fablab/lightburn
firefox:
language_packs:
- de
extensions:
- uBlock0@raymondhill.net
debian_sections:
- main
- contrib
- non-free
debian_mirror: http://ftp.de.debian.org/debian
hardware:
firmware:
- firmware-amd-graphics
firmware: []
greeting:
title: Willkommen im FabLab Bad Windsheim
content: >
Hallo!
Du hast Dich mit einem Gast-Account angemeldet. Alle Daten werden nach
der Anmeldung gelöscht. Wenn Du Deine Daten dauerhaft speichern
möchtest, lege Dir bitte einen Account an!
lightburn:
devices:
- https://raw.githubusercontent.com/fablab-nea/LaserKutter/main/lightburn/LaserKutter.lbdev
prusa_slicer:
settings: |
no_controller = 1
no_defaults = 1
preset_update = 0
show_splash_screen = 0
use_inches = 0
version_check = 0
view_mode = expert
tls_accepted_cert_store_location = /etc/ssl/certs/ca-certificates.crt
tls_cert_store_accepted = yes
[filaments]
AmazonBasics TPU @MINI = 1
Das Filament PLA = 1
Generic PETG = 1
Generic PETG @MINI = 1
Generic PETG @MMU2 = 1
Generic PLA = 1
Generic PLA @MMU2 = 1
Prusament ASA = 1
Prusament ASA @MINI = 1
Prusament ASA @MMU2 = 1
Prusament PC Blend = 1
Prusament PC Blend @MINI = 1
Prusament PC Blend @MMU2 = 1
Prusament PETG = 1
Prusament PETG @MINI = 1
Prusament PETG @MMU2 = 1
Prusament PLA = 1
Prusament PLA @MMU2 = 1
Prusament PVB = 1
Prusament PVB @MMU2 = 1
Verbatim BVOH = 1
Verbatim BVOH @MMU2 = 1
[presets]
filament = Prusament PLA
physical_printer =
print = 0.15mm QUALITY @MK3
printer = Original Prusa i3 MK3
sla_material =
sla_print =
[vendor:PrusaResearch]
model:MK3 = 0.4
model:MK3SMMU2S = 0.4
[vendor:Ultimaker]
model:ULTIMAKER2 = 0.4

View file

@ -0,0 +1,290 @@
*PPD-Adobe: "4.3"
*%
*% For information on using this, and to obtain the required backend
*% script, consult http://www.openprinting.org/
*%
*% This file is published under the GNU General Public License
*%
*% PPD-O-MATIC (4.0.0 or newer) generated this PPD file. It is for use with
*% all programs and environments which use PPD files for dealing with
*% printer capability information. The printer must be configured with the
*% "foomatic-rip" backend filter script of Foomatic 4.0.0 or newer. This
*% file and "foomatic-rip" work together to support PPD-controlled printer
*% driver option access with all supported printer drivers and printing
*% spoolers.
*%
*% To save this file on your disk, wait until the download has completed
*% (the animation of the browser logo must stop) and then use the
*% "Save as..." command in the "File" menu of your browser or in the
*% pop-up manu when you click on this document with the right mouse button.
*% DO NOT cut and paste this file into an editor with your mouse. This can
*% introduce additional line breaks which lead to unexpected results.
*%
*% You may save this file as 'Epson-LQ-850-lq850.ppd'
*%
*%
*FormatVersion: "4.3"
*FileVersion: "1.1"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "LQ850.PPD"
*Manufacturer: "Epson"
*Product: "(LQ-850)"
*cupsVersion: 1.0
*cupsManualCopies: True
*cupsModelNumber: 2
*cupsFilter: "application/vnd.cups-postscript 100 foomatic-rip"
*cupsFilter: "application/vnd.cups-pdf 0 foomatic-rip"
*%pprRIP: foomatic-rip other
*ModelName: "Epson LQ-850"
*ShortNickName: "Epson LQ-850 lq850"
*NickName: "Epson LQ-850 Foomatic/lq850 (recommended)"
*PSVersion: "(3010.000) 550"
*PSVersion: "(3010.000) 651"
*PSVersion: "(3010.000) 652"
*PSVersion: "(3010.000) 653"
*PSVersion: "(3010.000) 704"
*PSVersion: "(3010.000) 705"
*PSVersion: "(3010.000) 800"
*PSVersion: "(3010.000) 815"
*PSVersion: "(3010.000) 850"
*PSVersion: "(3010.000) 860"
*PSVersion: "(3010.000) 861"
*PSVersion: "(3010.000) 862"
*PSVersion: "(3010.000) 863"
*PSVersion: "(3010.000) 864"
*PSVersion: "(3010.000) 870"
*LanguageLevel: "3"
*ColorDevice: False
*DefaultColorSpace: Gray
*FileSystem: False
*Throughput: "1"
*LandscapeOrientation: Plus90
*TTRasterizer: Type42
*1284DeviceID: "DRV:Dlq850,R1,M0,F1,P0,TG;"
*driverName lq850: ""
*driverType G/Ghostscript built-in: ""
*driverUrl: "http://www.ghostscript.com/"
*driverObsolete: False
*driverManufacturerSupplied: False
*driverFreeSoftware: True
*HWMargins: 18 36 18 36
*VariablePaperSize: True
*MaxMediaWidth: 100000
*MaxMediaHeight: 100000
*NonUIOrderDependency: 100 AnySetup *CustomPageSize
*CustomPageSize True: "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"
*End
*FoomaticRIPOptionSetting PageSize=Custom: " -dDEVICEWIDTHPOINTS=0 -dD&&
EVICEHEIGHTPOINTS=0"
*End
*ParamCustomPageSize Width: 1 points 36 100000
*ParamCustomPageSize Height: 2 points 36 100000
*ParamCustomPageSize Orientation: 3 int 0 0
*ParamCustomPageSize WidthOffset: 4 points 0 0
*ParamCustomPageSize HeightOffset: 5 points 0 0
*FoomaticIDs: Epson-LQ-850 lq850
*FoomaticRIPCommandLine: "gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPA&&
USE -dNOMEDIAATTRS -dNOINTERPOLATE -sDEVICE=lq850%A%Z -sOutputFile=- -&&
"
*End
*OpenGroup: General/General
*OpenUI *PageSize/Page Size: PickOne
*FoomaticRIPOption PageSize: enum CmdLine A
*OrderDependency: 100 AnySetup *PageSize
*DefaultPageSize: A4
*PageSize Letter/US Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
*FoomaticRIPOptionSetting PageSize=Letter: " -dDEVICEWIDTHPOINTS=612 -&&
dDEVICEHEIGHTPOINTS=792"
*End
*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
*FoomaticRIPOptionSetting PageSize=A4: " -dDEVICEWIDTHPOINTS=595 -dDEV&&
ICEHEIGHTPOINTS=842"
*End
*PageSize 3x5/3x5: "%% FoomaticRIPOptionSetting: PageSize=3x5"
*FoomaticRIPOptionSetting PageSize=3x5: " -dDEVICEWIDTHPOINTS=216 -dDE&&
VICEHEIGHTPOINTS=360"
*End
*PageSize 4x6/4x6: "%% FoomaticRIPOptionSetting: PageSize=4x6"
*FoomaticRIPOptionSetting PageSize=4x6: " -dDEVICEWIDTHPOINTS=288 -dDE&&
VICEHEIGHTPOINTS=432"
*End
*PageSize 5x7/5x7: "%% FoomaticRIPOptionSetting: PageSize=5x7"
*FoomaticRIPOptionSetting PageSize=5x7: " -dDEVICEWIDTHPOINTS=360 -dDE&&
VICEHEIGHTPOINTS=504"
*End
*PageSize 5x8/5x8: "%% FoomaticRIPOptionSetting: PageSize=5x8"
*FoomaticRIPOptionSetting PageSize=5x8: " -dDEVICEWIDTHPOINTS=360 -dDE&&
VICEHEIGHTPOINTS=576"
*End
*PageSize 6x8/6x8: "%% FoomaticRIPOptionSetting: PageSize=6x8"
*FoomaticRIPOptionSetting PageSize=6x8: " -dDEVICEWIDTHPOINTS=432 -dDE&&
VICEHEIGHTPOINTS=576"
*End
*PageSize 8x10/8x10: "%% FoomaticRIPOptionSetting: PageSize=8x10"
*FoomaticRIPOptionSetting PageSize=8x10: " -dDEVICEWIDTHPOINTS=576 -dD&&
EVICEHEIGHTPOINTS=720"
*End
*PageSize 8x12/8x12: "%% FoomaticRIPOptionSetting: PageSize=8x12"
*FoomaticRIPOptionSetting PageSize=8x12: " -dDEVICEWIDTHPOINTS=576 -dD&&
EVICEHEIGHTPOINTS=864"
*End
*PageSize 11x14/11x14: "%% FoomaticRIPOptionSetting: PageSize=11x14"
*FoomaticRIPOptionSetting PageSize=11x14: " -dDEVICEWIDTHPOINTS=792 -d&&
DEVICEHEIGHTPOINTS=1008"
*End
*PageSize 11x14.Transverse/14x11: "%% FoomaticRIPOptionSetting: PageSize=11x14.Transverse"
*FoomaticRIPOptionSetting PageSize=11x14.Transverse: " -dDEVICEWIDTHPO&&
INTS=1008 -dDEVICEHEIGHTPOINTS=792"
*End
*PageSize 16x20/16x20: "%% FoomaticRIPOptionSetting: PageSize=16x20"
*FoomaticRIPOptionSetting PageSize=16x20: " -dDEVICEWIDTHPOINTS=1152 -&&
dDEVICEHEIGHTPOINTS=1440"
*End
*PageSize 16x24/16x24: "%% FoomaticRIPOptionSetting: PageSize=16x24"
*FoomaticRIPOptionSetting PageSize=16x24: " -dDEVICEWIDTHPOINTS=1152 -&&
dDEVICEHEIGHTPOINTS=1728"
*End
*PageSize 210x305mm/210x305mm (8.3x12): "%% FoomaticRIPOptionSetting: PageSize=210x305mm"
*FoomaticRIPOptionSetting PageSize=210x305mm: " -dDEVICEWIDTHPOINTS=59&&
5 -dDEVICEHEIGHTPOINTS=864"
*End
*PageSize 378x279mm.Transverse/US Standard Fanfold (14.875x11): "%% FoomaticRIPOptionSetting: PageSize=378x279mm.Transverse"
*FoomaticRIPOptionSetting PageSize=378x279mm.Transverse: " -dDEVICEWID&&
THPOINTS=1071 -dDEVICEHEIGHTPOINTS=792"
*End
*PageSize A3/A3: "%% FoomaticRIPOptionSetting: PageSize=A3"
*FoomaticRIPOptionSetting PageSize=A3: " -dDEVICEWIDTHPOINTS=842 -dDEV&&
ICEHEIGHTPOINTS=1191"
*End
*PageSize FanFoldGerman/German Standard Fanfold (8.5x12): "%% FoomaticRIPOptionSetting: PageSize=FanFoldGerman"
*FoomaticRIPOptionSetting PageSize=FanFoldGerman: " -dDEVICEWIDTHPOINT&&
S=612 -dDEVICEHEIGHTPOINTS=864"
*End
*PageSize Legal/US Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
*FoomaticRIPOptionSetting PageSize=Legal: " -dDEVICEWIDTHPOINTS=612 -d&&
DEVICEHEIGHTPOINTS=1008"
*End
*PageSize SuperB/Super B (13x19): "%% FoomaticRIPOptionSetting: PageSize=SuperB"
*FoomaticRIPOptionSetting PageSize=SuperB: " -dDEVICEWIDTHPOINTS=936 -&&
dDEVICEHEIGHTPOINTS=1368"
*End
*CloseUI: *PageSize
*OpenUI *PageRegion: PickOne
*OrderDependency: 100 AnySetup *PageRegion
*DefaultPageRegion: A4
*PageRegion Letter/US Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
*PageRegion 3x5/3x5: "%% FoomaticRIPOptionSetting: PageSize=3x5"
*PageRegion 4x6/4x6: "%% FoomaticRIPOptionSetting: PageSize=4x6"
*PageRegion 5x7/5x7: "%% FoomaticRIPOptionSetting: PageSize=5x7"
*PageRegion 5x8/5x8: "%% FoomaticRIPOptionSetting: PageSize=5x8"
*PageRegion 6x8/6x8: "%% FoomaticRIPOptionSetting: PageSize=6x8"
*PageRegion 8x10/8x10: "%% FoomaticRIPOptionSetting: PageSize=8x10"
*PageRegion 8x12/8x12: "%% FoomaticRIPOptionSetting: PageSize=8x12"
*PageRegion 11x14/11x14: "%% FoomaticRIPOptionSetting: PageSize=11x14"
*PageRegion 11x14.Transverse/14x11: "%% FoomaticRIPOptionSetting: PageSize=11x14.Transverse"
*PageRegion 16x20/16x20: "%% FoomaticRIPOptionSetting: PageSize=16x20"
*PageRegion 16x24/16x24: "%% FoomaticRIPOptionSetting: PageSize=16x24"
*PageRegion 210x305mm/210x305mm (8.3x12): "%% FoomaticRIPOptionSetting: PageSize=210x305mm"
*PageRegion 378x279mm.Transverse/US Standard Fanfold (14.875x11): "%% FoomaticRIPOptionSetting: PageSize=378x279mm.Transverse"
*PageRegion A3/A3: "%% FoomaticRIPOptionSetting: PageSize=A3"
*PageRegion FanFoldGerman/German Standard Fanfold (8.5x12): "%% FoomaticRIPOptionSetting: PageSize=FanFoldGerman"
*PageRegion Legal/US Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
*PageRegion SuperB/Super B (13x19): "%% FoomaticRIPOptionSetting: PageSize=SuperB"
*CloseUI: *PageRegion
*DefaultImageableArea: A4
*ImageableArea Letter/US Letter: "18 36 594 756"
*ImageableArea A4/A4: "18 36 577 806"
*ImageableArea 3x5/3x5: "18 36 198 324"
*ImageableArea 4x6/4x6: "18 36 270 396"
*ImageableArea 5x7/5x7: "18 36 342 468"
*ImageableArea 5x8/5x8: "18 36 342 540"
*ImageableArea 6x8/6x8: "18 36 414 540"
*ImageableArea 8x10/8x10: "18 36 558 684"
*ImageableArea 8x12/8x12: "18 36 558 828"
*ImageableArea 11x14/11x14: "18 36 774 972"
*ImageableArea 11x14.Transverse/14x11: "18 36 990 756"
*ImageableArea 16x20/16x20: "18 36 1134 1404"
*ImageableArea 16x24/16x24: "18 36 1134 1692"
*ImageableArea 210x305mm/210x305mm (8.3x12): "18 36 577 828"
*ImageableArea 378x279mm.Transverse/US Standard Fanfold (14.875x11): "18 36 1053 756"
*ImageableArea A3/A3: "18 36 824 1155"
*ImageableArea FanFoldGerman/German Standard Fanfold (8.5x12): "18 36 594 828"
*ImageableArea Legal/US Legal: "18 36 594 972"
*ImageableArea SuperB/Super B (13x19): "18 36 918 1332"
*DefaultPaperDimension: A4
*PaperDimension Letter/US Letter: "612 792"
*PaperDimension A4/A4: "595 842"
*PaperDimension 3x5/3x5: "216 360"
*PaperDimension 4x6/4x6: "288 432"
*PaperDimension 5x7/5x7: "360 504"
*PaperDimension 5x8/5x8: "360 576"
*PaperDimension 6x8/6x8: "432 576"
*PaperDimension 8x10/8x10: "576 720"
*PaperDimension 8x12/8x12: "576 864"
*PaperDimension 11x14/11x14: "792 1008"
*PaperDimension 11x14.Transverse/14x11: "1008 792"
*PaperDimension 16x20/16x20: "1152 1440"
*PaperDimension 16x24/16x24: "1152 1728"
*PaperDimension 210x305mm/210x305mm (8.3x12): "595 864"
*PaperDimension 378x279mm.Transverse/US Standard Fanfold (14.875x11): "1071 792"
*PaperDimension A3/A3: "842 1191"
*PaperDimension FanFoldGerman/German Standard Fanfold (8.5x12): "612 864"
*PaperDimension Legal/US Legal: "612 1008"
*PaperDimension SuperB/Super B (13x19): "936 1368"
*CloseGroup: General
*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
*DefaultFont: Courier
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
*Font Courier: Standard "(002.004S)" Standard ROM
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
*Font Helvetica: Standard "(001.006S)" Standard ROM
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
*Font Symbol: Special "(001.007S)" Special ROM
*Font Times-Bold: Standard "(001.007S)" Standard ROM
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
*Font Times-Italic: Standard "(001.007S)" Standard ROM
*Font Times-Roman: Standard "(001.007S)" Standard ROM
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
*Font ZapfDingbats: Special "(001.004S)" Standard ROM

View file

@ -0,0 +1,18 @@
---
- block:
- name: install cups
apt:
name: cups
- name: copy ppd file
copy:
src: files/kopierviech.ppd
dest: /etc/cups/ppd/kopierviech.ppd
- name: configure cups
template:
src: printers.conf.j2
dest: /etc/cups/printers.conf
tags:
- cups

View file

@ -0,0 +1,28 @@
# Printer configuration file for CUPS v2.2.1
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<Printer kopierviech>
UUID urn:uuid:1dbeb741-74bb-3bc8-6db1-46f96cb2e82f
Info kopierviech
Location Kyocera Mita KM-1650 KM-1650
MakeModel Epson LQ-850 Foomatic/lq850 (recommended)
{#DeviceURI ipp://kopierviech.lab.fablab-nea.de#}
DeviceURI dnssd://kopierviech._pdl-datastream._tcp.local/
State Idle
StateTime 1541805049
ConfigTime 1541805149
Type 8433668
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
Attribute marker-colors none,none
Attribute marker-levels -1,-1
Attribute marker-names Toner Container,Waste Toner Box
Attribute marker-types toner,waste-toner
Attribute marker-change-time 1541806630
</Printer>

View file

@ -1,62 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFit2ioBEADhWpZ8/wvZ6hUTiXOwQHXMAlaFHcPH9hAtr4F1y2+OYdbtMuth
lqqwp028AqyY+PRfVMtSYMbjuQuu5byyKR01BbqYhuS3jtqQmljZ/bJvXqnmiVXh
38UuLa+z077PxyxQhu5BbqntTPQMfiyqEiU+BKbq2WmANUKQf+1AmZY/IruOXbnq
L4C1+gJ8vfmXQt99npCaxEjaNRVYfOS8QcixNzHUYnb6emjlANyEVlZzeqo7XKl7
UrwV5inawTSzWNvtjEjj4nJL8NsLwscpLPQUhTQ+7BbQXAwAmeHCUTQIvvWXqw0N
cmhh4HgeQscQHYgOJjjDVfoY5MucvglbIgCqfzAHW9jxmRL4qbMZj+b1XoePEtht
ku4bIQN1X5P07fNWzlgaRL5Z4POXDDZTlIQ/El58j9kp4bnWRCJW0lya+f8ocodo
vZZ+Doi+fy4D5ZGrL4XEcIQP/Lv5uFyf+kQtl/94VFYVJOleAv8W92KdgDkhTcTD
G7c0tIkVEKNUq48b3aQ64NOZQW7fVjfoKwEZdOqPE72Pa45jrZzvUFxSpdiNk2tZ
XYukHjlxxEgBdC/J3cMMNRE1F4NCA3ApfV1Y7/hTeOnmDuDYwr9/obA8t016Yljj
q5rdkywPf4JF8mXUW5eCN1vAFHxeg9ZWemhBtQmGxXnw9M+z6hWwc6ahmwARAQAB
tCtEb2NrZXIgUmVsZWFzZSAoQ0UgZGViKSA8ZG9ja2VyQGRvY2tlci5jb20+iQI3
BBMBCgAhBQJYrefAAhsvBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEI2BgDwO
v82IsskP/iQZo68flDQmNvn8X5XTd6RRaUH33kXYXquT6NkHJciS7E2gTJmqvMqd
tI4mNYHCSEYxI5qrcYV5YqX9P6+Ko+vozo4nseUQLPH/ATQ4qL0Zok+1jkag3Lgk
jonyUf9bwtWxFp05HC3GMHPhhcUSexCxQLQvnFWXD2sWLKivHp2fT8QbRGeZ+d3m
6fqcd5Fu7pxsqm0EUDK5NL+nPIgYhN+auTrhgzhK1CShfGccM/wfRlei9Utz6p9P
XRKIlWnXtT4qNGZNTN0tR+NLG/6Bqd8OYBaFAUcue/w1VW6JQ2VGYZHnZu9S8LMc
FYBa5Ig9PxwGQOgq6RDKDbV+PqTQT5EFMeR1mrjckk4DQJjbxeMZbiNMG5kGECA8
g383P3elhn03WGbEEa4MNc3Z4+7c236QI3xWJfNPdUbXRaAwhy/6rTSFbzwKB0Jm
ebwzQfwjQY6f55MiI/RqDCyuPj3r3jyVRkK86pQKBAJwFHyqj9KaKXMZjfVnowLh
9svIGfNbGHpucATqREvUHuQbNnqkCx8VVhtYkhDb9fEP2xBu5VvHbR+3nfVhMut5
G34Ct5RS7Jt6LIfFdtcn8CaSas/l1HbiGeRgc70X/9aYx/V/CEJv0lIe8gP6uDoW
FPIZ7d6vH+Vro6xuWEGiuMaiznap2KhZmpkgfupyFmplh0s6knymuQINBFit2ioB
EADneL9S9m4vhU3blaRjVUUyJ7b/qTjcSylvCH5XUE6R2k+ckEZjfAMZPLpO+/tF
M2JIJMD4SifKuS3xck9KtZGCufGmcwiLQRzeHF7vJUKrLD5RTkNi23ydvWZgPjtx
Q+DTT1Zcn7BrQFY6FgnRoUVIxwtdw1bMY/89rsFgS5wwuMESd3Q2RYgb7EOFOpnu
w6da7WakWf4IhnF5nsNYGDVaIHzpiqCl+uTbf1epCjrOlIzkZ3Z3Yk5CM/TiFzPk
z2lLz89cpD8U+NtCsfagWWfjd2U3jDapgH+7nQnCEWpROtzaKHG6lA3pXdix5zG8
eRc6/0IbUSWvfjKxLLPfNeCS2pCL3IeEI5nothEEYdQH6szpLog79xB9dVnJyKJb
VfxXnseoYqVrRz2VVbUI5Blwm6B40E3eGVfUQWiux54DspyVMMk41Mx7QJ3iynIa
1N4ZAqVMAEruyXTRTxc9XW0tYhDMA/1GYvz0EmFpm8LzTHA6sFVtPm/ZlNCX6P1X
zJwrv7DSQKD6GGlBQUX+OeEJ8tTkkf8QTJSPUdh8P8YxDFS5EOGAvhhpMBYD42kQ
pqXjEC+XcycTvGI7impgv9PDY1RCC1zkBjKPa120rNhv/hkVk/YhuGoajoHyy4h7
ZQopdcMtpN2dgmhEegny9JCSwxfQmQ0zK0g7m6SHiKMwjwARAQABiQQ+BBgBCAAJ
BQJYrdoqAhsCAikJEI2BgDwOv82IwV0gBBkBCAAGBQJYrdoqAAoJEH6gqcPyc/zY
1WAP/2wJ+R0gE6qsce3rjaIz58PJmc8goKrir5hnElWhPgbq7cYIsW5qiFyLhkdp
YcMmhD9mRiPpQn6Ya2w3e3B8zfIVKipbMBnke/ytZ9M7qHmDCcjoiSmwEXN3wKYI
mD9VHONsl/CG1rU9Isw1jtB5g1YxuBA7M/m36XN6x2u+NtNMDB9P56yc4gfsZVES
KA9v+yY2/l45L8d/WUkUi0YXomn6hyBGI7JrBLq0CX37GEYP6O9rrKipfz73XfO7
JIGzOKZlljb/D9RX/g7nRbCn+3EtH7xnk+TK/50euEKw8SMUg147sJTcpQmv6UzZ
cM4JgL0HbHVCojV4C/plELwMddALOFeYQzTif6sMRPf+3DSj8frbInjChC3yOLy0
6br92KFom17EIj2CAcoeq7UPhi2oouYBwPxh5ytdehJkoo+sN7RIWua6P2WSmon5
U888cSylXC0+ADFdgLX9K2zrDVYUG1vo8CX0vzxFBaHwN6Px26fhIT1/hYUHQR1z
VfNDcyQmXqkOnZvvoMfz/Q0s9BhFJ/zU6AgQbIZE/hm1spsfgvtsD1frZfygXJ9f
irP+MSAI80xHSf91qSRZOj4Pl3ZJNbq4yYxv0b1pkMqeGdjdCYhLU+LZ4wbQmpCk
SVe2prlLureigXtmZfkqevRz7FrIZiu9ky8wnCAPwC7/zmS18rgP/17bOtL4/iIz
QhxAAoAMWVrGyJivSkjhSGx1uCojsWfsTAm11P7jsruIL61ZzMUVE2aM3Pmj5G+W
9AcZ58Em+1WsVnAXdUR//bMmhyr8wL/G1YO1V3JEJTRdxsSxdYa4deGBBY/Adpsw
24jxhOJR+lsJpqIUeb999+R8euDhRHG9eFO7DRu6weatUJ6suupoDTRWtr/4yGqe
dKxV3qQhNLSnaAzqW/1nA3iUB4k7kCaKZxhdhDbClf9P37qaRW467BLCVO/coL3y
Vm50dwdrNtKpMBh3ZpbB1uJvgi9mXtyBOMJ3v8RZeDzFiG8HdCtg9RvIt/AIFoHR
H3S+U79NT6i0KPzLImDfs8T7RlpyuMc4Ufs8ggyg9v3Ae6cN3eQyxcK3w0cbBwsh
/nQNfsA6uu+9H7NhbehBMhYnpNZyrHzCmzyXkauwRAqoCbGCNykTRwsur9gS41TQ
M8ssD1jFheOJf3hODnkKU+HKjvMROl1DK7zdmLdNzA1cvtZH/nCC9KPj1z8QC47S
xx+dTZSx4ONAhwbS/LN3PoKtn8LPjY9NP9uDWI+TWYquS2U+KHDrBDlsgozDbs/O
jCxcpDzNmXpWQHEtHU7649OXHP7UeNST1mCUCH5qdank0V1iejF6/CfTFU4MfcrG
YT90qFF93M3v01BbxP+EIY2/9tiIPbrd
=0YYh
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -1,23 +1,7 @@
---
- name: install dependencies
- name: install docker packages
apt:
name:
- apt-transport-https
- ca-certificates
state: present
- name: Add apt key
apt_key:
data: "{{ lookup('file', 'docker.asc') }}"
state: present
- name: Add repository
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
filename: docker
state: present
- name: install docker-ce
apt:
name: "docker-ce"
- docker.io
- docker-compose
state: present

View file

@ -1,9 +0,0 @@
[Desktop Entry]
Name=Cura
GenericName=Cura
Comment=3D slicer
Exec=/opt/cura.AppImage
Icon=/opt/cura.png
Terminal=false
Type=Application
Categories=Graphics

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

View file

@ -1,9 +0,0 @@
[Desktop Entry]
Name=MetalCut
GenericName=MetalCut
Comment=Laser Cutter Job Control Application
Exec=x-terminal-emulator -e 'sudo /usr/local/bin/metalcut'
Icon=/usr/share/metalcut/metalcut.svg
Terminal=false
Type=Application
Categories=Graphics

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 94 KiB

View file

@ -1,16 +1,5 @@
---
- name: install cura
get_url:
url: "https://download.ultimaker.com/current/Cura-{{ fablab.cura.version }}.AppImage"
dest: /opt/cura.AppImage
mode: 775
- name: get cura icon
copy:
src: cura.png
dest: /opt/cura.png
- name: install cura dekstop file
copy:
src: cura.desktop
dest: /usr/share/applications/cura.desktop
apt:
name: cura
state: present

View file

@ -18,8 +18,8 @@
- import_tasks: visicut.yml
tags:
- fablab:visicut
- import_tasks: metalcut.yml
tags:
- fablab:metalcut
# - import_tasks: platformio.yml
# tags:
# - fablab:platformio
tags:
- fablab

View file

@ -1,58 +0,0 @@
---
- file:
path: /usr/share/metalcut
state: directory
mode: "0755"
owner: root
group: root
- name: copy icon
copy:
src: metalcut/metalcut.svg
dest: /usr/share/metalcut/metalcut.svg
owner: root
group: root
mode: "0644"
- name: add metalcut script
template:
src: metalcut/metalcut.sh.j2
dest: /usr/local/bin/metalcut
owner: root
group: root
mode: "0755"
- name: add metalcut to applications menu
copy:
src: metalcut/metalcut.desktop
dest: /usr/share/applications/metalcut.desktop
owner: root
group: root
mode: "0644"
- name: add group
group:
name: metalcut
system: yes
- name: add sudoers config
copy:
content: "%metalcut ALL=/usr/local/bin/metalcut, NOPASSWD:/usr/local/bin/metalcut\n"
dest: /etc/sudoers.d/metalcut
owner: root
group: root
mode: "0644"
- name: ensure guest-account settings directory exists
file:
path: /etc/guest-account
state: directory
mode: "0755"
owner: root
group: root
- name: add metalcut group to guest account
lineinfile:
path: /etc/guest-account/groups
line: metalcut
create: yes

View file

@ -0,0 +1,15 @@
---
- name: Ensure pip3 is installed
apt:
name: python3-pip
- name: Install platformio via pip
pip:
name: platformio
state: latest
executable: pip3
- name: Add guest user to dialout group
lineinfile:
path: /etc/guest-account/groups
line: dialout

View file

@ -1,25 +0,0 @@
#!/bin/sh
remote='{{ fablab.metalcut.socket }}'
image='{{ fablab.metalcut.dockerimage }}'
if [ ! -z "$SUDO_COMMAND" ] && [ "$SUDO_COMMAND" = "$0" ]; then
home="$(getent passwd "$SUDO_UID" | cut -d: -f6)"
uid="$SUDO_UID"
gid="$SUDO_GID"
else
home="$HOME"
uid=$(id -u)
gid=$(id -g)
fi
docker run \
--rm \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY \
-e uid="$uid" \
-e gid="$gid" \
-v "$home:/home/metalcut/work" \
-v '/media:/media' \
-e remote="$remote" \
$image

View file

@ -0,0 +1,37 @@
// debian settings
pref("extensions.update.enabled", true);
pref("intl.locale.requested", "");
pref("browser.shell.checkDefaultBrowser", false);
// disable trackers
lockPref("app.normandy.enabled", false);
lockPref("browser.chrome.errorReporter.enabled", false);
lockPref("browser.safebrowsing.downloads.enabled", false);
lockPref("browser.safebrowsing.downloads.remote.enabled", false);
lockPref("browser.safebrowsing.malware.enabled", false);
lockPref("browser.safebrowsing.passwords.enabled", false);
lockPref("browser.safebrowsing.phishing.enabled", false);
lockPref("browser.tabs.crashReporting.sendReport", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("security.ssl.errorReporting.enabled", false);
// design
pref("browser.newtabpage.enabled", false);
pref("browser.uiCustomization.state", '{"placements":{"widget-overflow-fixed-list":[],"PersonalToolbar":["personal-bookmarks"],"nav-bar":["back-button","forward-button","home-button","urlbar-container","stop-reload-button","downloads-button","library-button"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"toolbar-menubar":["menubar-items"]},"seen":["developer-button"],"dirtyAreaCache":["PersonalToolbar","nav-bar","TabsToolbar","toolbar-menubar"],"currentVersion":14,"newElementCount":3}');
// for experienced users
pref("browser.urlbar.trimURLs", false);
pref("browser.fixup.alternate.enabled", false);
// privacy
pref("privacy.donottrackheader.enabled", true);
pref("privacy.history.custom", true);
pref("places.history.enabled", false);
pref("browser.formfill.enable", false);
// search
pref("browser.search.hiddenOneOffs", "Google,Amazon.de,Bing,Debian packages,DuckDuckGo,eBay,Ecosia,LEO Eng-Deu,Wikipedia (de)"); // hide „one click“ search eingines
pref("browser.search.suggest.enabled", false);
pref("browser.urlbar.placeholderName", "DuckDuckGo"); // defaults to google, even if DuckDuckGo is the default

View file

@ -0,0 +1,29 @@
{
"policies": {
"Cookies": {
"AcceptThirdParty": "from-visited"
},
"DNSOverHTTPS": {
"Enabled": false,
"Locked": false
},
"DisableFeedbackCommands": true,
"DisableFirefoxAccounts": true,
"DisableFirefoxStudies": true,
"DisablePocket": true,
"DisableTelemetry": true,
"EnableTrackingProtection": {
"Value": true,
"Locked": true
},
"NoDefaultBookmarks": true,
"OfferToSaveLogins": true,
"Homepage": {
"URL": "https://wiki.fablab-nea.de/"
},
"OverrideFirstRunPage": "",
"SearchEngines": {
"Default": "DuckDuckGo"
}
}
}

View file

@ -0,0 +1,15 @@
---
- name: get extensions info
uri:
url: "https://addons.mozilla.org/api/v4/addons/addon/{{ item }}/"
return_content: yes
register: extension_infos
loop: "{{ firefox.extensions }}"
- name: install extensions
get_url:
url: "{{ item.json.current_version.files[0].url }}"
dest: "/usr/lib/firefox-esr/browser/extensions/{{ item.item }}.xpi"
loop: "{{ extension_infos.results }}"
loop_control:
label: "{{ item.url }}"

View file

@ -0,0 +1,28 @@
- block:
- name: install firefox
apt:
name: [ firefox-esr ]
- name: install localizations
apt:
name: "firefox-esr-l10n-{{ item }}"
with_items:
- "{{ firefox.language_packs }}"
when: firefox.language_packs is defined
- name: install firefox config
copy:
src: firefox.js
dest: /etc/firefox-esr/firefox-esr.js
- name: install firefox policies
copy:
src: policies.json
dest: /usr/share/firefox-esr/distribution/policies.json
- import_tasks: extensions.yml
tags:
- firefox:extensions
tags:
- firefox

View file

@ -0,0 +1,11 @@
---
- name: create google fonts directory
file:
path: /usr/local/share/fonts/google/
state: directory
- name: install google fonts
unarchive:
src: https://github.com/google/fonts/archive/main.zip
dest: /usr/local/share/fonts/google/
remote_src: yes

View file

@ -0,0 +1,13 @@
---
- block:
- import_tasks: google.yml
tags:
- fonts:google
- name: Install font viewer
apt:
name:
- fontmatrix
tags:
- fonts:fontmatrix
tags:
- fonts

@ -1 +1 @@
Subproject commit 8afe49a2a52bb13bb2a34331e7c9625fb05529bf
Subproject commit 2f40eef85264eb6646ea7e89cbd4659560b88235

View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View file

@ -0,0 +1,157 @@
# TabbedBoxMaker: A free Inkscape extension for generating tab-jointed box patterns
_version 1.1 - 9 Aug 2021_
Original box maker by Elliot White (formerly of twot.eu, domain name now squatted)
Heavily modified by [Paul Hutchison](https://github.com/paulh-rnd)
## About
This tool is designed to simplify the process of making practical boxes from sheet material using almost any kind of CNC cutter (laser, plasma, water jet or mill). The box edges are "finger-jointed" or "tab-jointed", and may include press-fit dimples, internal dividers, dogbone corners (for endmill cutting), and more.
The tool works by generating each side of the box with the tab and edge sizes corrected to account for the kerf (width of cut). Each box side is composed of a group of individual lines that make up each edge of the face, as well as any other cutouts for dividers. It is recommended that you join adjacent lines in your CNC software to cut efficiently.
An additional extension which uses the same TabbedBoxMaker generator script is also included: Schroff Box Maker. The Schroff addition was created by [John Slee](https://github.com/jsleeio). If you create further derivative box generators, feel free to send me a pull request!
## Release Notes
This is a major upgrade to support Inkscape v1.0 and CNC mills (with dogbone cuts), plus an updated dialog layout and documentation, and a number of smaller fixes. So far no serious bugs (i.e causing runtime errors) have been found. The program works with Python 3 ONLY. See [issues](https://github.com/paulh-rnd/TabbedBoxMaker/issues) for known issues, or to log issues and enhancement requests.
Note that in this release the extension has *moved from the Laser Tools to the CNC Tools submenu*. This is to better reflect that this tool can be used on a wide variety of CNC machinery, especially with the addition of dogbone corners: laser, water jet, milling, even 3D printing.
## Donate
Any donations will be gratefully received:
[![](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/SparkItUp)
Many thanks to those who have donated.
## To do
* Tidy, modularise and simplify the code - it is rough and unpythonic. Needs some work by a master Python guru.
* Add tests and perhaps get it submitted as a core extension to be installed with Inkscape?
* Improve input checking to restrict values to correct solutions.
* Dogbone only works on tabbed joins, NOT divider keyholes or slots yet
* Would be great to make shapes closed and do path subtraction to get slot cutouts and keyholes from faces, and perhaps offer to add fill colour
* [Schroff] Maybe replace the somewhat obscure collection of Schroff rail input data with a dropdown box listing well-documented rail types (Vector, Z-rails, whatever it is that Elby sells, others?)
* [Schroff] Add support for multiple mounting holes per rail where possible (this would definitely make the previous todo item worthwhile)
* [Schroff] Add support for 6U row height
## Use - regular tabbed boxes
The interface is pretty self explanatory, the extension is 'Tabbed Box Maker' in the 'CNC Tools' group
Parameters in order of appearance:
* Units - unit of measurement used for drawing
* Box Dimensions: Inside/Outside - whether the box dimensions are internal or external measurements
* Length / Width / Height - the box dimensions
* Tab Width: Fixed/Proportional - for fixed the tab width is the value given in the Tab
Width, for proportional the side of a piece is divided
equally into tabs and 'spaces' with the tabs size
greater or equal to the Tab Width setting
* Minimum/Preferred Tab Width - the size of the tabs used to hold the pieces together
* Symmetry - there are two styles of tabs avaiable:
* XY Symmetrix - each piece is symmetric in both the X and Y axes
* Rotate Symmetric ("waffle block") - each piece is symmetric under a 180-degree rotation
(and 90 degrees if that piece is square)
* Tab Dimple Height - the height of the dimple to add to the side of each tab, 0 for no dimple.
Dimples can be added to give tabbed joints a little extra material for a tighter press fit.
* Tab Dimple Length - the length of the tip of the dimple; dimples are trapezoid shaped with
45-degree sides; using a dimple tip length of 0 gives a triangular dimple
* Line Thickness - Leave this as _Default_ unless you need hairline thickness (Use for Epilog lasers)
* Material Thickness - as it says
* Kerf - this is the diameter/width of the cut. Typical laser cutters will be between 0.1 - 0.25mm,
for CNC mills, this will be your end mill diameter. A larger kerf will assume more material is removed,
hence joints will be tighter. Smaller or zero kerf will result in looser joints.
* Layout - controls how the pieces are laid out in the drawing
* Box Type - this allows you to choose how many jointed sides you want. Options are:
* Fully enclosed (6 sides)
* One side open (LxW) - one of the Length x Width panels will be omitted
* Two sides open (LxW and LxH) - two adjacent panels will be omitted
* Three sides open (LxW, LxH, HxW) - one of each panel omitted
* Opposite ends open (LxW) - an open-ended "tube" with the LxW panels omitted
* Two panels only (LxW and LxH) - two panels with a single joint down the Length axis
* Dividers (Length axis) - use this to create additional LxH panels that mount inside the box
along the length axis and have finger joints into the side panels
and slots for Width dividers to slot into
* Dividers (Width axis) - use this to create additional WxH panels that mount inside the box
along the width axis and have finger joints into the side panels
and slots for Length dividers to slot into
* Key the dividers into - this allows you to choose if/how the dividers are keyed into the sides of the box. Options are:
* None - no keying, dividers will be free to slide in and out
* Walls - dividers will only be keyed into the side walls of the box
* Floor/Ceiling - dividers will only be keyed into the top/bottom of the box
* All Sides
* Space Between Parts - how far apart the pieces are in the drawing produced
* Live Preview - you may need to turn this off when changing tab style, box type, or layout
## Use - Schroff enclosures
Much the same as for regular enclosures, except some options are removed, and some others are added. If you're using Elby rails, all you'll need to do is specify:
* Depth
* Number of 3U rows
* Row width in TE/HP units (divide rail length by 5.08mm/0.2")
* If multiple rows, inter-row spacing
## Installation
1. Download the extension from this GitHub page using the *[Clone or download > Download ZIP](archive/master.zip)* link. If you are using an older version of Inkscape, you will need to download the correct version of the extension (see [Version History](#version-history) below)
2. Extract the zip file
3. Copy all files except README.md and LICENSE into the Inkscape extensions directory. The directory location varies depending on your operating system, and may be customised. The easiest way to find the directory is to open Inkscape, go to _Edit > Preferences > System_ (Win/Linux) or _Inkscape > Preferences > System_ (Mac).
4. You can either copy the files to the _User extensions_ directory or the _Inkscape extensions_ directory. The former will install this extension for just the current user, the latter will install it for all users of the machine.
5. Inkscape *must* be restarted after copying the extension files.
6. If it has been installed correctly, you should find the extension under the _Extensions > CNC Tools_ menu. Enjoy!
Default installation directories are given below:
### Windows
* User: `%APPDATA%\inkscape\extensions`
* Machine: `C:\Program Files\Inkscape\share\extensions`
### Mac
* User: `~/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions`
* Machine: `/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions`
### Linux
* User: `~/.config/inkscape/extensions`
* Machine: Depends on installation method
## Version History
version | Date | Notes
--------|------|--------
0.5 | ( 9 Oct 2011) | beta
0.7 | (24 Oct 2011) | first release
0.8 | (26 Oct 2011) | basic input checking implemented
0.86 | (19 Dec 2014) | updates to allow different box types and internal dividers
0.86a | (23 June 2015) | Updated for compatibility with Inkscape 0.91
0.87 | (28 July 2015) | Schroff enclosure add-on
0.93 | (21 Sept 2015) | Updated versioning to match original author's updated v0.91 plus adding my 0.02
0.93a | (21 Sept 2015) | Added hairline line thickness option for Epilog lasers
0.94 | (4 Jan 2017) | Divider keying options
0.95 | (20 Apr 2017) | Added optional dimples on tabs
0.96 | (24 Apr 2017) | Orthogonalized box type, layout, tab style; added rotate-symmetric tabs
0.99 | (4 June 2020) | Upgraded to support Inkscape v1.0, minor fixes and a tidy up of the parameters dialog layout
1.0 | (17 June 2020) | v1.0 final released: fixes and dogbone added - Mills now supported!
1.1 | (9 Aug 2021) | v1.1 with fixes for newer Inkscape versions - sorry for the delays

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>CNC Tabbed Box Maker</_name>
<id>nz.paulh-rnd.tabbedboxmaker</id>
<hbox>
<vbox>
<label>Dimensions</label>
<separator/>
<param name="unit" _gui-text="    Units" type="optiongroup" appearance="combo">
<option value="mm">mm</option>
<option value="cm">cm</option>
<option value="in">in</option>
</param>
<param name="inside" type="optiongroup" _gui-text="    Box Dimensions" appearance="combo">
<_option value="1">Inside</_option>
<_option value="0">Outside</_option>
</param>
<param name="length" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Length">180</param>
<param name="width" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Width">240</param>
<param name="depth" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Height">50</param>
<spacer/>
<label>Tabs</label>
<separator/>
<param name="equal" type="optiongroup" _gui-text="    Width">
<_option value="0">Fixed</_option>
<_option value="1">Proportional</_option>
</param>
<param name="tab" type="float" precision="2" min="0.0" max="10000.0" _gui-text="    Min/Preferred Width">6.0</param>
<param name="tabtype" type="optiongroup" _gui-text="    Type" appearance="combo">
<_option value="0">Regular (Laser)</_option>
<_option value="1">Dogbone (Mill)</_option>
</param>
<param name="tabsymmetry" type="optiongroup" _gui-text="    Symmetry" appearance="combo">
<_option value="0">XY Symmetric</_option>
<_option value="1">Rotate Symmetric</_option>
<!--_option value="2">Antisymmetric</_option-->
</param>
<param name="dimpleheight" type="float" precision="2" min="0.0" max="10000.0"
_gui-text="    Dimple Height">0.0</param>
<param name="dimplelength" type="float" precision="2" min="0.0" max="10000.0"
_gui-text="    Dimple Length">0.0</param>
</vbox>
<spacer/>
<separator/>
<spacer/>
<vbox>
<label>Line and kerf</label>
<separator/>
<param name="hairline" type="optiongroup" _gui-text="    Line Thickness" appearance="combo">
<_option value="0">Default</_option>
<_option value="1">Hairline (0.002" for Epilog)</_option>
</param>
<param name="thickness" type="float" precision="2" min="0.0" max="10000.0" _gui-text="    Material Thickness">3.0</param>
<param name="kerf" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Kerf (cut width)">0.1</param>
<spacer/>
<label>Layout</label>
<separator/>
<param name="style" _gui-text="    Layout" type="optiongroup" appearance="combo">
<option value="1">Diagramatic</option>
<option value="2">3 piece</option>
<option value="3">Inline(compact)</option>
</param>
<param name="boxtype" _gui-text="    Box Type" type="optiongroup" appearance="combo">
<option value="1">Fully enclosed</option>
<option value="2">One side open (LxW)</option>
<option value="3">Two sides open (LxW and LxH)</option>
<option value="4">Three sides open (LxW, LxH, HxW)</option>
<option value="5">Opposite ends open (LxW)</option>
<option value="6">Two panels only (LxW and LxH)</option>
</param>
<param name="div_l" type="int" min="0" max="20" _gui-text="    Dividers (Length axis)">2</param>
<param name="div_w" type="int" min="0" max="20" _gui-text="    Dividers (Width axis)">3</param>
<param name="keydiv" _gui-text="    Key the dividers into" type="optiongroup" appearance="combo">
<option value="3">None</option>
<option value="2">Walls</option>
<option value="1">Floor / Ceiling</option>
<option value="0">All sides</option>
</param>
<param name="spacing" type="float" precision="2" min="0.0" max="10000.0" _gui-text="    Space Between Parts">1.0</param>
</vbox>
</hbox>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu _name="CNC Tools" />
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">boxmaker.py</command>
</script>
</inkscape-extension>

View file

@ -0,0 +1,741 @@
#! /usr/bin/env python -t
'''
Generates Inkscape SVG file containing box components needed to
CNC (laser/mill) cut a box with tabbed joints taking kerf and clearance into account
Original Tabbed Box Maker Copyright (C) 2011 elliot white
Changelog:
19/12/2014 Paul Hutchison:
- Ability to generate 6, 5, 4, 3 or 2-panel cutouts
- Ability to also generate evenly spaced dividers within the box
including tabbed joints to box sides and slots to slot into each other
23/06/2015 by Paul Hutchison:
- Updated for Inkscape's 0.91 breaking change (unittouu)
v0.93 - 15/8/2016 by Paul Hutchison:
- Added Hairline option and fixed open box height bug
v0.94 - 05/01/2017 by Paul Hutchison:
- Added option for keying dividers into walls/floor/none
v0.95 - 2017-04-20 by Jim McBeath
- Added optional dimples
v0.96 - 2017-04-24 by Jim McBeath
- Refactored to make box type, tab style, and layout all orthogonal
- Added Tab Style option to allow creating waffle-block-style tabs
- Made open box size correct based on inner or outer dimension choice
- Fixed a few tab bugs
v0.99 - 2020-06-01 by Paul Hutchison
- Preparatory release with Inkscape 1.0 compatibility upgrades (further fixes to come!)
- Removed Antisymmetric option as it's broken, kinda pointless and looks weird
- Fixed divider issues with Rotate Symmetric
- Made individual panels and their keyholes/slots grouped
v1.0 - 2020-06-17 by Paul Hutchison
- Removed clearance parameter, as this was just subtracted from kerf - pointless?
- Corrected kerf adjustments for overall box size and divider keyholes
- Added dogbone cuts: CNC mills now supported!
- Fix for floor/ceiling divider key issue (#17)
- Increased max dividers to 20 (#35)
v1.1 - 2021-08-09 by Paul Hutchison
- Fixed for current Inkscape release version 1.1 - thanks to PR from https://github.com/roastedneutrons
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
__version__ = "1.0" ### please report bugs, suggestions etc at https://github.com/paulh-rnd/TabbedBoxMaker ###
import os,sys,inkex,simplestyle,gettext,math
from copy import deepcopy
_ = gettext.gettext
linethickness = 1 # default unless overridden by settings
def log(text):
if 'SCHROFF_LOG' in os.environ:
f = open(os.environ.get('SCHROFF_LOG'), 'a')
f.write(text + "\n")
def newGroup(canvas):
# Create a new group and add element created from line string
panelId = canvas.svg.get_unique_id('panel')
group = canvas.svg.get_current_layer().add(inkex.Group(id=panelId))
return group
def getLine(XYstring):
line = inkex.PathElement()
line.style = { 'stroke': '#000000', 'stroke-width' : str(linethickness), 'fill': 'none' }
line.path = XYstring
#inkex.etree.SubElement(parent, inkex.addNS('path','svg'), drw)
return line
# jslee - shamelessly adapted from sample code on below Inkscape wiki page 2015-07-28
# http://wiki.inkscape.org/wiki/index.php/Generating_objects_from_extensions
def getCircle(r, c):
(cx, cy) = c
log("putting circle at (%d,%d)" % (cx,cy))
circle = inkex.PathElement.arc((cx, cy), r)
circle.style = { 'stroke': '#000000', 'stroke-width': str(linethickness), 'fill': 'none' }
# ell_attribs = {'style':simplestyle.formatStyle(style),
# inkex.addNS('cx','sodipodi') :str(cx),
# inkex.addNS('cy','sodipodi') :str(cy),
# inkex.addNS('rx','sodipodi') :str(r),
# inkex.addNS('ry','sodipodi') :str(r),
# inkex.addNS('start','sodipodi') :str(0),
# inkex.addNS('end','sodipodi') :str(2*math.pi),
# inkex.addNS('open','sodipodi') :'true', #all ellipse sectors we will draw are open
# inkex.addNS('type','sodipodi') :'arc',
# 'transform' :'' }
#inkex.etree.SubElement(parent, inkex.addNS('path','svg'), ell_attribs )
return circle
def dimpleStr(tabVector,vectorX,vectorY,dirX,dirY,dirxN,diryN,ddir,isTab):
ds=''
if not isTab:
ddir = -ddir
if dimpleHeight>0 and tabVector!=0:
if tabVector>0:
dimpleStart=(tabVector-dimpleLength)/2-dimpleHeight
tabSgn=1
else:
dimpleStart=(tabVector+dimpleLength)/2+dimpleHeight
tabSgn=-1
Vxd=vectorX+dirxN*dimpleStart
Vyd=vectorY+diryN*dimpleStart
ds+='L '+str(Vxd)+','+str(Vyd)+' '
Vxd=Vxd+(tabSgn*dirxN-ddir*dirX)*dimpleHeight
Vyd=Vyd+(tabSgn*diryN-ddir*dirY)*dimpleHeight
ds+='L '+str(Vxd)+','+str(Vyd)+' '
Vxd=Vxd+tabSgn*dirxN*dimpleLength
Vyd=Vyd+tabSgn*diryN*dimpleLength
ds+='L '+str(Vxd)+','+str(Vyd)+' '
Vxd=Vxd+(tabSgn*dirxN+ddir*dirX)*dimpleHeight
Vyd=Vyd+(tabSgn*diryN+ddir*dirY)*dimpleHeight
ds+='L '+str(Vxd)+','+str(Vyd)+' '
return ds
def side(group,root,startOffset,endOffset,tabVec,length,direction,isTab,isDivider,numDividers,dividerSpacing):
rootX, rootY = root
startOffsetX, startOffsetY = startOffset
endOffsetX, endOffsetY = endOffset
dirX, dirY = direction
notTab=0 if isTab else 1
if (tabSymmetry==1): # waffle-block style rotationally symmetric tabs
divisions=int((length-2*thickness)/nomTab)
if divisions%2: divisions+=1 # make divs even
divisions=float(divisions)
tabs=divisions/2 # tabs for side
else:
divisions=int(length/nomTab)
if not divisions%2: divisions-=1 # make divs odd
divisions=float(divisions)
tabs=(divisions-1)/2 # tabs for side
if (tabSymmetry==1): # waffle-block style rotationally symmetric tabs
gapWidth=tabWidth=(length-2*thickness)/divisions
elif equalTabs:
gapWidth=tabWidth=length/divisions
else:
tabWidth=nomTab
gapWidth=(length-tabs*nomTab)/(divisions-tabs)
if isTab: # kerf correction
gapWidth-=kerf
tabWidth+=kerf
first=halfkerf
else:
gapWidth+=kerf
tabWidth-=kerf
first=-halfkerf
firstholelenX=0
firstholelenY=0
s=[]
h=[]
firstVec=0; secondVec=tabVec
dividerEdgeOffsetX = dividerEdgeOffsetY = thickness
notDirX=0 if dirX else 1 # used to select operation on x or y
notDirY=0 if dirY else 1
if (tabSymmetry==1):
dividerEdgeOffsetX = dirX*thickness;
#dividerEdgeOffsetY = ;
vectorX = rootX + (startOffsetX*thickness if notDirX else 0)
vectorY = rootY + (startOffsetY*thickness if notDirY else 0)
s='M '+str(vectorX)+','+str(vectorY)+' '
vectorX = rootX+(startOffsetX if startOffsetX else dirX)*thickness
vectorY = rootY+(startOffsetY if startOffsetY else dirY)*thickness
if notDirX: endOffsetX=0
if notDirY: endOffsetY=0
else:
(vectorX,vectorY)=(rootX+startOffsetX*thickness,rootY+startOffsetY*thickness)
dividerEdgeOffsetX=dirY*thickness
dividerEdgeOffsetY=dirX*thickness
s='M '+str(vectorX)+','+str(vectorY)+' '
if notDirX: vectorY=rootY # set correct line start for tab generation
if notDirY: vectorX=rootX
# generate line as tab or hole using:
# last co-ord:Vx,Vy ; tab dir:tabVec ; direction:dirx,diry ; thickness:thickness
# divisions:divs ; gap width:gapWidth ; tab width:tabWidth
for tabDivision in range(1,int(divisions)):
if ((tabDivision%2) ^ (not isTab)) and numDividers>0 and not isDivider: # draw holes for divider tabs to key into side walls
w=gapWidth if isTab else tabWidth
if tabDivision==1 and tabSymmetry==0:
w-=startOffsetX*thickness
holeLenX=dirX*w+notDirX*firstVec+first*dirX
holeLenY=dirY*w+notDirY*firstVec+first*dirY
if first:
firstholelenX=holeLenX
firstholelenY=holeLenY
for dividerNumber in range(1,int(numDividers)+1):
Dx=vectorX+-dirY*dividerSpacing*dividerNumber+notDirX*halfkerf+dirX*dogbone*halfkerf-dogbone*first*dirX
Dy=vectorY+dirX*dividerSpacing*dividerNumber-notDirY*halfkerf+dirY*dogbone*halfkerf-dogbone*first*dirY
if tabDivision==1 and tabSymmetry==0:
Dx+=startOffsetX*thickness
h='M '+str(Dx)+','+str(Dy)+' '
Dx=Dx+holeLenX
Dy=Dy+holeLenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx+notDirX*(secondVec-kerf)
Dy=Dy+notDirY*(secondVec+kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-holeLenX
Dy=Dy-holeLenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-notDirX*(secondVec-kerf)
Dy=Dy-notDirY*(secondVec+kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
group.add(getLine(h))
if tabDivision%2:
if tabDivision==1 and numDividers>0 and isDivider: # draw slots for dividers to slot into each other
for dividerNumber in range(1,int(numDividers)+1):
Dx=vectorX+-dirY*dividerSpacing*dividerNumber-dividerEdgeOffsetX+notDirX*halfkerf
Dy=vectorY+dirX*dividerSpacing*dividerNumber-dividerEdgeOffsetY+notDirY*halfkerf
h='M '+str(Dx)+','+str(Dy)+' '
Dx=Dx+dirX*(first+length/2)
Dy=Dy+dirY*(first+length/2)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx+notDirX*(thickness-kerf)
Dy=Dy+notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-dirX*(first+length/2)
Dy=Dy-dirY*(first+length/2)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-notDirX*(thickness-kerf)
Dy=Dy-notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
group.add(getLine(h))
# draw the gap
vectorX+=dirX*(gapWidth+(isTab&dogbone&1 ^ 0x1)*first+dogbone*kerf*isTab)+notDirX*firstVec
vectorY+=dirY*(gapWidth+(isTab&dogbone&1 ^ 0x1)*first+dogbone*kerf*isTab)+notDirY*firstVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and isTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
# draw the starting edge of the tab
s+=dimpleStr(secondVec,vectorX,vectorY,dirX,dirY,notDirX,notDirY,1,isTab)
vectorX+=notDirX*secondVec
vectorY+=notDirY*secondVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and notTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
else:
# draw the tab
vectorX+=dirX*(tabWidth+dogbone*kerf*notTab)+notDirX*firstVec
vectorY+=dirY*(tabWidth+dogbone*kerf*notTab)+notDirY*firstVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and notTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
# draw the ending edge of the tab
s+=dimpleStr(secondVec,vectorX,vectorY,dirX,dirY,notDirX,notDirY,-1,isTab)
vectorX+=notDirX*secondVec
vectorY+=notDirY*secondVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and isTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
(secondVec,firstVec)=(-secondVec,-firstVec) # swap tab direction
first=0
#finish the line off
s+='L '+str(rootX+endOffsetX*thickness+dirX*length)+','+str(rootY+endOffsetY*thickness+dirY*length)+' '
if isTab and numDividers>0 and tabSymmetry==0 and not isDivider: # draw last for divider joints in side walls
for dividerNumber in range(1,int(numDividers)+1):
Dx=vectorX+-dirY*dividerSpacing*dividerNumber+notDirX*halfkerf+dirX*dogbone*halfkerf-dogbone*first*dirX
# Dy=vectorY+dirX*dividerSpacing*dividerNumber-notDirY*halfkerf+dirY*dogbone*halfkerf-dogbone*first*dirY
# Dx=vectorX+-dirY*dividerSpacing*dividerNumber-dividerEdgeOffsetX+notDirX*halfkerf
Dy=vectorY+dirX*dividerSpacing*dividerNumber-dividerEdgeOffsetY+notDirY*halfkerf
h='M '+str(Dx)+','+str(Dy)+' '
Dx=Dx+firstholelenX
Dy=Dy+firstholelenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx+notDirX*(thickness-kerf)
Dy=Dy+notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-firstholelenX
Dy=Dy-firstholelenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-notDirX*(thickness-kerf)
Dy=Dy-notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
group.add(getLine(h))
# for dividerNumber in range(1,int(numDividers)+1):
# Dx=vectorX+-dirY*dividerSpacing*dividerNumber+notDirX*halfkerf+dirX*dogbone*halfkerf
# Dy=vectorY+dirX*dividerSpacing*dividerNumber-notDirY*halfkerf+dirY*dogbone*halfkerf
# # Dx=vectorX+dirX*dogbone*halfkerf
# # Dy=vectorY+dirX*dividerSpacing*dividerNumber-dirX*halfkerf+dirY*dogbone*halfkerf
# h='M '+str(Dx)+','+str(Dy)+' '
# Dx=rootX+endOffsetX*thickness+dirX*length
# Dy+=dirY*tabWidth+notDirY*firstVec+first*dirY
# h+='L '+str(Dx)+','+str(Dy)+' '
# Dx+=notDirX*(secondVec-kerf)
# Dy+=notDirY*(secondVec+kerf)
# h+='L '+str(Dx)+','+str(Dy)+' '
# Dx-=vectorX
# Dy-=(dirY*tabWidth+notDirY*firstVec+first*dirY)
# h+='L '+str(Dx)+','+str(Dy)+' '
# Dx-=notDirX*(secondVec-kerf)
# Dy-=notDirY*(secondVec+kerf)
# h+='L '+str(Dx)+','+str(Dy)+' '
# group.add(getLine(h))
group.add(getLine(s))
return s
class BoxMaker(inkex.Effect):
def __init__(self):
# Call the base class constructor.
inkex.Effect.__init__(self)
# Define options
self.arg_parser.add_argument('--schroff',action='store',type=int,
dest='schroff',default=0,help='Enable Schroff mode')
self.arg_parser.add_argument('--rail_height',action='store',type=float,
dest='rail_height',default=10.0,help='Height of rail')
self.arg_parser.add_argument('--rail_mount_depth',action='store',type=float,
dest='rail_mount_depth',default=17.4,help='Depth at which to place hole for rail mount bolt')
self.arg_parser.add_argument('--rail_mount_centre_offset',action='store',type=float,
dest='rail_mount_centre_offset',default=0.0,help='How far toward row centreline to offset rail mount bolt (from rail centreline)')
self.arg_parser.add_argument('--rows',action='store',type=int,
dest='rows',default=0,help='Number of Schroff rows')
self.arg_parser.add_argument('--hp',action='store',type=int,
dest='hp',default=0,help='Width (TE/HP units) of Schroff rows')
self.arg_parser.add_argument('--row_spacing',action='store',type=float,
dest='row_spacing',default=10.0,help='Height of rail')
self.arg_parser.add_argument('--unit',action='store',type=str,
dest='unit',default='mm',help='Measure Units')
self.arg_parser.add_argument('--inside',action='store',type=int,
dest='inside',default=0,help='Int/Ext Dimension')
self.arg_parser.add_argument('--length',action='store',type=float,
dest='length',default=100,help='Length of Box')
self.arg_parser.add_argument('--width',action='store',type=float,
dest='width',default=100,help='Width of Box')
self.arg_parser.add_argument('--depth',action='store',type=float,
dest='height',default=100,help='Height of Box')
self.arg_parser.add_argument('--tab',action='store',type=float,
dest='tab',default=25,help='Nominal Tab Width')
self.arg_parser.add_argument('--equal',action='store',type=int,
dest='equal',default=0,help='Equal/Prop Tabs')
self.arg_parser.add_argument('--tabsymmetry',action='store',type=int,
dest='tabsymmetry',default=0,help='Tab style')
self.arg_parser.add_argument('--tabtype',action='store',type=int,
dest='tabtype',default=0,help='Tab type: regular or dogbone')
self.arg_parser.add_argument('--dimpleheight',action='store',type=float,
dest='dimpleheight',default=0,help='Tab Dimple Height')
self.arg_parser.add_argument('--dimplelength',action='store',type=float,
dest='dimplelength',default=0,help='Tab Dimple Tip Length')
self.arg_parser.add_argument('--hairline',action='store',type=int,
dest='hairline',default=0,help='Line Thickness')
self.arg_parser.add_argument('--thickness',action='store',type=float,
dest='thickness',default=10,help='Thickness of Material')
self.arg_parser.add_argument('--kerf',action='store',type=float,
dest='kerf',default=0.5,help='Kerf (width of cut)')
self.arg_parser.add_argument('--style',action='store',type=int,
dest='style',default=25,help='Layout/Style')
self.arg_parser.add_argument('--spacing',action='store',type=float,
dest='spacing',default=25,help='Part Spacing')
self.arg_parser.add_argument('--boxtype',action='store',type=int,
dest='boxtype',default=25,help='Box type')
self.arg_parser.add_argument('--div_l',action='store',type=int,
dest='div_l',default=25,help='Dividers (Length axis)')
self.arg_parser.add_argument('--div_w',action='store',type=int,
dest='div_w',default=25,help='Dividers (Width axis)')
self.arg_parser.add_argument('--keydiv',action='store',type=int,
dest='keydiv',default=3,help='Key dividers into walls/floor')
def effect(self):
global group,nomTab,equalTabs,tabSymmetry,dimpleHeight,dimpleLength,thickness,kerf,halfkerf,dogbone,divx,divy,hairline,linethickness,keydivwalls,keydivfloor
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# Get the attributes:
widthDoc = self.svg.unittouu(svg.get('width'))
heightDoc = self.svg.unittouu(svg.get('height'))
# Get script's option values.
hairline=self.options.hairline
unit=self.options.unit
inside=self.options.inside
schroff=self.options.schroff
kerf = self.svg.unittouu( str(self.options.kerf) + unit )
halfkerf=kerf/2
# Set the line thickness
if hairline:
linethickness=self.svg.unittouu('0.002in')
else:
linethickness=1
if schroff:
rows=self.options.rows
rail_height=self.svg.unittouu(str(self.options.rail_height)+unit)
row_centre_spacing=self.svg.unittouu(str(122.5)+unit)
row_spacing=self.svg.unittouu(str(self.options.row_spacing)+unit)
rail_mount_depth=self.svg.unittouu(str(self.options.rail_mount_depth)+unit)
rail_mount_centre_offset=self.svg.unittouu(str(self.options.rail_mount_centre_offset)+unit)
rail_mount_radius=self.svg.unittouu(str(2.5)+unit)
## minimally different behaviour for schroffmaker.inx vs. boxmaker.inx
## essentially schroffmaker.inx is just an alternate interface with different
## default settings, some options removed, and a tiny amount of extra logic
if schroff:
## schroffmaker.inx
X = self.svg.unittouu(str(self.options.hp * 5.08) + unit)
# 122.5mm vertical distance between mounting hole centres of 3U Schroff panels
row_height = rows * (row_centre_spacing + rail_height)
# rail spacing in between rows but never between rows and case panels
row_spacing_total = (rows - 1) * row_spacing
Y = row_height + row_spacing_total
else:
## boxmaker.inx
X = self.svg.unittouu( str(self.options.length + kerf) + unit )
Y = self.svg.unittouu( str(self.options.width + kerf) + unit )
Z = self.svg.unittouu( str(self.options.height + kerf) + unit )
thickness = self.svg.unittouu( str(self.options.thickness) + unit )
nomTab = self.svg.unittouu( str(self.options.tab) + unit )
equalTabs=self.options.equal
tabSymmetry=self.options.tabsymmetry
dimpleHeight=self.options.dimpleheight
dimpleLength=self.options.dimplelength
dogbone = 1 if self.options.tabtype == 1 else 0
layout=self.options.style
spacing = self.svg.unittouu( str(self.options.spacing) + unit )
boxtype = self.options.boxtype
divx = self.options.div_l
divy = self.options.div_w
keydivwalls = 0 if self.options.keydiv == 3 or self.options.keydiv == 1 else 1
keydivfloor = 0 if self.options.keydiv == 3 or self.options.keydiv == 2 else 1
initOffsetX=0
initOffsetY=0
if inside: # if inside dimension selected correct values to outside dimension
X+=thickness*2
Y+=thickness*2
Z+=thickness*2
# check input values mainly to avoid python errors
# TODO restrict values to *correct* solutions
# TODO restrict divisions to logical values
error=0
if min(X,Y,Z)==0:
inkex.errormsg(_('Error: Dimensions must be non zero'))
error=1
if max(X,Y,Z)>max(widthDoc,heightDoc)*10: # crude test
inkex.errormsg(_('Error: Dimensions Too Large'))
error=1
if min(X,Y,Z)<3*nomTab:
inkex.errormsg(_('Error: Tab size too large'))
error=1
if nomTab<thickness:
inkex.errormsg(_('Error: Tab size too small'))
error=1
if thickness==0:
inkex.errormsg(_('Error: Thickness is zero'))
error=1
if thickness>min(X,Y,Z)/3: # crude test
inkex.errormsg(_('Error: Material too thick'))
error=1
if kerf>min(X,Y,Z)/3: # crude test
inkex.errormsg(_('Error: Kerf too large'))
error=1
if spacing>max(X,Y,Z)*10: # crude test
inkex.errormsg(_('Error: Spacing too large'))
error=1
if spacing<kerf:
inkex.errormsg(_('Error: Spacing too small'))
error=1
if error: exit()
# For code spacing consistency, we use two-character abbreviations for the six box faces,
# where each abbreviation is the first and last letter of the face name:
# tp=top, bm=bottom, ft=front, bk=back, lt=left, rt=right
# Determine which faces the box has based on the box type
hasTp=hasBm=hasFt=hasBk=hasLt=hasRt = True
if boxtype==2: hasTp=False
elif boxtype==3: hasTp=hasFt=False
elif boxtype==4: hasTp=hasFt=hasRt=False
elif boxtype==5: hasTp=hasBm=False
elif boxtype==6: hasTp=hasFt=hasBk=hasRt=False
# else boxtype==1, full box, has all sides
# Determine where the tabs go based on the tab style
if tabSymmetry==2: # Antisymmetric (deprecated)
tpTabInfo=0b0110
bmTabInfo=0b1100
ltTabInfo=0b1100
rtTabInfo=0b0110
ftTabInfo=0b1100
bkTabInfo=0b1001
elif tabSymmetry==1: # Rotationally symmetric (Waffle-blocks)
tpTabInfo=0b1111
bmTabInfo=0b1111
ltTabInfo=0b1111
rtTabInfo=0b1111
ftTabInfo=0b1111
bkTabInfo=0b1111
else: # XY symmetric
tpTabInfo=0b0000
bmTabInfo=0b0000
ltTabInfo=0b1111
rtTabInfo=0b1111
ftTabInfo=0b1010
bkTabInfo=0b1010
def fixTabBits(tabbed, tabInfo, bit):
newTabbed = tabbed & ~bit
if inside:
newTabInfo = tabInfo | bit # set bit to 1 to use tab base line
else:
newTabInfo = tabInfo & ~bit # set bit to 0 to use tab tip line
return newTabbed, newTabInfo
# Update the tab bits based on which sides of the box don't exist
tpTabbed=bmTabbed=ltTabbed=rtTabbed=ftTabbed=bkTabbed=0b1111
if not hasTp:
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b0010)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b1000)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b0001)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b0100)
tpTabbed=0
if not hasBm:
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b1000)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b0010)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b0100)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b0001)
bmTabbed=0
if not hasFt:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b1000)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b1000)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b1000)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b1000)
ftTabbed=0
if not hasBk:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b0010)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b0010)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b0010)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b0010)
bkTabbed=0
if not hasLt:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b0100)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b0001)
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b0001)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b0001)
ltTabbed=0
if not hasRt:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b0001)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b0100)
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b0100)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b0100)
rtTabbed=0
# Layout positions are specified in a grid of rows and columns
row0=(1,0,0,0) # top row
row1y=(2,0,1,0) # second row, offset by Y
row1z=(2,0,0,1) # second row, offset by Z
row2=(3,0,1,1) # third row, always offset by Y+Z
col0=(1,0,0,0) # left column
col1x=(2,1,0,0) # second column, offset by X
col1z=(2,0,0,1) # second column, offset by Z
col2xx=(3,2,0,0) # third column, offset by 2*X
col2xz=(3,1,0,1) # third column, offset by X+Z
col3xzz=(4,1,0,2) # fourth column, offset by X+2*Z
col3xxz=(4,2,0,1) # fourth column, offset by 2*X+Z
col4=(5,2,0,2) # fifth column, always offset by 2*X+2*Z
col5=(6,3,0,2) # sixth column, always offset by 3*X+2*Z
# layout format:(rootx),(rooty),Xlength,Ylength,tabInfo,tabbed,pieceType
# root= (spacing,X,Y,Z) * values in tuple
# tabInfo= <abcd> 0=holes 1=tabs
# tabbed= <abcd> 0=no tabs 1=tabs on this side
# (sides: a=top, b=right, c=bottom, d=left)
# pieceType: 1=XY, 2=XZ, 3=ZY
tpFace=1
bmFace=1
ftFace=2
bkFace=2
ltFace=3
rtFace=3
def reduceOffsets(aa, start, dx, dy, dz):
for ix in range(start+1,len(aa)):
(s,x,y,z) = aa[ix]
aa[ix] = (s-1, x-dx, y-dy, z-dz)
# note first two pieces in each set are the X-divider template and Y-divider template respectively
pieces=[]
if layout==1: # Diagramatic Layout
rr = deepcopy([row0, row1z, row2])
cc = deepcopy([col0, col1z, col2xz, col3xzz])
if not hasFt: reduceOffsets(rr, 0, 0, 0, 1) # remove row0, shift others up by Z
if not hasLt: reduceOffsets(cc, 0, 0, 0, 1)
if not hasRt: reduceOffsets(cc, 2, 0, 0, 1)
if hasBk: pieces.append([cc[1], rr[2], X,Z, bkTabInfo, bkTabbed, bkFace])
if hasLt: pieces.append([cc[0], rr[1], Z,Y, ltTabInfo, ltTabbed, ltFace])
if hasBm: pieces.append([cc[1], rr[1], X,Y, bmTabInfo, bmTabbed, bmFace])
if hasRt: pieces.append([cc[2], rr[1], Z,Y, rtTabInfo, rtTabbed, rtFace])
if hasTp: pieces.append([cc[3], rr[1], X,Y, tpTabInfo, tpTabbed, tpFace])
if hasFt: pieces.append([cc[1], rr[0], X,Z, ftTabInfo, ftTabbed, ftFace])
elif layout==2: # 3 Piece Layout
rr = deepcopy([row0, row1y])
cc = deepcopy([col0, col1z])
if hasBk: pieces.append([cc[1], rr[1], X,Z, bkTabInfo, bkTabbed, bkFace])
if hasLt: pieces.append([cc[0], rr[0], Z,Y, ltTabInfo, ltTabbed, ltFace])
if hasBm: pieces.append([cc[1], rr[0], X,Y, bmTabInfo, bmTabbed, bmFace])
elif layout==3: # Inline(compact) Layout
rr = deepcopy([row0])
cc = deepcopy([col0, col1x, col2xx, col3xxz, col4, col5])
if not hasTp: reduceOffsets(cc, 0, 1, 0, 0) # remove col0, shift others left by X
if not hasBm: reduceOffsets(cc, 1, 1, 0, 0)
if not hasLt: reduceOffsets(cc, 2, 0, 0, 1)
if not hasRt: reduceOffsets(cc, 3, 0, 0, 1)
if not hasBk: reduceOffsets(cc, 4, 1, 0, 0)
if hasBk: pieces.append([cc[4], rr[0], X,Z, bkTabInfo, bkTabbed, bkFace])
if hasLt: pieces.append([cc[2], rr[0], Z,Y, ltTabInfo, ltTabbed, ltFace])
if hasTp: pieces.append([cc[0], rr[0], X,Y, tpTabInfo, tpTabbed, tpFace])
if hasBm: pieces.append([cc[1], rr[0], X,Y, bmTabInfo, bmTabbed, bmFace])
if hasRt: pieces.append([cc[3], rr[0], Z,Y, rtTabInfo, rtTabbed, rtFace])
if hasFt: pieces.append([cc[5], rr[0], X,Z, ftTabInfo, ftTabbed, ftFace])
for idx, piece in enumerate(pieces): # generate and draw each piece of the box
(xs,xx,xy,xz)=piece[0]
(ys,yx,yy,yz)=piece[1]
x=xs*spacing+xx*X+xy*Y+xz*Z+initOffsetX # root x co-ord for piece
y=ys*spacing+yx*X+yy*Y+yz*Z+initOffsetY # root y co-ord for piece
dx=piece[2]
dy=piece[3]
tabs=piece[4]
a=tabs>>3&1; b=tabs>>2&1; c=tabs>>1&1; d=tabs&1 # extract tab status for each side
tabbed=piece[5]
atabs=tabbed>>3&1; btabs=tabbed>>2&1; ctabs=tabbed>>1&1; dtabs=tabbed&1 # extract tabbed flag for each side
xspacing=(X-thickness)/(divy+1)
yspacing=(Y-thickness)/(divx+1)
xholes = 1 if piece[6]<3 else 0
yholes = 1 if piece[6]!=2 else 0
wall = 1 if piece[6]>1 else 0
floor = 1 if piece[6]==1 else 0
railholes = 1 if piece[6]==3 else 0
group = newGroup(self)
if schroff and railholes:
log("rail holes enabled on piece %d at (%d, %d)" % (idx, x+thickness,y+thickness))
log("abcd = (%d,%d,%d,%d)" % (a,b,c,d))
log("dxdy = (%d,%d)" % (dx,dy))
rhxoffset = rail_mount_depth + thickness
if idx == 1:
rhx=x+rhxoffset
elif idx == 3:
rhx=x-rhxoffset+dx
else:
rhx=0
log("rhxoffset = %d, rhx= %d" % (rhxoffset, rhx))
rystart=y+(rail_height/2)+thickness
if rows == 1:
log("just one row this time, rystart = %d" % rystart)
rh1y=rystart+rail_mount_centre_offset
rh2y=rh1y+(row_centre_spacing-rail_mount_centre_offset)
group.add(getCircle(rail_mount_radius,(rhx,rh1y)))
group.add(getCircle(rail_mount_radius,(rhx,rh2y)))
else:
for n in range(0,rows):
log("drawing row %d, rystart = %d" % (n+1, rystart))
# if holes are offset (eg. Vector T-strut rails), they should be offset
# toward each other, ie. toward the centreline of the Schroff row
rh1y=rystart+rail_mount_centre_offset
rh2y=rh1y+row_centre_spacing-rail_mount_centre_offset
group.add(getCircle(rail_mount_radius,(rhx,rh1y)))
group.add(getCircle(rail_mount_radius,(rhx,rh2y)))
rystart+=row_centre_spacing+row_spacing+rail_height
# generate and draw the sides of each piece
side(group,(x,y),(d,a),(-b,a),atabs * (-thickness if a else thickness),dx,(1,0),a,0,(keydivfloor|wall) * (keydivwalls|floor) * divx*yholes*atabs,yspacing) # side a
side(group,(x+dx,y),(-b,a),(-b,-c),btabs * (thickness if b else -thickness),dy,(0,1),b,0,(keydivfloor|wall) * (keydivwalls|floor) * divy*xholes*btabs,xspacing) # side b
if atabs:
side(group,(x+dx,y+dy),(-b,-c),(d,-c),ctabs * (thickness if c else -thickness),dx,(-1,0),c,0,0,0) # side c
else:
side(group,(x+dx,y+dy),(-b,-c),(d,-c),ctabs * (thickness if c else -thickness),dx,(-1,0),c,0,(keydivfloor|wall) * (keydivwalls|floor) * divx*yholes*ctabs,yspacing) # side c
if btabs:
side(group,(x,y+dy),(d,-c),(d,a),dtabs * (-thickness if d else thickness),dy,(0,-1),d,0,0,0) # side d
else:
side(group,(x,y+dy),(d,-c),(d,a),dtabs * (-thickness if d else thickness),dy,(0,-1),d,0,(keydivfloor|wall) * (keydivwalls|floor) * divy*xholes*dtabs,xspacing) # side d
if idx==0:
# remove tabs from dividers if not required
if not keydivfloor:
a=c=1
atabs=ctabs=0
if not keydivwalls:
b=d=1
btabs=dtabs=0
y=4*spacing+1*Y+2*Z # root y co-ord for piece
for n in range(0,divx): # generate X dividers
group = newGroup(self)
x=n*(spacing+X) # root x co-ord for piece
side(group,(x,y),(d,a),(-b,a),keydivfloor*atabs*(-thickness if a else thickness),dx,(1,0),a,1,0,0) # side a
side(group,(x+dx,y),(-b,a),(-b,-c),keydivwalls*btabs*(thickness if b else -thickness),dy,(0,1),b,1,divy*xholes,xspacing) # side b
side(group,(x+dx,y+dy),(-b,-c),(d,-c),keydivfloor*ctabs*(thickness if c else -thickness),dx,(-1,0),c,1,0,0) # side c
side(group,(x,y+dy),(d,-c),(d,a),keydivwalls*dtabs*(-thickness if d else thickness),dy,(0,-1),d,1,0,0) # side d
elif idx==1:
y=5*spacing+1*Y+3*Z # root y co-ord for piece
for n in range(0,divy): # generate Y dividers
group = newGroup(self)
x=n*(spacing+Z) # root x co-ord for piece
side(group,(x,y),(d,a),(-b,a),keydivwalls*atabs*(-thickness if a else thickness),dx,(1,0),a,1,divx*yholes,yspacing) # side a
side(group,(x+dx,y),(-b,a),(-b,-c),keydivfloor*btabs*(thickness if b else -thickness),dy,(0,1),b,1,0,0) # side b
side(group,(x+dx,y+dy),(-b,-c),(d,-c),keydivwalls*ctabs*(thickness if c else -thickness),dx,(-1,0),c,1,0,0) # side c
side(group,(x,y+dy),(d,-c),(d,a),keydivfloor*dtabs*(-thickness if d else thickness),dy,(0,-1),d,1,0,0) # side d
# Create effect instance and apply it.
effect = BoxMaker()
effect.run()

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>Schroff Box Maker</_name>
<id>eu.twot.render.schroffboxmaker</id>
<param name="unit" type="string" gui-hidden="true">mm</param>
<param name="inside" type="string" gui-hidden="true">1</param>
<param name="schroff" type="int" gui-hidden="true">1</param>
<param name="rows" type="int" min="1" max="6" _gui-text="Number of 3U rows:">1</param>
<param name="hp" type="int" min="4" max="168" _gui-text="Width (TE/HP units):">84</param>
<param name="length" type="float" precision="3" gui-hidden="true">0.0</param>
<param name="width" type="float" precision="3" gui-hidden="true">0.0</param>
<param name="depth" type="float" precision="3" min="30" max="300" _gui-text="Depth:">65</param>
<!-- these defaults are suitable for the rails sold by Elby Designs -->
<param name="rail_height" type="float" precision="3" min="7.0" max="10.0" _gui-text="Rail height:">10.0</param>
<param name="rail_mount_depth" type="float" precision="3" min="5" max="30" _gui-text="Rail mounting hole depth:">17.4</param>
<param name="rail_mount_centre_offset" type="float" precision="3" min="0.0" max="5.0" _gui-text="Rail mount hole centre-offset:">0.0</param>
<param name="row_spacing" type="float" precision="3" min="0.0" max="50.0" _gui-text="Spacing between rows:">0.0</param>
<param name="tab" type="float" precision="2" min="0.0" max="10000.0" _gui-text="Minimum/Prefered Tab Width">6.0</param>
<param name="equal" type="optiongroup" _gui-text="Tab Width">
<_option value="0">Fixed</_option>
<_option value="1">Proportional</_option>
</param>
<param name="thickness" type="float" precision="2" min="0.0" max="10000.0" _gui-text="Material Thickness">3.0</param>
<param name="kerf" type="float" precision="3" min="0.0" max="10000.0" _gui-text="Kerf (cut width)">0.1</param>
<param name="clearance" type="float" precision="3" min="0.0" max="10000.0" _gui-text="Joint clearance">0.01</param>
<param name="div_l" type="int" gui-hidden="true">0</param>
<param name="div_w" type="int" gui-hidden="true">0</param>
<param name="style" type="string" gui-hidden="true">1</param>
<param name="boxtype" type="int" gui-hidden="true">2</param>
<param name="spacing" type="float" precision="2" min="0.0" max="10000.0" _gui-text="Space Between Parts">1.0</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu _name="CNC Tools" />
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">boxmaker.py</command>
</script>
</inkscape-extension>

View file

@ -6,5 +6,8 @@
- import_tasks: silhouette.yml
tags:
- inkscape:silhouette
- import_tasks: tabbed_box_maker.yml
tags:
- inkscape:tabbed_box_maker
tags:
- inkscape

View file

@ -1,8 +1,8 @@
---
- name: install python-usb and usbip
- name: install python3-usb and usbip
apt:
name:
- python-usb
- python3-usb
- usbip
state: present

View file

@ -0,0 +1,11 @@
---
- name: copy files
copy:
src: tabbed_box_maker/{{ item }}
dest: /usr/share/inkscape/extensions
owner: root
group: root
loop:
- boxmaker.inx
- boxmaker.py
- schroffmaker.inx

View file

@ -14,6 +14,6 @@ if [ -z "$localboot" ]; then
sed -i 's/^\(GRUB_DEVICE=\).*$/\1""/' /usr/sbin/grub-mkconfig
#sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1'"'quiet boot=labsync labsync_localboot=\"$LABSYNC\"'/" /etc/default/grub
sed -i 's/^\(GRUB_CMDLINE_LINUX=\).*$/\1'"'boot=labsync labsync_localboot=\"$LABSYNC\"'/" /etc/default/grub
sed -i 's/^\(GRUB_TIMEOUT\)=.*$/\1=0/' /etc/default/grub
sed -i 's/^\(GRUB_TIMEOUT\)=.*$/\1=1/' /etc/default/grub
update-grub
fi

View file

@ -7,6 +7,8 @@ ExecStart=/usr/local/sbin/labsync-seeder.sh
PrivateTmp=yes
Type=simple
EnvironmentFile=/etc/environment
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

View file

@ -2,15 +2,16 @@
set -e
cd /tmp
cd /var/lib/labsync
rm -f "$LABSYNC_SQUASHFS_FILE"
ln -s "$LABSYNC_SQUASHFS_LV" "$LABSYNC_SQUASHFS_FILE"
exec aria2c \
--allow-overwrite \
--check-integrity \
--seed-ratio=0.0 \
--summary-interval=60 \
--file-allocation=none \
--enable-dht=false \
--force-save \
"$LABSYNC_TORRENT"

View file

@ -0,0 +1 @@
*.zip

View file

@ -0,0 +1,6 @@
[Desktop Entry]
Name=LightBurn
Exec=/opt/LightBurn/LightBurn
Icon=/opt/LightBurn/LightBurn.png
Type=Application
Categories=Graphics;VectorGraphics;Engineering;

View file

@ -0,0 +1,34 @@
- name: Download devices files
uri:
url: "{{ device_url }}"
return_content: true
loop: "{{ lightburn.devices }}"
loop_control:
loop_var: device_url
register: lightburn_downloaded_devices
- name: Create lightburn settings
set_fact:
lightburn_devices: "{{ lightburn_devices | default([]) + [device_settings] }}"
vars:
device_settings: "{{ (device.content | from_json)['DeviceList'][0] }}"
loop: "{{ lightburn_downloaded_devices.results }}"
loop_control:
loop_var: device
label: "{{ device_settings.DisplayName }}"
- name: Create settings directory
file:
path: "{{ item }}"
state: directory
loop:
- /etc/skel/.config
- /etc/skel/.config/LightBurn
- name: Create settings file
copy:
dest: /etc/skel/.config/LightBurn/prefs.ini
content: "{{ lightburn_settings | to_nice_json() }}"
vars:
lightburn_settings:
DeviceList: "{{ lightburn_devices }}"

View file

@ -0,0 +1,13 @@
---
- name: Extract zip file
unarchive:
src: lightburn.zip
dest: /opt
- name: Create applications directory
file:
path: /usr/local/share/applications/
state: directory
- name: Copy desktop file
copy:
src: lightburn.desktop
dest: /usr/local/share/applications/lightburn.desktop

View file

@ -0,0 +1,10 @@
---
- block:
- import_tasks: install.yml
tags:
- lightburn:install
- import_tasks: devices.yml
tags:
- lightburn:devices
tags:
- lightburn

View file

@ -1,7 +1,7 @@
---
- name: install python-apt
- name: install python3-apt
apt:
name: "python-apt"
name: "python3-apt"
state: present
- name: clear sources.list
@ -11,20 +11,20 @@
- name: configure main repo
apt_repository:
filename: "{{ ansible_distribution_release }}"
repo: "deb {{ debian_mirror }} {{ ansible_distribution_release }} {{ debian_sections | join(' ') }}"
filename: "{{ ansible_lsb.codename }}"
repo: "deb {{ debian_mirror }} {{ ansible_lsb.codename }} {{ debian_sections | join(' ') }}"
state: present
- name: configure updates repo
apt_repository:
filename: "{{ ansible_distribution_release }}-updates"
repo: "deb {{ mirror }} {{ ansible_distribution_release }}-updates {{ debian_sections | join(' ') }}"
filename: "{{ ansible_lsb.codename }}-updates"
repo: "deb {{ mirror }} {{ ansible_lsb.codename }}-updates {{ debian_sections | join(' ') }}"
state: present
vars:
mirror: "{{ debian_mirror_updates | default(debian_mirror) }}"
- name: configure security updates repo
apt_repository:
filename: "{{ ansible_distribution_release }}-security"
repo: "deb {{ debian_mirror_security }} {{ ansible_distribution_release }}/updates {{ debian_sections | join(' ') }}"
filename: "{{ ansible_lsb.codename }}-security"
repo: "deb {{ debian_mirror_security }}/debian-security/ {{ ansible_lsb.codename }}-security {{ debian_sections | join(' ') }}"
state: present

View file

@ -0,0 +1,2 @@
---
prusa_slicer_use_package: false

View file

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Prusa GCode viewer
Exec=/opt/PrusaSlicer/bin/prusa-slicer --gcodeviewer %F
Icon=/opt/PrusaSlicer/resources/icons/PrusaSlicer-gcodeviewer.svg
Terminal=false
Type=Application
MimeType=text/x.gcode;
Categories=Graphics;3DGraphics;
Keywords=3D;Printing;Slicer;

View file

@ -0,0 +1,12 @@
[Desktop Entry]
Name=PrusaSlicer
GenericName=3D Printing Software
Terminal=false
Exec=/opt/PrusaSlicer/bin/prusa-slicer %F
Icon=/opt/PrusaSlicer/resources/icons/PrusaSlicer.png
Type=Application
MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;
Categories=Graphics;3DGraphics;Engineering;
Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA
StartupNotify=false
StartupWMClass=prusa-slicer

View file

@ -0,0 +1,46 @@
---
- set_fact:
prusa_slicer_profiles_directory: /usr/share/PrusaSlicer/profiles
when: prusa_slicer_use_package | bool
- set_fact:
prusa_slicer_profiles_directory: /opt/PrusaSlicer/resources/profiles
when: not prusa_slicer_use_package | bool
- name: create skel directories
file:
path: "/etc/skel/{{ item }}"
state: directory
loop:
- .config
- .config/PrusaSlicer
- .config/PrusaSlicer/vendor
- name: create symlink to vendor profiles
file:
src: "{{ prusa_slicer_profiles_directory }}/{{ item }}.ini"
dest: /etc/skel/.config/PrusaSlicer/vendor/{{ item }}.ini
state: link
loop:
- PrusaResearch
- Ultimaker
- name: Stat /opt/PrusaSlicer
stat:
path: /opt/PrusaSlicer
register: prusa_slicer_stat
- name: Set version
set_fact:
prusa_slicer_version: "{{ prusa_slicer_stat.stat.lnk_target | regex_replace('^/opt/PrusaSlicer-(.*)-[0-9]{12}$', '\\1') }}"
when: prusa_slicer_stat.stat.exists and prusa_slicer_stat.stat.islnk
- debug:
var: prusa_slicer_version
- name: Copy Prusa slicer settings
copy:
content: |
version_system_info_sent = {{ prusa_slicer_version | default('') }}
{{ prusa_slicer.settings }}
dest: /etc/skel/.config/PrusaSlicer/PrusaSlicer.ini

View file

@ -0,0 +1,60 @@
---
- name: Get latest release
uri:
url: https://api.github.com/repos/prusa3d/PrusaSlicer/releases/latest
return_content: true
register: prusa_slicer_release
- name: Create tarball tempfile
tempfile:
state: file
suffix: .tar.gz
register: prusa_slicer_tarball
- name: Select asset
set_fact:
prusa_slicer_asset: "{{ asset }}"
when: "asset.name | regex_search('PrusaSlicer-.*linux-x64-GTK3.*\\.tar\\.bz2$')"
loop: "{{ prusa_slicer_release.json.assets }}"
loop_control:
loop_var: asset
label: "{{ asset.name }}"
- name: Download release file
get_url:
url: "{{ prusa_slicer_asset.browser_download_url }}"
dest: "{{ prusa_slicer_tarball.path }}"
force: true
- name: Extract tarball
unarchive:
src: "{{ prusa_slicer_tarball.path }}"
dest: /opt
remote_src: true
- name: Remove tarball
ansible.builtin.file:
path: "{{ prusa_slicer_tarball.path }}"
state: absent
when: prusa_slicer_tarball.path is defined
- name: Create symlink
file:
src: "/opt/{{ prusa_slicer_directory }}"
dest: "/opt/PrusaSlicer"
state: link
vars:
prusa_slicer_directory: "{{ prusa_slicer_asset.name | regex_replace('\\.tar\\.bz2$', '') }}"
- name: Create applications directory
file:
path: /usr/local/share/applications/
state: directory
- name: Copy desktop files
copy:
src: "{{ item }}.desktop"
dest: /usr/local/share/applications/{{ item }}.desktop
loop:
- PrusaSlicer
- PrusaGcodeviewer

View file

@ -0,0 +1,18 @@
---
- block:
- import_tasks: package.yml
when: prusa_slicer_use_package | bool
tags:
- prusa-slicer:install
- import_tasks: install_from_github.yml
when: not prusa_slicer_use_package | bool
tags:
- prusa-slicer:install
- import_tasks: configure.yml
tags:
- prusa-slicer:configure
tags:
- prusa-slicer

View file

@ -0,0 +1,5 @@
---
- name: install slic3r-prusa
apt:
name: slic3r-prusa
state: present

View file

@ -1,2 +1,2 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD0f7+Y4QSUsSvd360eq0Q/ESVfE/s0WxJIrzvW8cazTcmld8/rKxGQR2xrxApu7pzZlZC3LDbQrx3B6nNVEZi0dPUgkJz9oEKRY5vSJ6x0H9cZ0iFfTcCTz5znflqGaFI6E6W6Vtl+DzIrmkFgaR0wNmV9DCcYAJreW4E32t8dKsG1Pv347N0eAZs3shokPYr7dmGoNiKzTOn/ILQ1Hxppzqy1ch2h8k2KL0+FM6wO76ijivBzfMZRJW0DVYsmebO6Je5HglkzYXvrNUtcD2gIrNE0YKByjorTjjf3336S+0uBGxetzhnl+XA2PxHB/3n9AzYC4DI/Nb9wgLBo6Ql+EYaPLKnGl3JHvtcOyAfoNVPdNDfbZz+tfe8cBUt1IPTlm26RYKgwCnJvcBD6dk/5mxu1ogjSfgEIqihJaq3j3+NfIY1CUFx1U6ISG40SWEXF5xV1qW3NZg5FqqA8sOfWLlkON/yFkPJ2shXUXmiZtjXMWM6XLIO054EN7cpUxHGPspjgynU9XLc45c4k5lKF1xQv13B8n8dHNEL01MU21svfdGcpuOsRvzagLX51+rVRJObYP1bZudyYVDgsxB6B/TiBHw3Xl3mwEs4KVi/cqVsPpaG3hwqCreDlV+NeCVtb0qb1WJ2Sae83CA6NEcUvRbrwAnU/vEhJepfo6j7WSw== jalr@jalr-tp
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIN2OoowP25rTyS62coHoHuJD2134DsoAM7d0z5u7KvyK9hGs/3FWf6EQkdN/eHVrzjT4+yS+zNKPNAv9dBsC5iXS9xk2iZcscQIEsy57S5WtGmMaX50xWtwPN7RXp783eCKe9arU4Ttq6xDpL0ASHEq3BiMGcGT20X1c88bN1kxAQOYPsZGQRhwgLnMty8CJSxdJYgfjBJk01srp6I+YEZFPbS3IERDsYGrUyHBOkXnWbO6NAyDnlD97QOAVr32dgZfoqBDhGd0GVdU2PWI1A0IYFjvqB0xs8FJNF9ivrg1zH8KZ29HyGDzG+E6kYd8PQI97CcRrNR8ZwwP5F4/K/ simon@pita
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs0igb6TTxPkKEQ96pk/NEqqWvQH/miJEBAEe1bzHlo5n5ThnGYvVPadfHIwq1ix0IdAfyWoG8duaKVDJAUAFBtegRO7vRBYBYR04V8DE8n66MgDbbLDuu7Kbm4JWMUNg43KwJDzZtSvEKjyh5/u/TT59D1F+toxMfet++jNG03mFa6ANhMTjghbkFHj3eyuiXA/SxZLorhkCFW6Tri3u5FFLGpjaom1dZ5PAcic0+ZOECpgEwTj8FpOzmldjsu8gFxdPYGrqfA1dOxL3OQ6/rB0LfHjwrN9i3DrZzG+RfJxZbgO4/RLQz2sHYM6S6d1MtCcXThozCXSbmpdNdwdPp simon@kipf

View file

@ -4,7 +4,7 @@ gsettings set org.gnome.nm-applet disable-connected-notifications true
gsettings set org.gnome.nm-applet disable-disconnected-notifications true
# set background image
gsettings set org.mate.background picture-filename '/etc/lightdm/bg.jpg'
gsettings set org.mate.background picture-filename '/usr/share/wallpapers/wallpaper.jpg'
# set fonts
#gsettings set org.mate.interface monospace-font-name 'Monospace 10'
@ -17,8 +17,8 @@ xset s off -dpms
if echo $USER | grep -E 'guest-*'; then
gsettings set org.mate.screensaver lock-enabled false
zenity \
--title="Willkomen im FabLab Bad Windsheim" \
--title="$(head -n 1 /usr/local/share/guest-account/greeting)" \
--info \
--width=500 \
--text='Hallo!\n\nDu hast Dich mit einem Gast-Account angemeldet. Alle Daten werden nach der Anmeldung gelöscht. Wenn Du Deine Daten dauerhaft speichern möchtest, lege Dir bitte einene Account an!'
--text="$(tail -n +2 /usr/local/share/guest-account/greeting)"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

View file

@ -4,13 +4,12 @@
name:
- lightdm
- lightdm-gtk-greeter
- fonts-roboto
state: present
- name: get background image for lightdm
copy:
src: bg.jpg
dest: /etc/lightdm/bg.jpg
src: wallpaper.jpg
dest: /usr/share/wallpapers/wallpaper.jpg
- name: configure lightdm-gtk-greeter
ini_file:
@ -20,7 +19,7 @@
value: "{{ item.value }}"
loop:
- option: background
value: /etc/lightdm/bg.jpg
value: /usr/share/wallpapers/wallpaper.jpg
- option: font-name
value: Roboto
- option: hide-user-image

View file

@ -24,3 +24,13 @@
copy:
src: autostart.desktop
dest: /etc/skel/.config/autostart/autostart.desktop
- name: create guest-account directory
file:
path: /usr/local/share/guest-account
state: directory
- name: copy greetings file
template:
src: greeting.j2
dest: /usr/local/share/guest-account/greeting

View file

@ -0,0 +1,2 @@
{{ greeting.title }}
{{ greeting.content }}

114
packer/debian-bookworm.yaml Normal file
View file

@ -0,0 +1,114 @@
variables:
ci_commit_ref_name: '{{env `CI_COMMIT_REF_NAME`}}'
ci_commit_ref_slug: '{{env `CI_COMMIT_REF_SLUG`}}'
ci_commit_sha: '{{env `CI_COMMIT_SHA`}}'
ci_commit_tag: '{{env `CI_COMMIT_TAG`}}'
ci_job_id: '{{env `CI_JOB_ID`}}'
ci_job_manual: '{{env `CI_JOB_MANUAL`}}'
ci_job_name: '{{env `CI_JOB_NAME`}}'
ci_job_stage: '{{env `CI_JOB_STAGE`}}'
ci_pipeline_triggered: '{{env `PIPELINE_TRIGGERED`}}'
ci_project_url: '{{env `CI_PROJECT_URL`}}'
compression_level: '{{env `COMPRESSION_LEVEL`}}'
dpkg_list_file: '{{env `NAME`}}.dpkg-list'
images: '{{env `IMAGES`}}'
initramfs_file: '{{env `NAME`}}.initramfs'
linux_file: '{{env `NAME`}}.linux'
name: '{{env `NAME`}}'
squashfs_file: '{{env `NAME`}}.squashfs'
torrent_file: '{{env `NAME`}}.torrent'
builders:
- discard: true
image: debian:bookworm
type: docker
volumes:
'{{user `images`}}': /tmp/images
provisioners:
- inline:
- mkdir -p /etc/initramfs-tools/scripts/local-premount/
type: shell
- destination: /etc/initramfs-tools/scripts/
source: initramfs/labsync
type: file
- inline:
- echo "LABSYNC_JOB_ID='{{user `ci_job_id`}}'" >> /etc/environment
- echo "LABSYNC_COMMIT_SHA='{{user `ci_commit_sha`}}'" >> /etc/environment
- echo "LABSYNC_COMMIT_TAG='{{user `ci_commit_tag`}}'" >> /etc/environment
- echo "LABSYNC_COMMIT_REF_NAME='{{user `ci_commit_ref_name`}}'" >> /etc/environment
- echo "LABSYNC_COMMIT_REF_SLUG='{{user `ci_commit_ref_slug`}}'" >> /etc/environment
- echo "LABSYNC_PROJECT_URL='{{user `ci_project_url`}}'" >> /etc/environment
- sed -i 's#@@PROJECT_URL@@#{{user `ci_project_url`}}#' /etc/initramfs-tools/scripts/labsync
- chmod +x /etc/initramfs-tools/scripts/labsync
type: shell
- destination: /etc/initramfs-tools/scripts/local-premount/
source: initramfs/labsync-prereqs
type: file
- inline:
- set -x
- chmod +x /etc/initramfs-tools/scripts/local-premount/labsync-prereqs
- apt-get update
- apt-get -y dist-upgrade
- rmdir /boot && ln -s /usr/local/boot /boot
- apt-get -y install initramfs-tools || true
- echo squashfs >> /etc/initramfs-tools/modules
- echo overlay >> /etc/initramfs-tools/modules
- echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume
- mkdir /usr/local/boot
- apt-get -f -y install aria2 linux-image-amd64 lvm2 haveged fdisk
- mkdir -p /tmp/images
- cp $(find /boot/ -name 'initrd.img-*' | sort -V | tail -n 1) '/tmp/images/{{user `initramfs_file`}}'
- cp $(find /boot/ -name 'vmlinuz-*' | sort -V | tail -n 1) '/tmp/images/{{user `linux_file`}}'
type: shell
- inline:
- apt-get -y install openssh-server python3 lsb-release
type: shell
- playbook_file: ansible/playbook.yml
type: ansible
user: root
ansible_env_vars:
- "ANSIBLE_SSH_ARGS='-o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa'"
- "ANSIBLE_PYTHON_INTERPRETER=/usr/bin/python3"
extra_arguments:
- "--scp-extra-args"
- "'-O'"
- inline:
- rm /boot && mkdir /boot
type: shell
- inline:
- set -x
- apt-get -y install squashfs-tools
- dpkg -L squashfs-tools liblzo2-2 | while read f; do [ -f "$f" ] && echo "$f";
done > /tmp/ignore_files
- dpkg -l > /tmp/images/{{ user `dpkg_list_file` }}
- echo '/etc/resolv.conf' >> /tmp/ignore_files
- echo '/etc/hostname' >> /tmp/ignore_files
- echo '/etc/hosts' >> /tmp/ignore_files
- echo '/var/lib/docker' >> /tmp/ignore_files
- echo '/var/cache/apt/archives' >> /tmp/ignore_files
- echo '/var/lib/apt' >> /tmp/ignore_files
- mkdir -p /tmp/extra/tmp /tmp/extra/proc /tmp/extra/sys
type: shell
- destination: /etc/hosts.template
source: hosts
type: file
- inline:
- if [ -e '/tmp/images/{{user `squashfs_file`}}' ]; then rm '/tmp/images/{{user `squashfs_file`}}'; fi
- squashfs_content="$(find / -mindepth 1 -maxdepth 1 | grep -vE '^/(proc|sys|tmp|[.]dockerenv|packer-files)$')"
- >
mksquashfs $squashfs_content /tmp/extra/* '/tmp/images/{{user `squashfs_file`}}'
-comp zstd
-Xcompression-level {{user `compression_level`}}
-ef /tmp/ignore_files
type: shell
post-processors:
- inline:
- >
mktorrent
-n '{{user `name`}}'
-o '{{user `images`}}/{{user `torrent_file`}}'
-l 22
'{{user `images`}}/{{user `squashfs_file`}}'
type: shell-local

View file

@ -1,122 +0,0 @@
{
"variables": {
"name": "{{env `NAME`}}",
"squashfs_file": "{{env `NAME`}}.squashfs",
"initramfs_file": "{{env `NAME`}}.initramfs",
"linux_file": "{{env `NAME`}}.linux",
"dpkg_list_file": "{{env `NAME`}}.dpkg-list",
"compression_level": "{{env `COMPRESSION_LEVEL`}}",
"images": "{{env `IMAGES`}}",
"ci_job_id": "{{env `CI_JOB_ID`}}",
"ci_commit_sha": "{{env `CI_COMMIT_SHA`}}",
"ci_commit_tag": "{{env `CI_COMMIT_TAG`}}",
"ci_commit_ref_name": "{{env `CI_COMMIT_REF_NAME`}}",
"ci_commit_ref_slug": "{{env `CI_COMMIT_REF_SLUG`}}",
"ci_job_name": "{{env `CI_JOB_NAME`}}",
"ci_job_stage": "{{env `CI_JOB_STAGE`}}",
"ci_project_url": "{{env `CI_PROJECT_URL`}}",
"ci_pipeline_triggered": "{{env `PIPELINE_TRIGGERED`}}",
"ci_job_manual": "{{env `CI_JOB_MANUAL`}}"
},
"builders":
[
{
"type": "docker",
"image": "debian:stretch",
"discard": true,
"run_command": [
"-d",
"-i",
"-t",
"-v", "{{user `images`}}:/tmp/images",
"{{.Image}}",
"/bin/bash"
]
}
],
"provisioners": [
{
"type": "shell",
"inline": [ "mkdir -p /etc/initramfs-tools/scripts/local-premount/" ]
},
{
"type": "file",
"source": "initramfs/labsync",
"destination": "/etc/initramfs-tools/scripts/"
},
{
"type": "shell",
"inline": [
"echo \"LABSYNC_JOB_ID='{{user `ci_job_id`}}'\" >> /etc/environment",
"echo \"LABSYNC_COMMIT_SHA='{{user `ci_commit_sha`}}'\" >> /etc/environment",
"echo \"LABSYNC_COMMIT_TAG='{{user `ci_commit_tag`}}'\" >> /etc/environment",
"echo \"LABSYNC_COMMIT_REF_NAME='{{user `ci_commit_ref_name`}}'\" >> /etc/environment",
"echo \"LABSYNC_COMMIT_REF_SLUG='{{user `ci_commit_ref_slug`}}'\" >> /etc/environment",
"echo \"LABSYNC_PROJECT_URL='{{user `ci_project_url`}}'\" >> /etc/environment",
"sed -i 's#@@PROJECT_URL@@#{{user `ci_project_url`}}#' /etc/initramfs-tools/scripts/labsync"
]
},
{
"type": "file",
"source": "initramfs/labsync-prereqs",
"destination": "/etc/initramfs-tools/scripts/local-premount/"
},
{
"type": "shell",
"inline": [
"set -x",
"apt-get update",
"apt-get -y dist-upgrade",
"rmdir /boot && ln -s /usr/local/boot /boot",
"apt-get -y install initramfs-tools || true",
"echo squashfs >> /etc/initramfs-tools/modules",
"echo overlay >> /etc/initramfs-tools/modules",
"echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume",
"mkdir /usr/local/boot",
"apt-get -f -y install aria2 linux-image-amd64 lvm2",
"cp $(find /boot/ -name 'initrd.img-*' | sort -V | tail -n 1) '/tmp/images/{{user `initramfs_file`}}'",
"cp $(find /boot/ -name 'vmlinuz-*' | sort -V | tail -n 1) '/tmp/images/{{user `linux_file`}}'"
]
},
{
"type": "shell",
"inline": [ "apt-get -y install openssh-server python" ]
},
{
"type": "ansible",
"playbook_file": "ansible/playbook.yml",
"user": "root"
},
{
"type": "shell",
"inline": [ "rm /boot && mkdir /boot" ]
},
{
"type": "shell",
"inline": [
"set -x",
"apt-get -y install squashfs-tools",
"dpkg -L squashfs-tools liblzo2-2 | while read f; do [ -f \"$f\" ] && echo \"$f\"; done > /tmp/ignore_files",
"dpkg -l > /tmp/images/{{ user `dpkg_list_file` }}",
"echo '/etc/resolv.conf' >> /tmp/ignore_files",
"echo '/etc/hostname' >> /tmp/ignore_files",
"echo '/etc/hosts' >> /tmp/ignore_files",
"echo '/var/lib/docker' >> /tmp/ignore_files",
"mkdir -p /tmp/extra/tmp /tmp/extra/proc /tmp/extra/sys /tmp/extra/etc"
]
},
{
"type": "file",
"source": "hosts",
"destination": "/etc/hosts.template"
},
{
"type": "shell",
"inline": [
"if [ -e '/tmp/images/{{user `squashfs_file`}}' ]; then rm '/tmp/images/{{user `squashfs_file`}}'; fi",
"squashfs_content=\"$(find / -mindepth 1 -maxdepth 1 | grep -vE '^/(proc|sys|tmp|[.]dockerenv|packer-files)$')\"",
"mksquashfs $squashfs_content /tmp/extra/* '/tmp/images/{{user `squashfs_file`}}' -comp lzo -Xcompression-level {{user `compression_level`}} -ef /tmp/ignore_files"
]
}
]
}

View file

@ -92,6 +92,8 @@ labsync_configure_dns() {
labsync_mount_root() {
haveged
export PATH="/usr/local/bin:$PATH"
[ "$labsync_debug" = 1 ] && set -x
sed -i 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/lvm.conf
@ -110,7 +112,7 @@ labsync_mount_root() {
labsync_info "Updating partitions"
size_disk=$(blockdev --getsz /dev/${labsync_disk})
size_part_1=$((labsync_partsize_boot * 1024 * 1024 / 512))
size_part_2=$(((size_disk - labsync_partsize_boot) * 1024 * 1024 / 512))
size_part_2=$((size_disk - size_part_1 - 2048))
start_part_2=$((size_part_1 + 2048))
dmsetup ls --tree
@ -152,7 +154,7 @@ PARTTABLE
lvm vgcreate "$vg_name" "$pv_device"
fi
lvm lvchange -ay vglab
lvm lvchange -ay "$vg_name"
labsync_create_or_resize_lv "$vg_name" "$lv_name_sqashfs" $((image_size_bytes * 2)) $image_size_bytes
labsync_create_or_resize_lv "$vg_name" "$lv_name_overlay" $((10000 * 1024 * 1024))
@ -176,6 +178,7 @@ PARTTABLE
--summary-interval=0 \
--file-allocation=none \
--enable-dht=false \
--force-save \
/tmp/torrent
)
else
@ -184,6 +187,7 @@ PARTTABLE
lv_name_overlay="ovly-$labsync_localboot"
lv_path_squashfs="$(labsync_lv_path "$vg_name" "$lv_name_sqashfs")"
lv_path_overlay="$(labsync_lv_path "$vg_name" "$lv_name_overlay")"
lvm lvchange -ay "$vg_name"
fi
labsync_info "Mounting squashfs and overlay"
@ -201,6 +205,9 @@ PARTTABLE
echo $hostname > ${rootmnt}/etc/hostname
sed "s/@@HOSTNAME@@/$hostname/" ${rootmnt}/etc/hosts.template > ${rootmnt}/etc/hosts
mkdir -p ${rootmnt}/var/lib/labsync
cp /tmp/torrent.aria2 ${rootmnt}/var/lib/labsync
if [ -z "$labsync_localboot" ]; then
labsync_set_environment LABSYNC "$torrent_name"
labsync_set_environment LABSYNC_TORRENT "${labsync_torrent}"
@ -213,7 +220,7 @@ PARTTABLE
"")
;;
pause)
read x
sh -i
;;
*)
sleep $labsync_wait

View file

@ -6,10 +6,12 @@ case $1 in
# GETS EXECUTED WHEN BUILDING INITRAMFS
##
. /usr/share/initramfs-tools/hook-functions
copy_exec /sbin/mke2fs
rm -f "$DESTDIR/sbin/mke2fs"
copy_exec /sbin/e2fsck
copy_exec /usr/bin/aria2c
copy_exec /sbin/mke2fs
copy_exec /sbin/sfdisk
copy_exec /usr/bin/aria2c
copy_exec /usr/sbin/haveged
copy_file cert /etc/ssl/certs/ca-certificates.crt
exit 0
;;

17
scripts/packer.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -e
set -o nounset
export NAME="$1"
mkdir -p images
export IMAGES="$(realpath images)"
(
cd packer
python3 -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=4)' < "$NAME.yaml" > "$NAME.json"
packer build "$NAME.json"
)
echo "$NAME" >> images.txt

View file

@ -1,4 +1,4 @@
FROM debian:stretch-slim
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get -y install \
@ -7,13 +7,17 @@ RUN apt-get update \
python3 \
python3-apt \
python3-pip \
python3-urllib3 \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /tmp/requirements.txt
COPY setup.py /code/setup.py
RUN pip3 install -r /tmp/requirements.txt
WORKDIR /code
RUN python3 -m venv --system-site-packages venv
RUN venv/bin/pip install -e .
ADD . /code
RUN (cd /code && python3 setup.py install)
RUN venv/bin/python setup.py install

View file

@ -1,8 +0,0 @@
#!/usr/bin/env python3
import sys
import security_scanner.main
if __name__ == '__main__':
security_scanner.main.main(sys.argv)

View file

@ -1,2 +0,0 @@
python-gitlab==1.4.0
urllib3==1.22

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python3
import os
import sys
import security_scanner
from security_scanner.debian_tracker import DebianTracker
from security_scanner.dpkg_list import DpkgList
from security_scanner.gitlab import GitLab
@ -28,13 +27,22 @@ def checkDebianDistro(distro):
return result
def main(argv):
gitlab = GitLab()
for distro in argv[1:]:
job = gitlab.getLastSuccessfulJob('master', 'squashfs_master')
gitlab.downloadArtifact(job, 'images/debian-' + distro + '.dpkg-list', 'debian-' + distro + '.dpkg-list')
if checkDebianDistro(distro) > 0:
ref = job.attributes['ref']
print("creating pipeline for reference {}".format(ref))
pprint(job.attributes)
gitlab.createPipeline(ref)
if __name__ == '__main__':
gitlab_url = os.environ.get('GITLAB_URL')
project_id = os.environ.get('CI_PROJECT_ID')
api_token = os.environ.get('PRIVATE_TOKEN')
gitlab = GitLab(gitlab_url, project_id, api_token)
for distro in sys.argv[1:]:
job = gitlab.getLastSuccessfulJob('main', 'squashfs_main')
if job is not None:
gitlab.downloadArtifact(job, 'images/debian-' + distro + '.dpkg-list', 'debian-' + distro + '.dpkg-list')
if checkDebianDistro(distro) > 0:
ref = job.attributes['ref']
print("creating pipeline for reference {}".format(ref))
pprint(job.attributes)
gitlab.createPipeline(ref)
else:
print('last successful job not found')
sys.exit(1)

View file

@ -1,34 +1,30 @@
#!/usr/bin/env python
import gitlab
import os
from security_scanner.file_writer import FileWriter
class GitLab:
def __init__(self):
gitlab_url = os.environ.get('GITLAB_URL')
api_token = os.environ.get('PRIVATE_TOKEN')
project_id = os.environ.get('CI_PROJECT_ID')
def __init__(self, gitlab_url, project_id, api_token=None):
if gitlab_url is None:
raise ValueError('must pass gitlab_url')
if project_id is None:
raise ValueError('must pass project_id')
self._gl = gitlab.Gitlab(gitlab_url, private_token=api_token)
self._project = self._gl.projects.get(project_id)
def getLastSuccessfulJob(self, ref, name):
pipelines = self._project.pipelines.list()
pipelines = self._project.pipelines.list(ref=ref, status='success', as_list=False)
last_successful_job = None
for pipeline in pipelines:
jobs = pipeline.jobs.list()
jobs = pipeline.jobs.list(scope='success', as_list=False)
for job in jobs:
if job.ref == ref and job.attributes['name'] == name and job.attributes['status'] == 'success':
if last_successful_job is not None:
if job.attributes['id'] > last_successful_job.attributes['id']:
last_successful_job = job
else:
last_successful_job = job
if job.attributes['name'] == name:
return job
return last_successful_job
return None
def downloadArtifact(self, job, sourcePath, destPath):
job_id = job.attributes['id']

View file

@ -1,15 +1,11 @@
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import setuptools
config = {
'name': 'security_scanner',
'install_requires': [],
'packages': [
'security_scanner',
setuptools.setup(
name='security_scanner',
version='1.2.0',
packages=setuptools.find_packages(),
install_requires=[
'python-gitlab==1.7.0',
'urllib3==1.24.1',
],
'scripts': ['bin/security-scanner']
}
setup(**config)
)

View file

@ -1,7 +1,7 @@
label labsync
menu label ^labsync
kernel images/debian-stretch.linux
append initrd=images/debian-stretch.initramfs.dev boot=labsync labsync_disk=sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/debian-stretch.torrent quiet vga=792 ip=10.2.2.10:::255.255.255.0:qemu-host:ens3:off labsync_wait=pause
kernel images/debian-bookworm.linux
append initrd=images/debian-bookworm.initramfs.dev boot=labsync labsync_disk=sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/debian-bookworm.torrent quiet vga=792 ip=10.2.2.10:::255.255.255.0:qemu-host:ens3:off labsync_wait=pause
label install
menu label ^Install