fix port increment issue (#88)
This commit is contained in:
@@ -511,14 +511,13 @@ add_camera() {
|
|||||||
read CAMPORT
|
read CAMPORT
|
||||||
if [ -z "$CAMPORT" ]; then
|
if [ -z "$CAMPORT" ]; then
|
||||||
CAMPORT=$(tail -1 /etc/camera_ports)
|
CAMPORT=$(tail -1 /etc/camera_ports)
|
||||||
|
|
||||||
|
if [ -z "$CAMPORT" ]; then
|
||||||
|
CAMPORT=8000
|
||||||
|
fi
|
||||||
|
CAMPORT=$((CAMPORT+1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$CAMPORT" ]; then
|
|
||||||
CAMPORT=8000
|
|
||||||
fi
|
|
||||||
|
|
||||||
CAMPORT=$((CAMPORT+1))
|
|
||||||
|
|
||||||
if [ $CAMPORT -gt 7000 ]; then
|
if [ $CAMPORT -gt 7000 ]; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
@@ -816,7 +815,7 @@ prepare () {
|
|||||||
sudo -u $user /home/$user/OctoPrint/bin/pip install wheel
|
sudo -u $user /home/$user/OctoPrint/bin/pip install wheel
|
||||||
#install oprint
|
#install oprint
|
||||||
sudo -u $user /home/$user/OctoPrint/bin/pip install OctoPrint
|
sudo -u $user /home/$user/OctoPrint/bin/pip install OctoPrint
|
||||||
|
|
||||||
#NEW! Do check to verify that OctoPrint binary is installed
|
#NEW! Do check to verify that OctoPrint binary is installed
|
||||||
if [ -f "/home/$user/OctoPrint/bin/octoprint" ]; then
|
if [ -f "/home/$user/OctoPrint/bin/octoprint" ]; then
|
||||||
echo "OctoPrint apppears to have been installed successfully"
|
echo "OctoPrint apppears to have been installed successfully"
|
||||||
@@ -827,7 +826,7 @@ prepare () {
|
|||||||
remove_everything
|
remove_everything
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#start server and run in background
|
#start server and run in background
|
||||||
echo 'Creating generic OctoPrint template service...'
|
echo 'Creating generic OctoPrint template service...'
|
||||||
cat $SCRIPTDIR/octoprint_generic.service | \
|
cat $SCRIPTDIR/octoprint_generic.service | \
|
||||||
@@ -976,38 +975,38 @@ firstrun() {
|
|||||||
echo
|
echo
|
||||||
if prompt_confirm "Do you want to setup your admin user now?"; then
|
if prompt_confirm "Do you want to setup your admin user now?"; then
|
||||||
while true; do
|
while true; do
|
||||||
echo 'Enter admin user name (no spaces): '
|
echo 'Enter admin user name (no spaces): '
|
||||||
read OCTOADMIN
|
read OCTOADMIN
|
||||||
if [ -z "$OCTOADMIN" ]; then
|
if [ -z "$OCTOADMIN" ]; then
|
||||||
echo -e "No admin user given! Defaulting to: \033[0;31moctoadmin\033[0m"
|
echo -e "No admin user given! Defaulting to: \033[0;31moctoadmin\033[0m"
|
||||||
OCTOADMIN=octoadmin
|
OCTOADMIN=octoadmin
|
||||||
fi
|
fi
|
||||||
if ! has-space "$OCTOADMIN"; then
|
if ! has-space "$OCTOADMIN"; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "Admin user name must not have spaces."
|
echo "Admin user name must not have spaces."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "Admin user: $OCTOADMIN"
|
echo "Admin user: $OCTOADMIN"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
echo 'Enter admin user password (no spaces): '
|
echo 'Enter admin user password (no spaces): '
|
||||||
read OCTOPASS
|
read OCTOPASS
|
||||||
if [ -z "$OCTOPASS" ]; then
|
if [ -z "$OCTOPASS" ]; then
|
||||||
echo -e "No password given! Defaulting to: \033[0;31mfooselrulz\033[0m. Please CHANGE this."
|
echo -e "No password given! Defaulting to: \033[0;31mfooselrulz\033[0m. Please CHANGE this."
|
||||||
OCTOPASS=fooselrulz
|
OCTOPASS=fooselrulz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! has-space "$OCTOPASS"; then
|
if ! has-space "$OCTOPASS"; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "Admin password cannot contain spaces"
|
echo "Admin password cannot contain spaces"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
echo "Admin password: $OCTOPASS"
|
echo "Admin password: $OCTOPASS"
|
||||||
$OCTOEXEC user add $OCTOADMIN --password $OCTOPASS --admin | log
|
$OCTOEXEC user add $OCTOADMIN --password $OCTOPASS --admin | log
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if [ -n "$OCTOADMIN" ]; then
|
if [ -n "$OCTOADMIN" ]; then
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user