From 69a9945ae955f69892c77960c02f3742f81edfc7 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Fri, 20 Apr 2018 11:09:41 -0700 Subject: [PATCH] New system_ident to set arch-specific vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a new script that sets two variables when sourced, $ras2_os and $ras2_arch. These are different than the existing variables we've been using in a2cloud/a2server and they don't (in and of themselves) presume Debian. That said, nothing's likely to work with these scripts except on Debian, so … yeah. But the script is designed not to tie you to that ultimately. Outputs the variable assignments to stdout unless you pass -q. --- scripts/system_ident | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 scripts/system_ident diff --git a/scripts/system_ident b/scripts/system_ident new file mode 100755 index 0000000..5aecd26 --- /dev/null +++ b/scripts/system_ident @@ -0,0 +1,44 @@ +#! /bin/bash +# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh: + +# system_ident - identify your system for raspple2 if needed +# +# To the extent possible under law, T. Joseph Carter and Ivan Drucker have +# waived all copyright and related or neighboring rights to the a2cloud +# scripts themselves. Software used or installed by these scripts is subject +# to other licenses. This work is published from the United States. + +if [[ -z $ras2_os || -z $ras2_arch ]]; then + ras2_os="unknown" + if hash lsb_release 2>/dev/null; then + if [[ -f /usr/bin/raspi-config ]]; then + ras2_os="rpi-$(lsb_release -rs)" + else + case "$(lsb_release -is)" in + Debian) + ras2_os="debian-$(lsb_release -cs)" + ;; + *) + printf "\nUnknown OS with lsb_release\n" + lsb_release -a + ;; + esac + fi + else + uname_s="$(uname -s)" + case "$uname_s" in + Darwin) + ras2_os="$uname_s" + ;; + *) + printf "\nUnknown OS with uname -s\n$uname_s\n" + ;; + esac + fi + ras2_arch="$(uname -m)" + export ras2_os ras2_arch +fi + +if [[ $1 != -q ]]; then + printf "ras2_os=\"%s\"\nras2_arch=\"%s\"\n" "$ras2_os" "$ras2_arch" +fi