3dscreen_installer/helper_pre

61 lines
1.6 KiB
Bash
Executable File

#!/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