RASCSI/easyinstall.sh
Daniel Markstedt 8a3642bf9a
Move to protobuf for the webapp, major overhaul to easyinstall.sh, code comment translations (#229)
* Making saving and loading config files work with protobuf

* Formatted the Status column, and fixed the available ID logic

* Updated handling of removed status for devices without image file support

* Comment update

* Fixed typo

* Updated logging

* Updated handling of removed status for devices without image file support

* Comment update

* Fixed typo

* Updated logging

* Better handling of device status

* Updated parameter handling

* Updated setting default interfaces

* Revert "Updated setting default interfaces"

This reverts commit 210abc775d.

* Revert "Updated parameter handling"

This reverts commit 35302addd5.

* Abort with a 404 if rascsi is not running. Use any protobuf response to determine whether rascsi is running (should hardly be required anymore due to the other change, but just in case).

* Move id reservation back into __main__

* Remove check for device type when validating Removed image

* Leverage device property data for better status messages

* Remove redundant string sanitation when reading config csv file

* Clean up device list generation

* Cleanup

* Remove duplicates before building valid scsi id list

* Fully translated cfilesystem.h code comments to English; partially translated cfilesystem.cpp

* rascsi supports reserving IDs

* Updated help message

* Replaced BOOL by bool

* Logging update

* Logging update

* Cleanup

* Restructure the easyinstall.sh script to combine the install/update flows, and disallow installing the webapp by itself

* Remove redundant steps handled in Makefile

* Add the functionality to specify connect_type through a parameter

* Add validation to the argument parser allowing only STANDARD and FULLSPEC as options

* Complete translation of code comments for cfilesystem.h; partial translation for cfilesystem.cpp

* Cleanup

* Merge parts of the Network Assistant script by sonique6784; fix the run_choice startup parameter

* Improve on the network setup messages

* Fix routing address

* Add checks for previous configuration; cleanup

* Cleanup

* Remove redundant step in wired setup. Improve messages.

* Cleanup

* Added default parameters to device properties

* Return parameters a device was set up with

* Add flows for configuring custom network settings; adopting some logic by –sonique6784

* Improved device initialization

* Updated default parameter handling

* Updated default parameter handling

* Fixed typo

* Comment updates

* Comment update

* Make iso generation work again, and add error handling to urllib actions

* Manage default parameters in the respective device

* Print available network interfaces. Clean up step and improve descriptive messages.

* Make the script clean up previous configurations

* Make the script only show relevant interfaces

* Partial translation of cfilesystem.cpp

* Do not pass empty parameter string

* Added supports_params flag

* Completely translate code comments in cfilesystem.cpp

* Show rascsi-web status after installing

* Refactoring

* Made comparisons more consistent

* Updated error handling

* Updated exception handling

* Made comparisons more consistent

* Updated error handling

* Overlooked code comment translation

* Renaming

* Better error handling for socket connection

* Disable two NEC hd image types due to issue#232

* Comment update

* NEC sectors size must be 512 bytes

* Updated logging

* Updated vendor name handling

* Updated handling of media loading/unloading

* Comment update

* NEC sectors size must be 512 bytes

* Updated logging

* Updated vendor name handling

* Updated handling of media loading/unloading

* Better handling of removable disks in the web ui

* Added stoppable property and stopped status

* Made MO stoppable

* Removed duplicate code

* Removed duplicate code

* Copy read-only property

* Renaming

* Add an assistant for reserving scsi ids

* Don't show action if no device attached

* Implement a device_info app path, and cut down on device columns always shown

* Cleanup

* Removed duplicate code, added START/STOP

* Improved default parameter handling

* Updated load/eject handling

* Logging update

* Fixed typo

* Verified START/STOP UNIT

* Updated logging

* Updated status handling

* Updated status handling

* More status handling updates

* Logging update

* Made instance fields local variables

* Removed duplicate code, added START/STOP

* Improved default parameter handling

* Updated load/eject handling

* Logging update

* Fixed typo

* Verified START/STOP UNIT

* Updated logging

* Updated status handling

* Updated status handling

* More status handling updates

* Logging update

* Made instance fields local variables

* Made disk_t private

* Made some data structures private

* Fixed ARM compile issue

* Fast forward instead of rebase existing git repo

* Fixed ctapdriver initialization issue

* Reset read-only status when opening an image file

* Cleanup

* Cleanup

* Made logging more consistent

* Updated log level

* Cleanup

* Log load/eject on error level for testing

* Revert "Log load/eject on error level for testing"

This reverts commit d35a15ea8e.

* Assume drive is not ready after having been stopped

* Updated status handling

* Make the csv config files store all relevant device data for reading

* Read 9 column csv config files

* Fixed typo

* Rebuild manpage

* Fixed issue #234 (MODE SENSE (10) returns wrong mode parameter header)

* Removed unused code

* Enum data type update

* Removed duplicate range check

* Removed duplicate code

* Removed more duplicate code

* Logging update

* SCCD sector size was not meant to be configurable

* Better error handling for csv reading and writing

* Updated configurable sector size properties

* Removed assertion

* Improved error handling

* Updated error handling

* Re-added special error handling only relevant for SASI

* Added TODOs

* Comment update

* Added override modifier

* Removed obsolete debug flag (related code was not called)

* Comment and logging updates

* Removed obsolete try/catch

* Revert "Removed obsolete try/catch"

This reverts commit 39ca12d8b1.

* Comment update

* Removed duplicate code

* Updated error messages, use more foreach loops

* Avoid storing RaSCSI generated product info in config file

* Updated logging

* Logging update

* Save config files in json instead of csv

* Fix bugs with json config loading

* Refactoring & remove unused code

* Refactoring

* Display upper case file endings in file management list

* Only show product vendor for non-RaSCSI devices in the device list

* Translate code comment

* Refactoring

* Fix bad identation

* Improve valid file extension handling

* Add validation when attaching removable media

* Display valid file endings under the file list

* Cleanup

* Don't store 0 block size

* Fix indentation

* Read and write config files in key:pair format

* Add section for controlling logging

* README update

* Added block_count

* Cleanup, fix typos

* Support attaching CD-ROM with custom block size

* Evaluate block size when inserting a media

* rasctl display capacity if available

* Info message update

* Use kwargs for device attachment

* Fix bugs in attach_image kwargs; make config file more readable

* POC for attaching device with profile

* Only list product types valid for the particular image file

* Perform validation of HDD image size based on the product profile

* Implement sidecar config files for drive images.

* Added missing product name to NEC vital product data

* MO block size depends on capacity only

* Better error handling for device sidecar config loading

* Extended property/status display

* Property display update

* Updated error handling

* Handle image sizes in bytes internally

* Revert change

* Resolve bad merge

Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
2021-09-14 21:51:12 -05:00

553 lines
18 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# BSD 3-Clause License
# Author @sonique6784
# Copyright (c) 2020, sonique6784
function showRaSCSILogo(){
logo="""
    .~~.   .~~.\n
  '. \ ' ' / .'\n
   .╔═══════╗.\n
  : ║|¯¯¯¯¯|║ :\n
 ~ (║|_____|║) ~\n
( : ║ .  __ ║ : )\n
 ~ .╚╦═════╦╝. ~\n
  (  ¯¯¯¯¯¯¯  ) RaSCSI Assistant\n
   '~ .~~~. ~'\n
       '~'\n
"""
echo -e $logo
}
function showMacNetworkWired(){
logo="""
                              .-~-.-~~~-.~-.\n
 ╔═══════╗                  .(              )\n
 ║|¯¯¯¯¯|║                 /               \`.\n
 ║|_____|║>--------------<~               .   )\n
 ║ .  __ ║                 (              :'-'\n
 ╚╦═════╦╝                  ~-.________.:'\n
  ¯¯¯¯¯¯¯\n
"""
echo -e $logo
}
function showMacNetworkWireless(){
logo="""
                              .-~-.-~~~-.~-.\n
 ╔═══════╗        .(       .(              )\n
 ║|¯¯¯¯¯|║  .(  .(        /               \`.\n
 ║|_____|║ .o    o       ~               .   )\n
 ║ .  __ ║  '(  '(        (              :'-'\n
 ╚╦═════╦╝        '(       ~-.________.:'\n
  ¯¯¯¯¯¯¯\n
"""
echo -e $logo
}
VIRTUAL_DRIVER_PATH=/home/pi/images
HFS_FORMAT=/usr/bin/hformat
HFDISK_BIN=/usr/bin/hfdisk
LIDO_DRIVER=~/RASCSI/lido-driver.img
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_REMOTE=${GIT_REMOTE:-origin}
function initialChecks() {
currentUser=$(whoami)
if [ "pi" != "$currentUser" ]; then
echo "You must use 'pi' user (current: $currentUser)"
exit 1
fi
if [ ! -d ~/RASCSI ]; then
echo "You must checkout RASCSI repo into /home/pi/RASCSI"
echo "$ git clone git@github.com:akuker/RASCSI.git"
exit 2
fi
}
# install all dependency packages for RaSCSI Service
function installPackages() {
sudo apt-get update && sudo apt install git libspdlog-dev libpcap-dev genisoimage python3 python3-venv nginx libpcap-dev protobuf-compiler bridge-utils python3-dev libev-dev libevdev2 -y
}
# compile and install RaSCSI Service
function installRaScsi() {
sudo systemctl stop rascsi
cd ~/RASCSI/src/raspberrypi
make clean
make all CONNECT_TYPE=${CONNECT_TYPE-FULLSPEC}
sudo make install CONNECT_TYPE=${CONNECT_TYPE-FULLSPEC}
sudoIsReady=$(sudo grep -c "rascsi" /etc/sudoers)
if [ $sudoIsReady = "0" ]; then
sudo bash -c 'echo "
# Allow the web server to restart the rascsi service
www-data ALL=NOPASSWD: /bin/systemctl restart rascsi.service
www-data ALL=NOPASSWD: /bin/systemctl stop rascsi.service
# Allow the web server to reboot the raspberry pi
www-data ALL=NOPASSWD: /sbin/shutdown, /sbin/reboot
" >> /etc/sudoers'
fi
sudo systemctl restart rsyslog
sudo systemctl enable rascsi # optional - start rascsi at boot
sudo systemctl start rascsi
}
# install everything required to run an HTTP server (Nginx + Python Flask App)
function installRaScsiWebInterface() {
echo "Compiling the Python protobuf library..."
[ -f ~/RASCSI/src/web/rascsi_interface.proto ] && rm ~/RASCSI/src/web/rascsi_interface.proto
protoc -I=/home/pi/RASCSI/src/raspberrypi/ --python_out=/home/pi/RASCSI/src/web/ rascsi_interface.proto
sudo cp -f ~/RASCSI/src/web/service-infra/nginx-default.conf /etc/nginx/sites-available/default
sudo cp -f ~/RASCSI/src/web/service-infra/502.html /var/www/html/502.html
sudo usermod -a -G pi www-data
sudo systemctl reload nginx
echo "Installing the rascsi-web.service configuration..."
sudo cp ~/RASCSI/src/web/service-infra/rascsi-web.service /etc/systemd/system/rascsi-web.service
sudo systemctl daemon-reload
sudo systemctl enable rascsi-web
sudo systemctl start rascsi-web
}
function createImagesDir() {
if [ -d $VIRTUAL_DRIVER_PATH ]; then
echo "The $VIRTUAL_DRIVER_PATH directory already exists."
else
echo "The $VIRTUAL_DRIVER_PATH directory does not exist; creating..."
mkdir -p $VIRTUAL_DRIVER_PATH
chmod -R 775 $VIRTUAL_DRIVER_PATH
fi
}
function stopOldWebInterface() {
sudo systemctl stop rascsi-web
APACHE_STATUS=$(sudo systemctl status apache2 &> /dev/null; echo $?)
if [ "$APACHE_STATUS" -eq 0 ] ; then
echo "Stopping old Apache2 RaSCSI Web..."
sudo systemctl disable apache2
sudo systemctl stop apache2
fi
}
function updateRaScsiGit() {
echo "Updating checked out branch $GIT_REMOTE/$GIT_BRANCH"
cd ~/RASCSI
stashed=0
if [[ $(git diff --stat) != '' ]]; then
echo 'There are local changes, we will stash and reapply them.'
git stash
stashed=1
fi
git pull --ff-only
if [ $stashed -eq 1 ]; then
echo "Reapplying local changes..."
git stash apply
fi
}
function showRaScsiStatus() {
sudo systemctl status rascsi | tee
}
function showRaScsiWebStatus() {
sudo systemctl status rascsi-web | tee
}
function createDrive600MB() {
createDrive 600 "HD600"
}
function createDriveCustom() {
driveSize=-1
until [ $driveSize -ge "10" ] && [ $driveSize -le "4000" ]; do
echo "What drive size would you like (in MB) (10-4000)"
read driveSize
echo "How would you like to name that drive?"
read driveName
done
createDrive "$driveSize" "$driveName"
}
function formatDrive() {
diskPath="$1"
volumeName="$2"
if [ ! -x $HFS_FORMAT ]; then
# Install hfsutils to have hformat to format HFS
sudo apt-get install hfsutils
fi
if [ ! -x $HFDISK_BIN ]; then
# Clone, compile and install 'hfdisk', partition tool
git clone git://www.codesrc.com/git/hfdisk.git
cd hfdisk
make
sudo cp hfdisk /usr/bin/hfdisk
fi
# Inject hfdisk commands to create Drive with correct partitions
# https://www.codesrc.com/mediawiki/index.php/HFSFromScratch
# i initialize partition map
# continue with default first block
# C Create 1st partition with type specified next)
# continue with default
# 32 32 blocks (required for HFS+)
# Driver_Partition Partition Name
# Apple_Driver Partition Type (available types: Apple_Driver, Apple_Driver43, Apple_Free, Apple_HFS...)
# C Create 2nd partition with type specified next
# continue with default first block
# continue with default block size (rest of the disk)
# ${volumeName} Partition name provided by user
# Apple_HFS Partition Type
# w Write partition map to disk
# y Confirm partition table
# p Print partition map
(echo i; echo ; echo C; echo ; echo 32; echo "Driver_Partition"; echo "Apple_Driver"; echo C; echo ; echo ; echo "${volumeName}"; echo "Apple_HFS"; echo w; echo y; echo p;) | $HFDISK_BIN "$diskPath"
partitionOk=$?
if [ $partitionOk -eq 0 ]; then
if [ ! -f $LIDO_DRIVER ];then
echo "Lido driver couldn't be found. Make sure RaSCSI is up-to-date with git pull"
return 1
fi
# Burn Lido driver to the disk
dd if=$LIDO_DRIVER of="$diskPath" seek=64 count=32 bs=512 conv=notrunc
driverInstalled=$?
if [ $driverInstalled -eq 0 ]; then
# Format the partition with HFS file system
$HFS_FORMAT -l "${volumeName}" "$diskPath" 1
hfsFormattedOk=$?
if [ $hfsFormattedOk -eq 0 ]; then
echo "Disk created with success."
else
echo "Unable to format HFS partition."
return 4
fi
else
echo "Unable to install Lido Driver."
return 3
fi
else
echo "Unable to create the partition."
return 2
fi
}
function createDrive() {
if [ $# -ne 2 ]; then
echo "To create a Drive, volume size and volume name must be provided"
echo "$ createDrive 600 \"RaSCSI Drive\""
echo "Drive wasn't created."
return
fi
driveSize=$1
driveName=$2
mkdir -p $VIRTUAL_DRIVER_PATH
drivePath="${VIRTUAL_DRIVER_PATH}/${driveSize}MB.hda"
if [ ! -f $drivePath ]; then
echo "Creating a ${driveSize}MB Drive"
truncate --size ${driveSize}m $drivePath
echo "Formatting drive with HFS"
formatDrive "$drivePath" "$driveName"
else
echo "Error: drive already exists"
fi
}
function setupWiredNetworking() {
echo "Setting up wired network..."
LAN_INTERFACE=eth0
echo "$LAN_INTERFACE will be configured for network forwarding with DHCP."
echo ""
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 ""
echo "Do you want to proceed with network configuration using the default settings? Y/n"
read REPLY
if [ "$REPLY" == "N" ] || [ "$REPLY" == "n" ]; then
echo "Available wired interfaces on this system:"
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 -r SELECTED
LAN_INTERFACE=$SELECTED
fi
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 "Press enter to continue or CTRL-C to exit"
read REPLY
sudo sed -i /^denyinterfaces/d /etc/dhcpcd.conf
fi
sudo echo "denyinterfaces $LAN_INTERFACE" >> /etc/dhcpcd.conf
echo "Modified /etc/dhcpcd.conf"
# default config file is made for eth0, this will set the right net interface
sudo bash -c 'sed s/eth0/'"$LAN_INTERFACE"'/g /home/pi/RASCSI/src/raspberrypi/os_integration/rascsi_bridge > /etc/network/interfaces.d/rascsi_bridge'
echo "Modified /etc/network/interfaces.d/rascsi_bridge"
echo "Configuration completed!"
echo "Please make sure you attach ia DaynaPORT network adapter to the RaSCSI configuration."
echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6): \"rascsi -ID 6 -t scdp $LAN_INTERFACE\""
echo ""
echo "We need to reboot your Pi"
echo "Press Enter to reboot or CTRL-C to exit"
read
echo "Rebooting..."
sleep 3
sudo reboot
}
function setupWirelessNetworking() {
NETWORK="10.10.20"
IP=$NETWORK.2 # Macintosh or Device IP
NETWORK_MASK="255.255.255.0"
CIDR="24"
ROUTER_IP=$NETWORK.1
ROUTING_ADDRESS=$NETWORK.0/$CIDR
WLAN_INTERFACE="wlan0"
echo "$WLAN_INTERFACE will be configured for network forwarding with static IP assignment."
echo "Configure your Macintosh or other device with the following:"
echo "IP Address (static): $IP"
echo "Router Address: $ROUTER_IP"
echo "Subnet Mask: $NETWORK_MASK"
echo "DNS Server: Any public DNS server"
echo ""
echo "Do you want to proceed with network configuration using the default settings? Y/n"
read REPLY
if [ "$REPLY" == "N" ] || [ "$REPLY" == "n" ]; then
echo "Available wireless interfaces on this system:"
ip -o addr show scope link | awk '{split($0, a); print $2}' | grep wlan
echo "Please type the wireless interface you want to use and press Enter:"
read -r WLAN_INTERFACE
echo "Base IP address (ex. 10.10.20):"
read -r NETWORK
echo "CIDR for Subnet Mask (ex. '24' for 255.255.255.0):"
read -r CIDR
ROUTER_IP=$NETWORK.1
ROUTING_ADDRESS=$NETWORK.0/$CIDR
fi
if [ $(grep -c "^net.ipv4.ip_forward=1" /etc/sysctl.conf) -ge 1 ]; then
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
else
sudo bash -c 'echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf'
echo "Modified /etc/sysctl.conf"
fi
sudo iptables --flush
sudo iptables -t nat -F
sudo iptables -X
sudo iptables -Z
sudo iptables -P INPUT ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -t nat -A POSTROUTING -o $WLAN_INTERFACE -s $ROUTING_ADDRESS -j MASQUERADE
# Check if iptables-persistent is installed
IPTABLES_PERSISTENT=$(dpkg -s iptables-persistent | grep Status | grep -c "install ok")
if [ $IPTABLES_PERSISTENT -eq 0 ]; then
sudo apt-get install iptables-persistent --assume-yes
else
sudo iptables-save --file /etc/iptables/rules.v4
fi
echo "Modified /etc/iptables/rules.v4"
echo "Configuration completed!"
echo ""
echo "Please make sure you attach a DaynaPORT network adapter to the RaSCSI configuration"
echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6): \"rascsi -ID 6 -t scdp $WLAN_INTERFACE:$ROUTER_IP/$CIDR\""
echo ""
echo "We need to reboot your Pi"
echo "Press Enter to reboot or CTRL-C to exit"
read REPLY
echo "Rebooting..."
sleep 3
sudo reboot
}
function reserveScsiIds() {
if [ ! -f /etc/systemd/system/rascsi-web.service ]; then
echo "This feature depends on the RaSCSI Web UI being installed. Please install RaSCSI Web before continuing."
exit
fi
sudo systemctl stop rascsi-web
echo "Please type the SCSI ID(s) that you want to reserve and press Enter:"
echo "The input should be a string of digits without separators, e.g. \"017\" for IDs 0, 1, and 7."
read -r RESERVED_IDS
sudo sed -i /^ExecStart=/d /etc/systemd/system/rascsi-web.service
sudo sed -i "8 i ExecStart=/home/pi/RASCSI/src/web/start.sh --reserved_ids=$RESERVED_IDS" /etc/systemd/system/rascsi-web.service
sudo systemctl daemon-reload
sudo systemctl start rascsi-web
}
function runChoice() {
case $1 in
0)
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface + 600MB Drive"
stopOldWebInterface
updateRaScsiGit
createImagesDir
installPackages
installRaScsi
installRaScsiWebInterface
createDrive600MB
showRaScsiStatus
showRaScsiWebStatus
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface + 600MB Drive - Complete!"
;;
1)
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface"
stopOldWebInterface
updateRaScsiGit
createImagesDir
installPackages
installRaScsi
installRaScsiWebInterface
showRaScsiStatus
showRaScsiWebStatus
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface - Complete!"
;;
2)
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC})"
updateRaScsiGit
createImagesDir
installPackages
installRaScsi
showRaScsiStatus
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) - Complete!"
;;
3)
echo "Creating a 600MB drive"
createDrive600MB
echo "Creating a 600MB drive - Complete!"
;;
4)
echo "Creating a custom drive"
createDriveCustom
echo "Creating a custom drive - Complete!"
;;
5)
echo "Configuring wired network bridge"
showMacNetworkWired
setupWiredNetworking
echo "Configuring wired network bridge - Complete!"
;;
6)
echo "Configuring wifi network bridge"
showMacNetworkWireless
setupWirelessNetworking
echo "Configuring wifi network bridge - Complete!"
;;
7)
echo "Reserving SCSI IDs"
reserveScsiIds
showRaScsiWebStatus
echo "Reserving SCSI IDs - Complete!"
;;
-h|--help|h|help)
showMenu
;;
*)
echo "${1} is not a valid option, exiting..."
exit 1
esac
}
function readChoice() {
choice=-1
until [ $choice -ge "0" ] && [ $choice -le "7" ]; do
echo -n "Enter your choice (0-7) or CTRL-C to exit: "
read -r choice
done
runChoice "$choice"
}
function showMenu() {
echo ""
echo "Choose among the following options:"
echo "INSTALL/UPDATE RASCSI (${CONNECT_TYPE-FULLSPEC} version)"
echo " 0) install or update RaSCSI Service + web interface + 600MB Drive (recommended)"
echo " 1) install or update RaSCSI Service + web interface"
echo " 2) install or update RaSCSI Service"
echo "CREATE EMPTY DRIVE IMAGE"
echo " 3) 600MB drive (recommended)"
echo " 4) custom drive size (up to 4000MB)"
echo "NETWORK ASSISTANT"
echo " 5) configure network forwarding over Ethernet (DHCP)"
echo " 6) configure network forwarding over WiFi (static IP)"
echo "MISCELLANEOUS"
echo " 7) reserve SCSI IDs"
}
# parse arguments
while [ "$1" != "" ]; do
PARAM=`echo $1 | awk -F= '{print $1}'`
VALUE=`echo $1 | awk -F= '{print $2}'`
case $PARAM in
-c | --connect_type)
CONNECT_TYPE=$VALUE
;;
-r | --run_choice)
RUN_CHOICE=$VALUE
;;
*)
echo "ERROR: unknown parameter \"$PARAM\""
exit 1
;;
esac
case $VALUE in
FULLSPEC | STANDARD | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7)
;;
*)
echo "ERROR: unknown option \"$VALUE\""
exit 1
;;
esac
shift
done
showRaSCSILogo
initialChecks
if [ -z "${RUN_CHOICE}" ]; then # RUN_CHOICE is unset, show menu
showMenu
readChoice
else
runChoice "$RUN_CHOICE"
fi