mirror of
https://github.com/akuker/RASCSI.git
synced 2025-01-03 01:33:14 +00:00
Introduce option to use clang++, and option to skip apt packages (#971)
- Make clang++-11 the default for compiling rascsi - Add --with_gcc option to use g++ instead - Add option to skip apt-get package installation (this saves a significant amount of time running the script on a Zero when you already have the required packages installed) - Add a line to the script menu showing current options - Surrounding cleanup
This commit is contained in:
parent
1cae530d42
commit
e8b72c48de
@ -46,6 +46,9 @@ logo="""
|
|||||||
echo -e $logo
|
echo -e $logo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COMPILER="clang++-11"
|
||||||
|
CONNECT_TYPE="FULLSPEC"
|
||||||
|
CORES=1
|
||||||
USER=$(whoami)
|
USER=$(whoami)
|
||||||
BASE=$(dirname "$(readlink -f "${0}")")
|
BASE=$(dirname "$(readlink -f "${0}")")
|
||||||
CPP_PATH="$BASE/cpp"
|
CPP_PATH="$BASE/cpp"
|
||||||
@ -88,6 +91,10 @@ function sudoCheck() {
|
|||||||
|
|
||||||
# install all dependency packages for RaSCSI Service
|
# install all dependency packages for RaSCSI Service
|
||||||
function installPackages() {
|
function installPackages() {
|
||||||
|
if [[ $SKIP_PACKAGES ]]; then
|
||||||
|
echo "Skipping package installation"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -qq \
|
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -qq \
|
||||||
build-essential \
|
build-essential \
|
||||||
git \
|
git \
|
||||||
@ -113,20 +120,25 @@ function installPackages() {
|
|||||||
man2html \
|
man2html \
|
||||||
hfsutils \
|
hfsutils \
|
||||||
dosfstools \
|
dosfstools \
|
||||||
kpartx
|
kpartx \
|
||||||
|
clang-11
|
||||||
}
|
}
|
||||||
|
|
||||||
# install Debian packges for RaSCSI standalone
|
# install Debian packges for RaSCSI standalone
|
||||||
function installPackagesStandalone() {
|
function installPackagesStandalone() {
|
||||||
|
if [[ $SKIP_PACKAGES ]]; then
|
||||||
|
echo "Skipping package installation"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -qq \
|
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -qq \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
git \
|
||||||
libspdlog-dev \
|
libspdlog-dev \
|
||||||
libpcap-dev \
|
libpcap-dev \
|
||||||
libprotobuf-dev \
|
libprotobuf-dev \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
disktype \
|
|
||||||
libgmock-dev \
|
libgmock-dev \
|
||||||
man2html
|
clang-11
|
||||||
}
|
}
|
||||||
|
|
||||||
# cache the pip packages
|
# cache the pip packages
|
||||||
@ -140,10 +152,10 @@ function cachePipPackages(){
|
|||||||
function compileRaScsi() {
|
function compileRaScsi() {
|
||||||
cd "$CPP_PATH" || exit 1
|
cd "$CPP_PATH" || exit 1
|
||||||
|
|
||||||
echo "Compiling with ${CORES:-1} simultaneous cores..."
|
echo "Compiling $CONNECT_TYPE with $COMPILER on $CORES simultaneous cores..."
|
||||||
make clean </dev/null
|
make clean </dev/null
|
||||||
|
|
||||||
make -j "${CORES:-1}" all CONNECT_TYPE="${CONNECT_TYPE:-FULLSPEC}" </dev/null
|
make CXX="$COMPILER" CONNECT_TYPE="$CONNECT_TYPE" -j "$CORES" all </dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupOutdatedManPage() {
|
function cleanupOutdatedManPage() {
|
||||||
@ -163,7 +175,7 @@ function installRaScsi() {
|
|||||||
cleanupOutdatedManPage "sasidump.1"
|
cleanupOutdatedManPage "sasidump.1"
|
||||||
|
|
||||||
# install
|
# install
|
||||||
sudo make install CONNECT_TYPE="${CONNECT_TYPE:-FULLSPEC}" </dev/null
|
sudo make install CONNECT_TYPE="$CONNECT_TYPE" </dev/null
|
||||||
|
|
||||||
# update launch parameters
|
# update launch parameters
|
||||||
if [[ -f $SECRET_FILE ]]; then
|
if [[ -f $SECRET_FILE ]]; then
|
||||||
@ -806,7 +818,7 @@ function installNetatalk() {
|
|||||||
rm "netatalk-$NETATALK_VERSION.tar.gz"
|
rm "netatalk-$NETATALK_VERSION.tar.gz"
|
||||||
|
|
||||||
cd "$HOME/Netatalk-2.x-netatalk-$NETATALK_VERSION/contrib/shell_utils" || exit 1
|
cd "$HOME/Netatalk-2.x-netatalk-$NETATALK_VERSION/contrib/shell_utils" || exit 1
|
||||||
./debian_install.sh -j="${CORES:-1}" -n="$FILE_SHARE_NAME" -p="$FILE_SHARE_PATH" || exit 1
|
./debian_install.sh -j="$CORES" -n="$FILE_SHARE_NAME" -p="$FILE_SHARE_PATH" || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Appends the images dir as a shared Netatalk volume
|
# Appends the images dir as a shared Netatalk volume
|
||||||
@ -1171,7 +1183,7 @@ function enableWebInterfaceAuth {
|
|||||||
function runChoice() {
|
function runChoice() {
|
||||||
case $1 in
|
case $1 in
|
||||||
1)
|
1)
|
||||||
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE:-FULLSPEC}) + Web Interface"
|
echo "Installing / Updating RaSCSI Service ($CONNECT_TYPE) + Web Interface"
|
||||||
echo "This script will make the following changes to your system:"
|
echo "This script will make the following changes to your system:"
|
||||||
echo "- Install additional packages with apt-get"
|
echo "- Install additional packages with apt-get"
|
||||||
echo "- Add and modify systemd services"
|
echo "- Add and modify systemd services"
|
||||||
@ -1212,10 +1224,10 @@ function runChoice() {
|
|||||||
showRaScsiStatus
|
showRaScsiStatus
|
||||||
showRaScsiWebStatus
|
showRaScsiWebStatus
|
||||||
notifyBackup
|
notifyBackup
|
||||||
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE:-FULLSPEC}) + Web Interface - Complete!"
|
echo "Installing / Updating RaSCSI Service ($CONNECT_TYPE) + Web Interface - Complete!"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE:-FULLSPEC})"
|
echo "Installing / Updating RaSCSI Service ($CONNECT_TYPE)"
|
||||||
echo "This script will make the following changes to your system:"
|
echo "This script will make the following changes to your system:"
|
||||||
echo "- Install additional packages with apt-get"
|
echo "- Install additional packages with apt-get"
|
||||||
echo "- Add and modify systemd services"
|
echo "- Add and modify systemd services"
|
||||||
@ -1228,7 +1240,7 @@ function runChoice() {
|
|||||||
createImagesDir
|
createImagesDir
|
||||||
createCfgDir
|
createCfgDir
|
||||||
updateRaScsiGit
|
updateRaScsiGit
|
||||||
installPackages
|
installPackagesStandalone
|
||||||
stopRaScsiScreen
|
stopRaScsiScreen
|
||||||
stopRaScsi
|
stopRaScsi
|
||||||
compileRaScsi
|
compileRaScsi
|
||||||
@ -1247,7 +1259,7 @@ function runChoice() {
|
|||||||
showRaScsiCtrlBoardStatus
|
showRaScsiCtrlBoardStatus
|
||||||
showRaScsiStatus
|
showRaScsiStatus
|
||||||
notifyBackup
|
notifyBackup
|
||||||
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE:-FULLSPEC}) - Complete!"
|
echo "Installing / Updating RaSCSI Service ($CONNECT_TYPE) - Complete!"
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
echo "Installing / Updating RaSCSI OLED Screen"
|
echo "Installing / Updating RaSCSI OLED Screen"
|
||||||
@ -1322,7 +1334,7 @@ function runChoice() {
|
|||||||
echo "Installing Web Proxy Server - Complete!"
|
echo "Installing Web Proxy Server - Complete!"
|
||||||
;;
|
;;
|
||||||
10)
|
10)
|
||||||
echo "Configuring RaSCSI stand-alone (${CONNECT_TYPE:-FULLSPEC})"
|
echo "Configuring RaSCSI stand-alone ($CONNECT_TYPE)"
|
||||||
echo "This script will make the following changes to your system:"
|
echo "This script will make the following changes to your system:"
|
||||||
echo "- Install additional packages with apt-get"
|
echo "- Install additional packages with apt-get"
|
||||||
echo "- Create directories and change permissions"
|
echo "- Create directories and change permissions"
|
||||||
@ -1335,7 +1347,7 @@ function runChoice() {
|
|||||||
stopRaScsi
|
stopRaScsi
|
||||||
compileRaScsi
|
compileRaScsi
|
||||||
installRaScsi
|
installRaScsi
|
||||||
echo "Configuring RaSCSI stand-alone (${CONNECT_TYPE:-FULLSPEC}) - Complete!"
|
echo "Configuring RaSCSI stand-alone ($CONNECT_TYPE) - Complete!"
|
||||||
echo "Use 'rascsi' to launch RaSCSI, and 'rasctl' to control the running process."
|
echo "Use 'rascsi' to launch RaSCSI, and 'rasctl' to control the running process."
|
||||||
;;
|
;;
|
||||||
11)
|
11)
|
||||||
@ -1403,9 +1415,10 @@ function readChoice() {
|
|||||||
|
|
||||||
# Shows the interactive main menu of the script
|
# Shows the interactive main menu of the script
|
||||||
function showMenu() {
|
function showMenu() {
|
||||||
|
echo "Board Type: $CONNECT_TYPE | Compiler: $COMPILER | Compiler Cores: $CORES"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Choose among the following options:"
|
echo "Choose among the following options:"
|
||||||
echo "INSTALL/UPDATE RASCSI (${CONNECT_TYPE-FULLSPEC} version)"
|
echo "INSTALL/UPDATE RASCSI"
|
||||||
echo " 1) Install or update RaSCSI Service + Web Interface"
|
echo " 1) Install or update RaSCSI Service + Web Interface"
|
||||||
echo " 2) Install or update RaSCSI Service"
|
echo " 2) Install or update RaSCSI Service"
|
||||||
echo " 3) Install or update RaSCSI OLED Screen (requires hardware)"
|
echo " 3) Install or update RaSCSI OLED Screen (requires hardware)"
|
||||||
@ -1462,6 +1475,12 @@ while [ "$1" != "" ]; do
|
|||||||
-h | --headless)
|
-h | --headless)
|
||||||
HEADLESS=1
|
HEADLESS=1
|
||||||
;;
|
;;
|
||||||
|
-g | --with_gcc)
|
||||||
|
COMPILER="g++"
|
||||||
|
;;
|
||||||
|
-s | --skip_packages)
|
||||||
|
SKIP_PACKAGES=1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: Unknown parameter \"$PARAM\""
|
echo "ERROR: Unknown parameter \"$PARAM\""
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user