Add wrapper for prusa-slicer for syncing configs
This commit is contained in:
parent
5365953348
commit
8030f44df3
19
roles/prusa-slicer/files/usr/local/bin/prusa-slicer.wrapper
Executable file
19
roles/prusa-slicer/files/usr/local/bin/prusa-slicer.wrapper
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
CONFIG_PATH="${HOME}/.config/PrusaSlicer"
|
||||||
|
CURRENT_DIR=$(pwd)
|
||||||
|
BIN_PATH=/usr/local/bin
|
||||||
|
|
||||||
|
cd "$CONFIG_PATH" && \
|
||||||
|
git pull
|
||||||
|
|
||||||
|
|
||||||
|
cd "${CURRENT_DIR}"
|
||||||
|
"${BIN_PATH}/prusa-slicer.real"
|
||||||
|
|
||||||
|
cd "${CONFIG_PATH}" && \
|
||||||
|
git add . && \
|
||||||
|
git commit -m "$(date +%Y.%m.%d\ %H:%M)" && \
|
||||||
|
git push
|
||||||
|
|
||||||
|
cd "${CURRENT_DIR}"
|
@ -1,6 +0,0 @@
|
|||||||
- name: checkout prusa profiles repo
|
|
||||||
git:
|
|
||||||
repo: "{{ prusa_slicer.repo }}"
|
|
||||||
dest: "{{ ansible_user_dir }}/.config/PrusaSlicer"
|
|
||||||
clone: yes
|
|
||||||
update: yes
|
|
26
roles/prusa-slicer/tasks/config-repository.yml
Normal file
26
roles/prusa-slicer/tasks/config-repository.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
- name: checkout prusa profiles repo
|
||||||
|
git:
|
||||||
|
repo: "{{ prusa_slicer.repo }}"
|
||||||
|
dest: "{{ ansible_user_dir }}/.config/PrusaSlicer"
|
||||||
|
clone: yes
|
||||||
|
update: yes
|
||||||
|
|
||||||
|
- name: Install wrapper
|
||||||
|
become: yes
|
||||||
|
copy:
|
||||||
|
src: usr/local/bin/prusa-slicer.wrapper
|
||||||
|
dest: /usr/local/bin/prusa-slicer.wrapper
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: clean link
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
path: "/usr/local/bin/prusa-slicer"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Create symbolic link to wrapper
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
src: "/usr/local/bin/prusa-slicer.wrapper"
|
||||||
|
dest: "/usr/local/bin/prusa-slicer"
|
||||||
|
state: link
|
@ -21,7 +21,7 @@
|
|||||||
when: ansible_architecture == "x86_64"
|
when: ansible_architecture == "x86_64"
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*x64-GTK3.*AppImage'))[0] }}"
|
url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*x64-GTK3.*AppImage'))[0] }}"
|
||||||
dest: /usr/local/bin/prusa-slicer
|
dest: /usr/local/bin/prusa-slicer.real
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: "Download URL"
|
- name: "Download URL"
|
||||||
@ -34,5 +34,18 @@
|
|||||||
become: yes
|
become: yes
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*armv7l-GTK2.*AppImage'))[0] }}"
|
url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*armv7l-GTK2.*AppImage'))[0] }}"
|
||||||
dest: /usr/local/bin/prusa-slicer
|
dest: /usr/local/bin/prusa-slicer.real
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Clean symbolic link
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
path: "/usr/local/bin/prusa-slicer"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Create symbolic link to real app
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
src: "/usr/local/bin/prusa-slicer.real"
|
||||||
|
dest: "/usr/local/bin/prusa-slicer"
|
||||||
|
state: link
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
- include: install-program.yml
|
- include: install-program.yml
|
||||||
|
|
||||||
- include: checkout-git.yml
|
- include: config-repository.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user