allow initial instance creation without udev (#96)
* better failure if first run is true * better conditional for tempusb * remove camera port selection * syntax error * bad break * add qualifier if udev not set
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
|
||||
Updated June 24, 2023.
|
||||
Updated June 30, 2023.
|
||||
|
||||
Want to support this work? Buy Me a Coffee. https://www.buymeacoffee.com/ppaukstelis.
|
||||
Need help with octoprint_deploy? Ask on Discord: https://discord.gg/6vgSjgvR6u
|
||||
# octoprint_deploy 1.0.1 - ALL NEW
|
||||
# octoprint_deploy 1.0.2 - ALL NEW
|
||||
* These files provide a bash script for quickly deploying multiple octoprint instances on a single computer. For Linux systems (Ubuntu, Fedora, etc.) it will also install OctoPrint and a video streamer (ustreamer). No need for lots of file editing or complicated Docker compose scripts! A background video on how it generally works from my ERRF2022 talk can be found here: https://www.youtube.com/watch?v=q0iCNl8-kJI&t=15378s
|
||||
* octoprint_deploy and octoprint_install are being merged! Maintaining two separate scripts was close to twice the amount of work. By merging the scripts many new features have been included, while also providing greater simplicity in setup. For now, the merged script will be called octoprint_deploy and at some point the octoprint_install repository will point here.
|
||||
* The biggest change is that there is no longer the notion of a single 'template' OctoPrint instance. Now, _any_ previously configured instance can be used as a template when a new instance is created. The choice is up to the user.
|
||||
@@ -48,6 +48,7 @@ Need help with octoprint_deploy? Ask on Discord: https://discord.gg/6vgSjgvR6u
|
||||
* Backup and restore files for an instance from the menu, or backup all instances with `sudo octoprint_deploy/octoprint_deploy backup`
|
||||
* Restart all instances from the command line: `sudo octoprint_deploy/octoprint_deploy.sh restart_all`
|
||||
# Recent Changes
|
||||
* Allow first instance creation without udev rule
|
||||
* Fixed dialout permissions.
|
||||
* Lots of changes, now octoprint_deploy 1.0.0
|
||||
* Udev utility menu
|
||||
|
||||
27
cameras.sh
27
cameras.sh
@@ -76,7 +76,7 @@ write_camera() {
|
||||
|
||||
mv $SCRIPTDIR/cam${INUM}_$INSTANCE.service /etc/systemd/system/
|
||||
echo "camera:cam${INUM}_$INSTANCE port:$CAMPORT udev:true" >> /etc/octoprint_cameras
|
||||
|
||||
|
||||
#config.yaml modifications - only if INUM not set
|
||||
if [ -z "$INUM" ]; then
|
||||
sudo -u $user $OCTOEXEC --basedir $BASE config set plugins.classicwebcam.snapshot "http://localhost:$CAMPORT?action=snapshot"
|
||||
@@ -86,7 +86,7 @@ write_camera() {
|
||||
else
|
||||
sudo -u $user $OCTOEXEC --basedir $BASE config set plugins.classicwebcam.stream "/cam_$INSTANCE/?action=stream"
|
||||
fi
|
||||
|
||||
|
||||
sudo -u $user $OCTOEXEC --basedir $BASE config append_value --json system.actions "{\"action\": \"Reset video streamer\", \"command\": \"sudo systemctl restart cam_$INSTANCE\", \"name\": \"Restart webcam\"}"
|
||||
|
||||
if prompt_confirm "Instance must be restarted for settings to take effect. Restart now?"; then
|
||||
@@ -220,24 +220,11 @@ add_camera() {
|
||||
echo
|
||||
fi
|
||||
|
||||
while true; do
|
||||
echo "Camera Port (ENTER will increment last value found in /etc/octoprint_cameras):"
|
||||
read CAMPORT
|
||||
if [ -z "$CAMPORT" ]; then
|
||||
CAMPORT=$(tail -1 /etc/octoprint_cameras | sed -n -e 's/^.*\(port:\)\(.*\)/\2/p')
|
||||
|
||||
if [ -z "$CAMPORT" ]; then
|
||||
CAMPORT=8000
|
||||
fi
|
||||
CAMPORT=$((CAMPORT+1))
|
||||
fi
|
||||
|
||||
if [ $CAMPORT -gt 7000 ]; then
|
||||
break
|
||||
else
|
||||
echo "Camera Port must be greater than 7000"
|
||||
fi
|
||||
done
|
||||
CAMPORT=$(tail -1 /etc/octoprint_cameras 2>/dev/null | sed -n -e 's/^.*\(port:\)\(.*\)/\2/p')
|
||||
if [ -z "$CAMPORT" ]; then
|
||||
CAMPORT=8000
|
||||
fi
|
||||
CAMPORT=$((CAMPORT+1))
|
||||
|
||||
echo "Settings can be modified after initial setup in /etc/systemd/system/cam${INUM}_$INSTANCE.service"
|
||||
echo
|
||||
|
||||
18
instance.sh
18
instance.sh
@@ -144,16 +144,20 @@ new_instance() {
|
||||
printer_udev true
|
||||
|
||||
#Append instance name to list for removal tool
|
||||
echo "instance:$INSTANCE port:$PORT udev:true" >> /etc/octoprint_instances
|
||||
if [ -z "$UDEV" ] && [ -z "$TEMPUSB" ]; then
|
||||
echo "instance:$INSTANCE port:$PORT udev:false" >> /etc/octoprint_instances
|
||||
else
|
||||
echo "instance:$INSTANCE port:$PORT udev:true" >> /etc/octoprint_instances
|
||||
fi
|
||||
|
||||
if [ -n "$TEMPLATE" ]; then
|
||||
#There may be other combinations of things to include/exclude
|
||||
#There may be other combinations of things to include/exclude
|
||||
if [ $COPY -eq 1 ]; then
|
||||
sudo -u $user rsync -r \
|
||||
--exclude 'timelapse' \
|
||||
--exclude 'uploads' \
|
||||
--exclude 'logs' \
|
||||
$BFOLD/* $OCTOCONFIG/.$INSTANCE/
|
||||
$BFOLD/* $OCTOCONFIG/.$INSTANCE/
|
||||
fi
|
||||
if [ $COPY -eq 2 ]; then
|
||||
sudo -u $user rsync -r \
|
||||
@@ -279,7 +283,7 @@ printer_udev() {
|
||||
fi
|
||||
else
|
||||
#No serial number
|
||||
if [ -z "$UDEV" ]; then
|
||||
if [ -z "$UDEV" ] && [ -n "$TEMPUSB" ]; then
|
||||
echo "Printer Serial Number not detected"
|
||||
if prompt_confirm "Do you want to use the physical USB port to assign the udev entry? If you use this any USB hubs and printers detected this way must stay plugged into the same USB positions on your machine as they are right now"; then
|
||||
echo
|
||||
@@ -301,7 +305,11 @@ printer_udev() {
|
||||
echo "Check your USB cable (power only?) and try again."
|
||||
echo
|
||||
echo
|
||||
main_menu
|
||||
if [ $firstrun == "true" ]; then
|
||||
echo "You can attempt adding a udev rule later from the Utilities menu."
|
||||
else
|
||||
main_menu
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
11
menu.sh
11
menu.sh
@@ -2,6 +2,7 @@
|
||||
source $SCRIPTDIR/prepare.sh
|
||||
white=$(echo -en "\e[39m")
|
||||
green=$(echo -en "\e[92m")
|
||||
red=$(echo -en "\e[91m")
|
||||
magenta=$(echo -en "\e[35m")
|
||||
cyan=$(echo -en "\e[96m")
|
||||
yellow=$(echo -en "\e[93m")
|
||||
@@ -100,10 +101,9 @@ remove_instance_menu() {
|
||||
remove_camera_menu() {
|
||||
get_settings
|
||||
PS3="${green}Select camera number to remove: ${white}"
|
||||
readarray -t cameras < <(cat /etc/octoprint_cameras | sed -n -e 's/^camera:\([[:graph:]]*\) .*/\1/p')
|
||||
cameras+=("Quit")
|
||||
get_cameras true
|
||||
|
||||
select camera in "${cameras[@]}"
|
||||
select camera in "${CAMERA_ARR[@]}"
|
||||
do
|
||||
if [ "$camera" == Quit ]; then
|
||||
main_menu
|
||||
@@ -225,9 +225,8 @@ create_menu() {
|
||||
echo
|
||||
echo
|
||||
PS3="${green}Select instance number to backup: ${white}"
|
||||
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
options+=("Quit")
|
||||
select opt in "${options[@]}"
|
||||
get_instances true
|
||||
select opt in "${INSTANCE_ARR[@]}"
|
||||
do
|
||||
if [ "$opt" == Quit ]; then
|
||||
main_menu
|
||||
|
||||
6
util.sh
6
util.sh
@@ -304,13 +304,13 @@ remove_everything() {
|
||||
get_settings
|
||||
if prompt_confirm "Remove everything?"; then
|
||||
get_instances false
|
||||
unset 'instances[0]'
|
||||
readarray -t cameras < <(ls -1 /etc/systemd/system/cam*.service 2>/dev/null | sed -n -e 's/^.*\/\(.*\).service/\1/p')
|
||||
get_cameras false
|
||||
|
||||
for instance in "${INSTANCE_ARR[@]}"; do
|
||||
remove_instance $instance
|
||||
done
|
||||
|
||||
for camera in "${cameras[@]}"; do
|
||||
for camera in "${CAMERA_ARR[@]}"; do
|
||||
remove_camera $camera
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user