Add --headless option to easyinstall.sh, enable web auth by default on standalone web UI installs

This commit is contained in:
nucleogenic 2022-09-19 14:18:53 +01:00
parent dd40d7156a
commit 6ad436c085
No known key found for this signature in database
GPG Key ID: 04A5E4E319C4271D

View File

@ -691,23 +691,31 @@ function setupWiredNetworking() {
echo "WARNING: If you continue, the IP address of your Pi may change upon reboot." echo "WARNING: If you continue, the IP address of your Pi may change upon reboot."
echo "Please make sure you will not lose access to the Pi system." echo "Please make sure you will not lose access to the Pi system."
echo "" echo ""
echo "Do you want to proceed with network configuration using the default settings? [Y/n]"
read REPLY
if [ "$REPLY" == "N" ] || [ "$REPLY" == "n" ]; then if [[ -z $HEADLESS ]]; then
echo "Available wired interfaces on this system:" echo "Do you want to proceed with network configuration using the default settings? [Y/n]"
echo `ip -o addr show scope link | awk '{split($0, a); print $2}' | grep eth` read REPLY
echo "Please type the wired interface you want to use and press Enter:"
read SELECTED if [ "$REPLY" == "N" ] || [ "$REPLY" == "n" ]; then
LAN_INTERFACE=$SELECTED echo "Available wired interfaces on this system:"
echo `ip -o addr show scope link | awk '{split($0, a); print $2}' | grep eth`
echo "Please type the wired interface you want to use and press Enter:"
read SELECTED
LAN_INTERFACE=$SELECTED
fi
fi fi
if [ "$(grep -c "^denyinterfaces" /etc/dhcpcd.conf)" -ge 1 ]; then if [ "$(grep -c "^denyinterfaces" /etc/dhcpcd.conf)" -ge 1 ]; then
echo "WARNING: Network forwarding may already have been configured. Proceeding will overwrite the configuration." echo "WARNING: Network forwarding may already have been configured. Proceeding will overwrite the configuration."
echo "Press enter to continue or CTRL-C to exit"
read REPLY if [[ -z $HEADLESS ]]; then
echo "Press enter to continue or CTRL-C to exit"
read REPLY
fi
sudo sed -i /^denyinterfaces/d /etc/dhcpcd.conf sudo sed -i /^denyinterfaces/d /etc/dhcpcd.conf
fi fi
sudo bash -c 'echo "denyinterfaces '$LAN_INTERFACE'" >> /etc/dhcpcd.conf' sudo bash -c 'echo "denyinterfaces '$LAN_INTERFACE'" >> /etc/dhcpcd.conf'
echo "Modified /etc/dhcpcd.conf" echo "Modified /etc/dhcpcd.conf"
@ -720,6 +728,12 @@ function setupWiredNetworking() {
echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6):" echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6):"
echo "rasctl -i 6 -c attach -t scdp -f $LAN_INTERFACE" echo "rasctl -i 6 -c attach -t scdp -f $LAN_INTERFACE"
echo "" echo ""
if [[ $HEADLESS ]]; then
echo "Skipping reboot in headless mode"
return 0
fi
echo "We need to reboot your Pi" echo "We need to reboot your Pi"
echo "Press Enter to reboot or CTRL-C to exit" echo "Press Enter to reboot or CTRL-C to exit"
read read
@ -1269,6 +1283,7 @@ function runChoice() {
preparePythonCommon preparePythonCommon
cachePipPackages cachePipPackages
installRaScsiWebInterface installRaScsiWebInterface
enableWebInterfaceAuth
echo "Configuring RaSCSI Web Interface stand-alone - Complete!" echo "Configuring RaSCSI Web Interface stand-alone - Complete!"
echo "Launch the Web Interface with the 'start.sh' script. To use a custom port for the web server: 'start.sh --web-port=8081" echo "Launch the Web Interface with the 'start.sh' script. To use a custom port for the web server: 'start.sh --web-port=8081"
;; ;;
@ -1367,6 +1382,9 @@ while [ "$1" != "" ]; do
-s | --skip-token) -s | --skip-token)
SKIP_TOKEN=1 SKIP_TOKEN=1
;; ;;
-h | --headless)
HEADLESS=1
;;
*) *)
echo "ERROR: Unknown parameter \"$PARAM\"" echo "ERROR: Unknown parameter \"$PARAM\""
exit 1 exit 1