2024-03-15 21:49:12 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. variables.inc.sh
|
|
|
|
|
2024-03-16 01:44:10 +03:00
|
|
|
echo
|
|
|
|
echo "Starting: helper_post"
|
|
|
|
|
2024-03-16 06:21:24 +03:00
|
|
|
set -xe
|
2024-03-16 01:44:10 +03:00
|
|
|
|
2024-03-15 21:49:12 +03:00
|
|
|
[ -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 \
|
|
|
|
"
|
|
|
|
}
|
2024-08-15 01:53:31 +03:00
|
|
|
install -m644 -o 0 -g 0 -C $ConfigsHome/etc/default/klipper /etc/default/klipper
|
2024-03-15 21:49:12 +03:00
|
|
|
|
2024-08-14 23:41:15 +03:00
|
|
|
# Mainsail
|
|
|
|
[ -e /home/pi/mainsail ] && {
|
|
|
|
su - pi -c "cd /home/pi/mainsail \
|
|
|
|
&& chmod 755 .git \
|
|
|
|
&& git pull \
|
|
|
|
"
|
|
|
|
:
|
|
|
|
} || {
|
|
|
|
su - pi -c "cd /home/pi \
|
|
|
|
&& git clone --depth=1 $GITEA_BASE/mainsail.git \
|
|
|
|
&& (cd mainsail && git config pull.rebase false) \
|
|
|
|
"
|
|
|
|
}
|
|
|
|
chmod 0 /home/pi/mainsail/.git
|
|
|
|
|
|
|
|
apt-get -y install nginx
|
2024-08-15 01:53:31 +03:00
|
|
|
|
2024-08-14 23:41:15 +03:00
|
|
|
rm -f /etc/nginx/conf.d/default.conf
|
|
|
|
rm -f /etc/nginx/sites-enabled/default
|
|
|
|
|
2024-08-15 00:31:28 +03:00
|
|
|
[ -e /etc/nginx/conf.d/mainsail.conf ] || \
|
2024-08-14 23:55:37 +03:00
|
|
|
install -m644 -o 0 -g 0 $ConfigsHome/etc/nginx/conf.d/mainsail.conf /etc/nginx/conf.d/mainsail.conf
|
2024-08-15 00:31:28 +03:00
|
|
|
[ -e /etc/nginx/sites-enabled/mainsail ] || \
|
2024-08-14 23:55:37 +03:00
|
|
|
install -m644 -o 0 -g 0 $ConfigsHome/etc/nginx/sites-enabled/mainsail /etc/nginx/sites-enabled/mainsail
|
|
|
|
|
2024-08-15 00:31:28 +03:00
|
|
|
install -m644 -o 0 -g 0 -C $ConfigsHome/etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg
|
2024-08-14 23:41:15 +03:00
|
|
|
|
2024-08-15 01:53:31 +03:00
|
|
|
# Moonraker
|
|
|
|
mkdir /home/pi/printer_data/config &>/dev/null || :
|
|
|
|
chown pi:pi /home/pi/printer_data/config &>/dev/null || :
|
|
|
|
|
|
|
|
[ -e /home/pi/printer_data/config/moonraker.conf ] || \
|
|
|
|
install -m644 -o pi -g pi $ConfigsHome/home/pi/printer_data/config/moonraker.conf /home/pi/printer_data/config/moonraker.conf
|
|
|
|
|
|
|
|
[ -e /home/pi/moonraker ] && {
|
|
|
|
su - pi -c "cd /home/pi/moonraker \
|
|
|
|
&& git pull \
|
|
|
|
"
|
|
|
|
:
|
|
|
|
} || {
|
|
|
|
su - pi -c "cd /home/pi \
|
|
|
|
&& git clone --depth=1 $GITEA_BASE/moonraker.git \
|
|
|
|
&& (cd moonraker && git config pull.rebase false) \
|
|
|
|
&& ./moonraker/scripts/install-moonraker.sh \
|
|
|
|
"
|
|
|
|
}
|
|
|
|
|
2024-08-14 23:41:15 +03:00
|
|
|
bash -c '
|
|
|
|
systemctl enable klipper
|
|
|
|
systemctl unmask nginx
|
|
|
|
systemctl enable nginx
|
|
|
|
systemctl enable octoprint
|
|
|
|
systemctl restart haproxy
|
|
|
|
systemctl restart nginx
|
|
|
|
systemctl restart klipper
|
2024-08-15 01:53:31 +03:00
|
|
|
systemctl restart moonraker
|
2024-08-14 23:41:15 +03:00
|
|
|
' 2>/dev/null &
|