diff --git a/scripts/system_ident b/scripts/system_ident new file mode 100755 index 0000000..048b9ad --- /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 a2server +# 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 -cs)" + 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 diff --git a/setup/ivan.sh b/setup/ivan.sh index 5f58f0b..23628bc 100755 --- a/setup/ivan.sh +++ b/setup/ivan.sh @@ -16,22 +16,14 @@ if [[ ! -f "$top_src/.a2server_source" ]]; then exit 1 fi +# Make sure ras2_{os,arch} get set +. "$top_src/scripts/system_ident" -q + # This is now in install.sh, get it from there a2serverVersion=$(grep '^a2serverVersion' "$top_src/install.sh" | cut -d '"' -f 2) compare_version="$top_src/scripts/compare_version" -isRpi= -[[ -f /usr/bin/raspi-config ]] && isRpi=1 - -isDebian= -if [[ "$(lsb_release -ds)" = Debian* ]]; then - debianVersion="$(lsb_release -rs)" - if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then - isDebian=1 - fi -fi - if [[ -f /usr/local/etc/A2SERVER-version ]]; then read installedVersion = 8 && ${debianVersion%.*} < 10 )); then + unsupportedOS= + fi fi -elif [[ $isDebian ]]; then # supported Debian? - debianVersion=$(cat /etc/debian_version) - debianSupported="-9.2- -8.2- -7.9- -7.8- -7.6- -7.3-" - [[ $debianSupported == *-$debianVersion-* ]] && unsupportedOS= -fi - -if [[ $unsupportedOS && $isRpi ]]; then - echo - echo "A2SERVER and its installer scripts have been tested on Raspbian Wheezy," - echo "Jessie, and Stretch though not this specific firmware version" - echo "(${fwhash:0:7}). Just FYI." - unsupportedOS= -elif [[ $unsupportedOS && $isDebian ]]; then - echo - echo "A2SERVER and its installer scripts have been tested on Debian 7/8/9," - echo "though not this specific point release ($debianVersion). Just FYI." - unsupportedOS= fi if [[ $unsupportedOS ]]; then - echo - echo "WARNING: A2SERVER and its installer scripts have only been tested on" - echo "Debian and Raspbian. Continuing is probably fine, but might not be." - echo "Theoretical worst case would be your operating system no longer works" - echo "properly or data is lost, so consider backing up first." + cat <<-EOF + + WARNING: A2SERVER and its installer scripts have only been tested on + Debian and Raspbian wheezy, jessie, and stretch. It may work with later + versions, but it might not. The theoretical worst case would be an OS + image that no longer works correctly or lost data, so you might want to + press ctrl-c here. Otherwise press Return. + + Detected system: $ras2_os ($ras2_arch) + EOF + read fi doSetup=1