aaronkjones / rpi-k8s-node-prep

Prepares a Raspberry Pi node for Kubernetes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uname -a does not show raspbian

RichardBronosky opened this issue · comments

https://github.com/aaronkjones/rpi-k8s-node-prep/blob/master/prep.sh#L14

However...

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.50-v7+ #1122 SMP Tue Jun 19 12:26:26 BST 2018 armv7l GNU/Linux

pi@raspberrypi:~ $ cat /etc/os-release | grep raspbian;
ID=raspbian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:~ $ echo "exit code zero would mean success-> $?"
exit code zero would mean success-> 0

Running your script with #!/bin/bash -x shows:

+ uname -a
+ grep hypriot
+ uname -a
+ grep raspbian
+ [[ '' == \r\a\s\p\b\i\a\n ]]
+ [[ '' == \h\y\p\r\i\o\t ]]
+ echo 'OS type not known'
OS type not known
+ exit 1

This is because the second string in uname -a is the hostname it seems, which by default is raspbian I guess.

Good catch.

lsb_release -si is more reliable

Fixed in 89174a0

I do not have Hypriot available to check what lsb_release -si returns. Will update when I do.

lsb_release -si is more reliable

Agreed! That's what I normally use (and meant to suggest). Make sure you grep -iq.

Nevermind about grep. I see you did an exact match.

Also, this was a good catch! e069abc I thought it was strange that I didn't get prompted when piping it to sh, but I did when curl -Oed it to a file and ran it. I didn't care to study it.