fix prepare
This commit is contained in:
@@ -29,7 +29,7 @@ log () {
|
|||||||
|
|
||||||
new_instance () {
|
new_instance () {
|
||||||
|
|
||||||
echo "$(date) starting instance installation" >> $logfile
|
echo "$(date) starting instance installation" | log
|
||||||
|
|
||||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
||||||
SCRIPTDIR=$(dirname $(readlink -f $0))
|
SCRIPTDIR=$(dirname $(readlink -f $0))
|
||||||
@@ -163,11 +163,9 @@ fi
|
|||||||
if [ -z "$UDEV" ]; then
|
if [ -z "$UDEV" ]; then
|
||||||
echo "Printer Serial Number not detected"
|
echo "Printer Serial Number not detected"
|
||||||
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" || exit 0
|
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" || exit 0
|
||||||
#if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
echo
|
echo
|
||||||
USB=$TEMPUSB
|
USB=$TEMPUSB
|
||||||
echo "Your printer will be setup at the following usb address:"
|
echo "Your printer will be setup at the following usb address: $USB" | log
|
||||||
echo $USB | log
|
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
echo "Serial number detected as: $UDEV" | log
|
echo "Serial number detected as: $UDEV" | log
|
||||||
@@ -292,7 +290,7 @@ add_camera() {
|
|||||||
if [ -z "$INSTANCE" ]; then
|
if [ -z "$INSTANCE" ]; then
|
||||||
PS3='Select instance to add camera to: '
|
PS3='Select instance to add camera to: '
|
||||||
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
|
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
|
||||||
|
#Not yet check to see if instance already has a camera
|
||||||
select opt in "${options[@]}"
|
select opt in "${options[@]}"
|
||||||
do
|
do
|
||||||
echo "Selected instance for camera: $opt" | log
|
echo "Selected instance for camera: $opt" | log
|
||||||
@@ -353,6 +351,7 @@ add_camera() {
|
|||||||
|
|
||||||
remove_instance() {
|
remove_instance() {
|
||||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
||||||
|
#Check to see that octoprint_instances exists before continuing
|
||||||
echo 'Do not remove the generic instance!' | log
|
echo 'Do not remove the generic instance!' | log
|
||||||
PS3='Select instance to remove: '
|
PS3='Select instance to remove: '
|
||||||
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
|
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
|
||||||
@@ -362,9 +361,8 @@ do
|
|||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
read -p "Do you want to remove everything associated with this instance?" -n 1 -r
|
if prompt_confirm "Do you want to remove everything associated with this instance?"
|
||||||
echo #new line
|
then
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
#disable and remove service file
|
#disable and remove service file
|
||||||
if [ -f /etc/systemd/system/$opt.service ]; then
|
if [ -f /etc/systemd/system/$opt.service ]; then
|
||||||
systemctl stop $opt.service
|
systemctl stop $opt.service
|
||||||
@@ -412,8 +410,6 @@ prepare () {
|
|||||||
echo 'Run this setup and then connect to octopi.local through your browser to setup your admin user.'
|
echo 'Run this setup and then connect to octopi.local through your browser to setup your admin user.'
|
||||||
if prompt_confirm "Ready to begin?"
|
if prompt_confirm "Ready to begin?"
|
||||||
then
|
then
|
||||||
echo #new line
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
echo 'Adding instance records'
|
echo 'Adding instance records'
|
||||||
if [ -f "/etc/octoprint_instances" ]; then
|
if [ -f "/etc/octoprint_instances" ]; then
|
||||||
echo "octoprint_instances already exists. Trying to run prepare a second time? Exiting" | log
|
echo "octoprint_instances already exists. Trying to run prepare a second time? Exiting" | log
|
||||||
@@ -430,7 +426,6 @@ prepare () {
|
|||||||
echo 'Modifying config.yaml'
|
echo 'Modifying config.yaml'
|
||||||
cp -p $SCRIPTDIR/config.basic /home/pi/.octoprint/config.yaml
|
cp -p $SCRIPTDIR/config.basic /home/pi/.octoprint/config.yaml
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# initiate logging
|
# initiate logging
|
||||||
@@ -442,6 +437,7 @@ select opt in "${options[@]}"
|
|||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
"Prepare system (OctoPi)")
|
"Prepare system (OctoPi)")
|
||||||
|
prepare
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
"New instance")
|
"New instance")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Wants=network.online.target
|
|||||||
[Service]
|
[Service]
|
||||||
User=OCTOUSER
|
User=OCTOUSER
|
||||||
Environment="LD_LIBRARY_PATH=/home/OCTOUSER/mjpg-streamer"
|
Environment="LD_LIBRARY_PATH=/home/OCTOUSER/mjpg-streamer"
|
||||||
ExecStart=/home/OCTOUSER/mjpg-streamer/mjpg_streamer -i "input_uvc.so -d /dev/OCTOCAM -f 5" -o "output_http.so -p CAMPORT"
|
ExecStart=/home/OCTOUSER/mjpg-streamer/mjpg_streamer -i "input_uvc.so -d /dev/OCTOCAM -r RESOLUTION -f FRAMERATE" -o "output_http.so -p CAMPORT"
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
Reference in New Issue
Block a user