Skip to content

Commit

Permalink
✨ add flag for installer to skip bluetooth setup, show model info for…
Browse files Browse the repository at this point in the history
… non rpi if possible
  • Loading branch information
wade ~ Pack3tL0ss committed Feb 2, 2024
1 parent a3cd3ab commit eaacba9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
9 changes: 8 additions & 1 deletion installer/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
21 changes: 12 additions & 9 deletions installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions installer/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit eaacba9

Please sign in to comment.