Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel check #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions iiab
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ FLAGDIR=/etc/iiab/install-flags
APTPATH=/usr/bin # Avoids problematic /usr/local/bin/apt on Linux Mint
FAST=false # YOUR OWN RISK: Fewer security & user education prompts.
MFABT=false # No time to read the book? "Move Fast and Break Things:
MIN_RPI_KERN=1440
# How Facebook, Google, and Amazon Cornered Culture and Undermined Democracy"

if [[ $(id -un) != "root" ]]; then
Expand Down Expand Up @@ -105,6 +106,11 @@ iiab_var_value() {
[[ $v2 != "" ]] && echo $v2 || echo $v1 # [ "$v2" ] ALSO WORKS
}

# Subroutine compares software version numbers. Generates rare false positives
# like "1.0 > 1" and "2.4.0 > 2.4". Avoid risks by structuring conditionals w/
# a consistent # of decimal points e.g. "if version_gt w.x.y.z a.b.c.d; then"
version_gt() { [ "$(printf '%s\n' "$@" | sort -V | head -1)" != "$1" ]; }

# C. Ask for password change if pi/raspberry default remains
if check_user_pwd "pi" "raspberry"; then
echo -e "\n\n\e[41;1mRaspberry Pi's are COMPROMISED often if the default password is not changed!\e[0m\n"
Expand Down Expand Up @@ -255,6 +261,16 @@ if ! $($MFABT); then
fi
fi

CURR_KERN=`uname -v | awk '{print $1}' | sed -e s'/#//'`
if [ -f /etc/rpi-issue ] && version_gt $MIN_RPI_KERN $CURR_KERN; then
echo -e "Found Kernel ""$CURR_KERN"
echo -e "\nWARNING: Kernel ""$MIN_RPI_KERN"" or higher required with Raspbian."
echo -e "PLEASE RUN 'apt update','apt upgrade','reboot' then login and 'sudo iiab'"
echo -e "Hit [enter] to exit"
read ans < /dev/tty
exit 0
fi

####################### MAIN INTERACTIVE STUFF IS ABOVE #######################

# H. If microSD, lower reserve disk space from ~5% to 2%
Expand Down