Compare commits

...

4 Commits

6 changed files with 95 additions and 43 deletions

View File

@ -2,50 +2,13 @@ file:
/home/pi/printer.cfg: /home/pi/printer.cfg:
exists: true exists: true
filetype: file filetype: file
owner: pi owner: root
group: pi group: root
mode: "0644" mode: "0644"
contents: contents:
- "[include printer_hw/hw.cfg]" - "[include printer_hw/*.cfg]"
- "[include printer_soft/*.cfg]"
- "[include 3dscreen/klipper/configs/*.cfg]" - "[include 3dscreen/klipper/configs/*.cfg]"
- "[include printer/*.cfg]" - "[include printer/*.cfg]"
- "[bltouch]"
/home/pi/printer_hw/bed.cfg:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
/home/pi/printer_hw/filament_sensor.cfg:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
/home/pi/printer_hw/hw.cfg:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
/home/pi/printer_soft/soft.cfg:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
/home/pi/printer_data/variables.cfg:
exists: true
filetype: file
owner: pi
group: pi
mode: "0644"
/home/pi/printer_hw: /home/pi/printer_hw:
filetype: directory filetype: directory
@ -54,11 +17,11 @@ file:
group: root group: root
mode: "0755" mode: "0755"
/home/pi/printer_soft: /home/pi/printer_data:
filetype: directory filetype: directory
exists: true exists: true
owner: root owner: pi
group: root group: pi
mode: "0755" mode: "0755"
/home/pi/printer: /home/pi/printer:

21
helper_post Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
. variables.inc.sh
[ -e /home/pi/klipper ] && {
su - pi -c "cd /home/pi/klipper \
&& git pull \
"
:
} || {
su - pi -c "cd /home/pi \
&& git clone --depth=1 $GITEA_BASE/klipper.git \
&& (cd klipper && git config pull.rebase false) \
&& ./klipper/scripts/install-octopi.sh \
"
}
install -m644 -o 0 -g 0 $ConfigsHome/etc/default/klipper /etc/default/klipper
systemctl enable klipper 2>/dev/null
systemctl disable octoprint 2>/dev/null
systemctl restart klipper 2>/dev/null &

60
helper_pre Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
. variables.inc.sh
[ "$configsHome" = "$ConfigsHome" ] || \
echo "Custom ConfigsHome: $ConfigsHome"
set -x
git config pull.rebase false
[ -e "$ConfigsHome" ] && {
(cd "$ConfigsHome" \
&& git pull \
)
:
} || {
git clone "$GITEA_BASE/octopi_configs.git" "$ConfigsHome"
(cd "$ConfigsHome" && git config pull.rebase false)
}
mkdir -p /home/pi/printer_hw
chown -R 0:0 /home/pi/printer_hw
mkdir -p /home/pi/.klippy
chown pi:pi /home/pi/.klippy
install -m440 -o 0 -g 0 $ConfigsHome/etc/sudoers.d/010_pi-nopasswd /etc/sudoers.d/010_pi-nopasswd
[ -e /home/pi/.octoprint/plugins/OctoprintKlipperPlugin ] && {
bash -c 'cd /home/pi/.octoprint/plugins/OctoprintKlipperPlugin \
&& git pull \
'
:
} || {
bash -c "cd /home/pi/.octoprint/plugins \
&& git clone --depth=1 $GITEA_BASE/OctoprintKlipperPlugin.git \
&& (cd OctoprintKlipperPlugin && git config pull.rebase false) \
"
}
SCREEN_URI="$GITEA_BASE/3diyscreen-klip-tek/releases/download/latest/3dscreen.zip"
SCREEN_PATH=/home/pi/3dscreen
SCREEN_ARCHIVE=/home/pi/3dscreen.zip
[ -e /home/pi/3dscreen ] || { \
rm -rf "$SCREEN_PATH" "$SCREEN_ARCHIVE" \
&& wget "$SCREEN_URI" -O "$SCREEN_ARCHIVE" \
&& mkdir -p "$SCREEN_PATH" \
&& (cd "$SCREEN_PATH" \
&& unzip -q "$SCREEN_ARCHIVE" \
) \
&& echo "3dscreen: `cat $SCREEN_PATH/version`"
}
[ -e /home/pi/3dscreen.settings.json ] || \
install -m644 -o 0 -g 0 $ConfigsHome/home/pi/3dscreen.settings.json /home/pi/3dscreen.settings.json
[ -e /home/pi/3dscreen.custom.config.js ] || \
touch /home/pi/3dscreen.custom.config.js

BIN
install

Binary file not shown.

Binary file not shown.

8
variables.inc.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
GITEA_BASE="https://app.3diy.ru:9999/3diy"
HomePi="/home/pi"
SetupHome="$HomePi/.setup"
InstallHome="$PWD"
configsHome="$SetupHome/cfg"
ConfigsHome=${MY_ConfigsHome:-$configsHome}