update
This commit is contained in:
10
instance.sh
10
instance.sh
@@ -7,7 +7,7 @@ new_instance() {
|
||||
USB=''
|
||||
|
||||
#It is possible to not create an instance after preparing,so check if this is the first
|
||||
if [ -f /etc/octoprint_instances ]; then
|
||||
if [ -f /etc/octodocker_instances ]; then
|
||||
firstrun=false
|
||||
else
|
||||
firstrun=true
|
||||
@@ -85,7 +85,7 @@ new_instance() {
|
||||
|
||||
if prompt_confirm "Ready to begin instance creation?"; then
|
||||
PORT=5000
|
||||
PORTS_INUSE=$(join_by , $(cat /etc/octoprint_instances 2>/dev/null | sed -n -e 's/^.*\(port:\)\(.*\) udev:.*/\2/p'))
|
||||
PORTS_INUSE=$(join_by , $(cat /etc/octodocker_instances 2>/dev/null | sed -n -e 's/^.*\(port:\)\(.*\) udev:.*/\2/p'))
|
||||
until [[ "${PORTS_INUSE}" != *"${PORT}"* ]]; do ((PORT++)); done
|
||||
|
||||
echo Selected port is: $PORT
|
||||
@@ -153,9 +153,9 @@ new_instance() {
|
||||
|
||||
#Append instance name to list for removal tool
|
||||
if [ -z "$UDEV" ] && [ -z "$USB" ]; then
|
||||
echo "instance:$INSTANCE port:$PORT udev:false" >> /etc/octoprint_instances
|
||||
echo "instance:$INSTANCE port:$PORT udev:false" >> /etc/octodocker_instances
|
||||
else
|
||||
echo "instance:$INSTANCE port:$PORT udev:true" >> /etc/octoprint_instances
|
||||
echo "instance:$INSTANCE port:$PORT udev:true" >> /etc/octodocker_instances
|
||||
fi
|
||||
|
||||
if [ -n "$TEMPLATE" ]; then
|
||||
@@ -341,7 +341,7 @@ remove_instance() {
|
||||
#remove files
|
||||
rm -rf /opt/octoprint/s$opt
|
||||
#remove from octoprint_instances
|
||||
sed -i "/$opt/d" /etc/octoprint_instances
|
||||
sed -i "/$opt/d" /etc/octodocker_instances
|
||||
#remove haproxy entry
|
||||
if [ "$HAPROXY" == true ]; then
|
||||
sed -i "/use_backend $opt/d" /etc/haproxy/haproxy.cfg
|
||||
|
||||
4
menu.sh
4
menu.sh
@@ -9,7 +9,7 @@ yellow=$(echo -en "\e[93m")
|
||||
|
||||
main_menu() {
|
||||
|
||||
VERSION=0.2
|
||||
VERSION=0.3
|
||||
#reset
|
||||
UDEV=''
|
||||
TEMPUSB=''
|
||||
@@ -83,7 +83,7 @@ remove_instance_menu() {
|
||||
echo
|
||||
get_settings
|
||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
||||
if [ -f "/etc/octoprint_instances" ]; then
|
||||
if [ -f "/etc/octodocker_instances" ]; then
|
||||
|
||||
PS3="${green}Select instance number to remove: ${white}"
|
||||
get_instances true
|
||||
|
||||
18
util.sh
18
util.sh
@@ -88,8 +88,8 @@ back_up_all() {
|
||||
|
||||
get_instances() {
|
||||
addquit=$1
|
||||
if [ -f /etc/octoprint_instances ]; then
|
||||
readarray -t INSTANCE_ARR < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
if [ -f /etc/octodocker_instances ]; then
|
||||
readarray -t INSTANCE_ARR < <(cat /etc/octodocker_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
if [ "$addquit" == true ]; then
|
||||
INSTANCE_ARR+=("Quit")
|
||||
fi
|
||||
@@ -191,7 +191,7 @@ share_uploads() {
|
||||
add_udev() {
|
||||
#get instances that don't have a udev rule
|
||||
PS3="${green}Select instance to add udev rule: ${white}"
|
||||
readarray -t noudev < <(fgrep "udev:false" /etc/octoprint_instances 2> /dev/null | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
readarray -t noudev < <(fgrep "udev:false" /etc/octodocker_instances 2> /dev/null | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
noudev+=("Quit")
|
||||
select opt in "${noudev[@]}"
|
||||
do
|
||||
@@ -203,7 +203,7 @@ add_udev() {
|
||||
printer_udev false
|
||||
printer_udev true
|
||||
#this needs more thought
|
||||
sed -i "s/^\(instance:$INSTANCE port:.* udev:\)false/\1true/" /etc/octoprint_instances
|
||||
sed -i "s/^\(instance:$INSTANCE port:.* udev:\)false/\1true/" /etc/octodocker_instances
|
||||
break
|
||||
done
|
||||
udevadm control --reload-rules
|
||||
@@ -214,7 +214,7 @@ add_udev() {
|
||||
|
||||
remove_udev() {
|
||||
PS3="${green}Select udev rule to remove: ${white}"
|
||||
readarray -t udevs < <(fgrep "udev:true" /etc/octoprint_instances 2> /dev/null | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
readarray -t udevs < <(fgrep "udev:true" /etc/octodocker_instances 2> /dev/null | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
|
||||
udevs+=("Quit")
|
||||
select opt in "${udevs[@]}"
|
||||
do
|
||||
@@ -222,7 +222,7 @@ remove_udev() {
|
||||
main_menu
|
||||
fi
|
||||
sed -i "/$opt/d" /etc/udev/rules.d/99-octoprint.rules
|
||||
sed -i "s/^\(instance:$opt port:.* udev:\)true/\1false/" /etc/octoprint_instances
|
||||
sed -i "s/^\(instance:$opt port:.* udev:\)true/\1false/" /etc/octodocker_instances
|
||||
break
|
||||
done
|
||||
echo "${cyan}udev rule has been removed${white}"
|
||||
@@ -243,7 +243,7 @@ add_udev_camera() {
|
||||
INSTANCE=$opt
|
||||
detect_camera
|
||||
write_cam_udev
|
||||
sed -i "s/^\(camera:$opt port:.* udev:\)false/\1true/" /etc/octoprint_instances
|
||||
sed -i "s/^\(camera:$opt port:.* udev:\)false/\1true/" /etc/octodocker_instances
|
||||
break
|
||||
done
|
||||
udevadm control --reload-rules
|
||||
@@ -324,7 +324,7 @@ remove_everything() {
|
||||
echo "Removing system stuff"
|
||||
rm /etc/octoprint_streamer 2>/dev/null
|
||||
rm /etc/octodocker_deploy 2>/dev/null
|
||||
rm /etc/octoprint_instances 2>/dev/null
|
||||
rm /etc/octodocker_instances 2>/dev/null
|
||||
rm /etc/octoprint_cameras 2>/dev/null
|
||||
rm /etc/udev/rules.d/99-octoprint.rules 2>/dev/null
|
||||
rm -rf /opt/octoprint/ustreamer 2>/dev/null
|
||||
@@ -377,7 +377,7 @@ diagnostics() {
|
||||
logfile='octodocker_deploy_diagnostic.log'
|
||||
echo "octodocker_deploy diagnostic information. Please provide ALL output for support help"
|
||||
diagnostic_output /etc/octodocker_deploy | log
|
||||
diagnostic_output /etc/octoprint_instances | log
|
||||
diagnostic_output /etc/octodocker_instances | log
|
||||
diagnostic_output /etc/octoprint_cameras | log
|
||||
diagnostic_output /etc/udev/rules.d/99-octoprint.rules | log
|
||||
ls -la /dev/octo* | log
|
||||
|
||||
Reference in New Issue
Block a user