From eaacba99f6ddacb68414341483102a7aaf6cda7c Mon Sep 17 00:00:00 2001 From: wade ~ Pack3tL0ss Date: Thu, 1 Feb 2024 23:49:12 -0600 Subject: [PATCH] :sparkles: add flag for installer to skip bluetooth setup, show model info for non rpi if possible --- installer/common.sh | 9 ++++++++- installer/install.sh | 21 ++++++++++++--------- installer/update.sh | 9 ++------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/installer/common.sh b/installer/common.sh index 85da4e82..0aad2b6d 100755 --- a/installer/common.sh +++ b/installer/common.sh @@ -612,7 +612,14 @@ get_pi_info() { cpu=$(cat /proc/cpuinfo | grep 'Hardware' | awk '{print $3}') rev=$(cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}') model_pretty=$(get_pi_info_pretty $rev 2>/dev/null) - [ -n "$model_pretty" ] && is_pi=true || is_pi=false + if [ -n "$model_pretty" ]; then + is_pi=true + else + is_pi=false + if hash dmidecode 2>/dev/null; then + . <(dmidecode | grep "^System Information" -A2 | tail -n +2 | sed 's/: /="/' | sed 's/ /_/' | sed 's/$/"/' | tr -d "\t") + model_pretty="$Manufacturer $Product_Name" + fi logit "$model_pretty" [ -f /etc/os-release ] && . /etc/os-release && logit "$NAME $(head -1 /etc/debian_version) ($VERSION_CODENAME) running on $cpu Revision: $rev" logit "$(uname -a)" diff --git a/installer/install.sh b/installer/install.sh index 276f546a..fe17c28d 100755 --- a/installer/install.sh +++ b/installer/install.sh @@ -124,15 +124,12 @@ do_apt_deps() { process_cmds --apt-install "libssl-dev" fi - # If it's an RPI we ensure RPi.GPIO is up to date. - # TODO this may not be necessary with restoration of pip install RPi.GPIO below - ## This would check if its current - # apt list -u 2> >(grep -v "^$" | grep -v "stable CLI" | tee -a delme) | grep -q python3-rpi.gpio - # return code = 1 means it's not in the upgrade list so it's current - # [ "$is_pi" = true ] && apt upgrade -y python3-rpi.gpio >/dev/null 2> >(grep -v "^$" | grep -v "stable CLI" | tee -a $log_file) || - # logit "apt upgrade python3-rpi.gpio returned an error, check logs in $log_file" "WARNING" - - # TODO add picocom, maybe ser2net, ensure process_cmds can accept multiple packages + # Install picocom + if [[ $(picocom --help 2>/dev/null | head -1) ]]; then + logit "$(picocom --help 2>/dev/null | head -1) is already installed" + else + process_cmds -apt-install picocom + fi logit "$process - Complete" else @@ -636,6 +633,7 @@ show_usage() { fi _help "-P|--post" "~/consolepi-stage/consolepi-post.sh if found is executed after initial install. Use this to run after upgrade." _help "--no-apt" "Skip the apt update/upgrade portion of the Upgrade. Should not be used on initial installs." + _help "--no-blue" "Skip bluetooth console and blue user setup." _help "--no-pip" "Skip pip install -r requirements.txt. Should not be used on initial installs." echo echo -e "${_cyan}Examples:${_norm}" @@ -682,6 +680,7 @@ process_args() { local_dev=false dopip=true doapt=true + do_blue=true do_reboot=false do_consolepi_post=false no_users=false @@ -713,6 +712,10 @@ process_args() { doapt=false shift ;; + -*no-blue) + do_blue=false # skip bluetooth and blue user + shift + ;; -*no-users) # Don't log stderr anywhere default is to log_file local no_users=true shift diff --git a/installer/update.sh b/installer/update.sh index 471e90a3..9138a469 100755 --- a/installer/update.sh +++ b/installer/update.sh @@ -833,6 +833,8 @@ _handle_blue_symlink() { do_blue_config() { process="Bluetooth Console" + ! $do_blue && logit "Skipping bluetooth serial setup based on --no-blue flag" && return 0 + logit "${process} Starting" # [ "$btmode" == "serial" ] && local btsrc="${src_dir}systemd/bluetooth.service" || local btsrc="${src_dir}systemd/bluetooth_pan.service" @@ -917,13 +919,6 @@ do_blue_config() { logit "blue user consolepi-menu alias already configured" fi - # Install picocom - if [[ $(picocom --help 2>/dev/null | head -1) ]]; then - logit "$(picocom --help 2>/dev/null | head -1) is already installed" - else - process_cmds -apt-install picocom - fi - logit "${process} Complete" unset process }