Merge branch 'metalcut' into 'master'
Metalcut See merge request fablab/labsync!23
This commit is contained in:
commit
2cb9e7e30c
8 changed files with 1298 additions and 1 deletions
|
|
@ -58,6 +58,9 @@
|
|||
url: "https://github.com/t-oster/VisiCut/releases/download/1.7_310/visicut_1.7-310-gcf8c087-1_all.deb"
|
||||
cura:
|
||||
version: 3.2.1
|
||||
metalcut:
|
||||
socket: laser.lab.fablab-nea.de:9000
|
||||
dockerimage: r.jalr.de/fablab/metalcut
|
||||
debian_sections:
|
||||
- main
|
||||
- contrib
|
||||
|
|
|
|||
|
|
@ -5,3 +5,5 @@ Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/b
|
|||
root ALL=(ALL:ALL) ALL
|
||||
|
||||
%fablab ALL=(ALL:ALL) ALL
|
||||
|
||||
#includedir /etc/sudoers.d
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
[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
|
||||
1190
packer/ansible/roles/fablab/files/metalcut/metalcut.svg
Normal file
1190
packer/ansible/roles/fablab/files/metalcut/metalcut.svg
Normal file
File diff suppressed because it is too large
Load diff
|
After Width: | Height: | Size: 94 KiB |
|
|
@ -17,3 +17,6 @@
|
|||
- import_tasks: visicut.yml
|
||||
tags:
|
||||
- fablab:visicut
|
||||
- import_tasks: metalcut.yml
|
||||
tags:
|
||||
- fablab:metalcut
|
||||
|
|
|
|||
58
packer/ansible/roles/fablab/tasks/metalcut.yml
Normal file
58
packer/ansible/roles/fablab/tasks/metalcut.yml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
- 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
|
||||
24
packer/ansible/roles/fablab/templates/metalcut/metalcut.sh.j2
Executable file
24
packer/ansible/roles/fablab/templates/metalcut/metalcut.sh.j2
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
remote='{{ fablab.metalcut.socket }}'
|
||||
image='{{ fablab.metalcut.dockerimage }}'
|
||||
|
||||
if [ ! -z "$SUDO_COMMAND" ] && [ "$SUDO_COMMAND" = "$0" ]; then
|
||||
home="$(getent passwd "$SUDO_USER" | 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" \
|
||||
-e remote="$remote" \
|
||||
$image
|
||||
|
|
@ -21,6 +21,11 @@ if [ -f /etc/default/locale ]; then
|
|||
export LANG LANGUAGE
|
||||
fi
|
||||
|
||||
# read list of supplementary groups of the guest account from file
|
||||
if [ -f /etc/guest-account/groups ]; then
|
||||
GROUPS="$(cat /etc/guest-account/groups)"
|
||||
fi
|
||||
|
||||
is_system_user ()
|
||||
{
|
||||
UID_MIN=$(cat /etc/login.defs | grep UID_MIN | awk '{print $2}')
|
||||
|
|
@ -45,6 +50,9 @@ add_account ()
|
|||
}
|
||||
rmdir "${temp_home}"
|
||||
fi
|
||||
if [ "${GROUPS}" != "" ]; then
|
||||
GROUPS="--groups ${GROUPS}"
|
||||
fi
|
||||
|
||||
# if ${GUEST_USER} already exists, it must be a locked system account with no existing
|
||||
# home directory
|
||||
|
|
@ -74,7 +82,7 @@ add_account ()
|
|||
fi
|
||||
else
|
||||
# does not exist, so create it
|
||||
useradd --system --home-dir ${GUEST_HOME} --comment $(gettext "Guest") --user-group --shell /bin/bash ${GUEST_USER} || {
|
||||
useradd --system --home-dir ${GUEST_HOME} --comment $(gettext "Guest") --user-group --shell /bin/bash ${GROUPS} ${GUEST_USER} || {
|
||||
rm -rf ${GUEST_HOME}
|
||||
exit 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue