Merge branch 'lightburn-without-docker' into 'main'

Lightburn without docker

See merge request fablab/labsync!80
This commit is contained in:
jalr 2023-09-14 19:57:10 +00:00
commit c04f57309b
12 changed files with 79 additions and 122 deletions

View file

@ -26,8 +26,6 @@ dockerimage_builder:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- make builderimg
- docker push $DOCKER_IMAGE_BUILDER
tags:
- fablab
except:
refs:
- schedules
@ -43,8 +41,6 @@ dockerimage_security_scanner:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- make secscanimg
- docker push $DOCKER_IMAGE_SECURITY_SCANNER
tags:
- fablab
except:
refs:
- schedules
@ -63,8 +59,17 @@ security_scanner:
variables:
- $task == "security-scanner"
- $target
tags:
- fablab
lightburn-download:
stage: prepare
image: alpine
script:
- 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:
- packer/ansible/roles/lightburn/files/lightburn.zip
expire_in: 4 hours
.squashfs_template: &squashfs_template
image: $DOCKER_IMAGE_BUILDER
@ -82,9 +87,6 @@ security_scanner:
- images/*.linux
#- images/*.squashfs
- images/*.torrent
tags:
- fablab
- ssd
squashfs_featurebranch:
<<: *squashfs_template

View file

@ -11,6 +11,7 @@
- role: firefox
- role: windowmanager
- role: inkscape
- role: lightburn
- role: fablab
- role: hardware
- role: docker
@ -109,3 +110,6 @@
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

View file

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

View file

@ -1,34 +0,0 @@
#!/usr/bin/env bash
. /etc/default/lightburn
if [ ! -z "$SUDO_COMMAND" ] && [ "$SUDO_COMMAND" = "$0" ]; then
home="$(getent passwd "$SUDO_UID" | cut -d: -f6)"
export PUID="$SUDO_UID"
export PGID="$SUDO_GID"
else
home="$HOME"
export PUID=$(id -u)
export PGID=$(id -g)
fi
config_dir="$home/.config/lightburn"
mkdir -p "$config_dir"
media="/media/$(id -un $PUID)"
if [ -e "$media" ]; then
media_volume="-v $media:/media"
fi
docker run \
--rm \
-e PUID \
-e PGID \
-e DISPLAY \
-v /tmp/.X11-unix/:/tmp/.X11-unix/ \
-v $config_dir:/config/ \
-v $home:/workdir/ \
$media_volume \
--network=none \
"$LIGHTBURN_DOCKER_IMAGE"

View file

@ -1,66 +0,0 @@
---
- file:
path: /usr/local/share/lightburn
state: directory
mode: "0755"
owner: root
group: root
- name: copy icon
copy:
src: lightburn/lightburn.png
dest: /usr/local/share/lightburn/lightburn.png
owner: root
group: root
mode: "0644"
- name: copy script
copy:
src: lightburn/lightburn.sh
dest: /usr/local/bin/lightburn
owner: root
group: root
mode: "0755"
- name: add lightburn configuration
template:
src: lightburn/lightburn.j2
dest: /etc/default/lightburn
owner: root
group: root
mode: "0644"
- name: add lightburn to applications menu
copy:
src: lightburn/lightburn.desktop
dest: /usr/share/applications/lightburn.desktop
owner: root
group: root
mode: "0644"
- name: add group
group:
name: lightburn
system: yes
- name: add sudoers config
copy:
content: "%lightburn ALL=/usr/local/bin/lightburn, NOPASSWD:/usr/local/bin/lightburn\n"
dest: /etc/sudoers.d/lightburn
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 lightburn group to guest account
lineinfile:
path: /etc/guest-account/groups
line: lightburn
create: yes

View file

@ -18,9 +18,6 @@
- import_tasks: visicut.yml
tags:
- fablab:visicut
- import_tasks: lightburn.yml
tags:
- fablab:lightburn
- import_tasks: prusa.yml
tags:
- fablab:prusa

View file

@ -1 +0,0 @@
LIGHTBURN_DOCKER_IMAGE='{{ fablab.lightburn.dockerimage }}'

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