docker code conversions

This commit is contained in:
2024-07-27 18:16:59 -05:00
parent 5afb76db3f
commit 812266b26c
5 changed files with 43 additions and 287 deletions

View File

@@ -38,7 +38,7 @@ new_instance() {
done
if [ "$firstrun" != "true" ]; then
if test -f "/etc/systemd/system/$INSTANCE.service"; then
if [ -d "/opt/octoprint/$INSTANCE" ]; then
echo "Already have an entry for $INSTANCE. Exiting."
main_menu
fi
@@ -143,7 +143,8 @@ new_instance() {
cat $SCRIPTDIR/docker-compose.yml | \
sed -e "s/NEWINSTANCE/$INSTANCE/" \
-e "s/NEWPORT/$PORT/" > /opt/octoprint/docker-compose.yml
-e "s/CAMPORT/$CAMPORT/" > \
-e "s/NEWPORT/$PORT/" > $OCTOCONFIG/$INSTANCE/docker-compose.yml
#write phase
if [ -n "$UDEV" ] || [ -n "$USB" ]; then
@@ -173,6 +174,9 @@ new_instance() {
$BFOLD/* $OCTOCONFIG/$INSTANCE/octoprint/
fi
fi
#build docker
docker compose -f $OCTOCONFIG/$INSTANCE/docker-compose.yml up -d
#uniquify instances
echo 'Uniquifying instance...'
@@ -236,8 +240,8 @@ new_instance() {
systemctl daemon-reload
sleep 1
#Start and enable system processes
systemctl start $INSTANCE.service
#restart docker
docker restart $INSTANCE
systemctl enable $INSTANCE.service
if [[ -n $CAM || -n $USBCAM || -n $BYIDCAM ]]; then
systemctl start cam_$INSTANCE.service