fix prepare
This commit is contained in:
@@ -29,7 +29,7 @@ log () {
|
||||
|
||||
new_instance () {
|
||||
|
||||
echo "$(date) starting instance installation" >> $logfile
|
||||
echo "$(date) starting instance installation" | log
|
||||
|
||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
||||
SCRIPTDIR=$(dirname $(readlink -f $0))
|
||||
@@ -163,11 +163,9 @@ fi
|
||||
if [ -z "$UDEV" ]; then
|
||||
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
|
||||
#if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo
|
||||
USB=$TEMPUSB
|
||||
echo "Your printer will be setup at the following usb address:"
|
||||
echo $USB | log
|
||||
echo "Your printer will be setup at the following usb address: $USB" | log
|
||||
echo
|
||||
else
|
||||
echo "Serial number detected as: $UDEV" | log
|
||||
@@ -292,7 +290,7 @@ add_camera() {
|
||||
if [ -z "$INSTANCE" ]; then
|
||||
PS3='Select instance to add camera to: '
|
||||
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[@]}"
|
||||
do
|
||||
echo "Selected instance for camera: $opt" | log
|
||||
@@ -353,6 +351,7 @@ add_camera() {
|
||||
|
||||
remove_instance() {
|
||||
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
|
||||
PS3='Select instance to remove: '
|
||||
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
|
||||
@@ -362,9 +361,8 @@ do
|
||||
break
|
||||
done
|
||||
|
||||
read -p "Do you want to remove everything associated with this instance?" -n 1 -r
|
||||
echo #new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if prompt_confirm "Do you want to remove everything associated with this instance?"
|
||||
then
|
||||
#disable and remove service file
|
||||
if [ -f /etc/systemd/system/$opt.service ]; then
|
||||
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.'
|
||||
if prompt_confirm "Ready to begin?"
|
||||
then
|
||||
echo #new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo 'Adding instance records'
|
||||
if [ -f "/etc/octoprint_instances" ]; then
|
||||
echo "octoprint_instances already exists. Trying to run prepare a second time? Exiting" | log
|
||||
@@ -430,7 +426,6 @@ prepare () {
|
||||
echo 'Modifying config.yaml'
|
||||
cp -p $SCRIPTDIR/config.basic /home/pi/.octoprint/config.yaml
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# initiate logging
|
||||
@@ -442,6 +437,7 @@ select opt in "${options[@]}"
|
||||
do
|
||||
case $opt in
|
||||
"Prepare system (OctoPi)")
|
||||
prepare
|
||||
break
|
||||
;;
|
||||
"New instance")
|
||||
|
||||
@@ -6,7 +6,7 @@ Wants=network.online.target
|
||||
[Service]
|
||||
User=OCTOUSER
|
||||
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]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Reference in New Issue
Block a user