From 3e961cd4b525654af1b09167a20da0a323272625 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Thu, 10 May 2018 07:28:38 -0700 Subject: [PATCH] Clean up gsport-setup a little MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't do unar picopkgs anymore. We probably shouldn't even compile it actually. The reason why we do is because I don't want to give up on the idea that a2cloud may run on macOS at some point—but I'm as likely to just depend on Homebrew for that on the Mac. Why Homebrew? Well, I don't like its installation still (same reason I don't like ours. Running a command off a website is unwise. And of course people do stuff like that all the time, but Homebrew encourages it and shouldn't! So again, why Homebrew? With fink, you build everything from source, but you inherit the Debian library dependency hell nonetheless. MacPorts solves the dependency hell and is very robust, but it's also pretty (subjectively) unfriendly to new users who don't grok UNIX or even know where to find the M to RTFM. So we come to brew. It's pretty lightweight, it feels modern. It's distributed so that you need not be part of the in-crowd to work with it, and its Cellar approach provides makes maintenance easy. When I first looked at it, it'd been around for years but it had never really caught on. Lots of things were not there or just really outdated and unloved. I'm glad to say that's changed and the project feels more mature now. --- setup/gsport-setup | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/setup/gsport-setup b/setup/gsport-setup index 05b128b..1628003 100755 --- a/setup/gsport-setup +++ b/setup/gsport-setup @@ -3,6 +3,39 @@ # to do: replace Spectrum Deluxe (2.5.3) with Spectrum Gold (2.5.4) +# from system_ident +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 + + readcharHex () { # read one character from file & convert to corresponding hex value # arg1: filename @@ -250,14 +283,6 @@ if ! hash unar 2> /dev/null; then sudo apt-get clean fi - if ! hash unar 2> /dev/null; then - if [[ $downloadBinaries && "$(apt-cache search '^libgnustep-base1.22$')" ]]; then - # Dependencies: for unar - sudo apt-get -y install libgnustep-base1.22 - sudo apt-get clean - wget -qO- "${a2cBinaryURL}/picopkg/unar-${arch}_${debianName}.tgz" | sudo tar Pzx &> /dev/null - fi - # If all else fails, compile from source. if ! hash unar 2> /dev/null; then @@ -303,7 +328,10 @@ if ! hash nulib2 2> /dev/null; then cd $tempDir if [[ $downloadBinaries ]]; then ### ArchiveTools: Install nulib2 binaries - wget -qO- "${a2cBinaryURL}/picopkg/nulib2-${arch}_${debianName}.tgz" | sudo tar Pzx + wget -q "${a2cBinaryURL}/picopkg/nulib2-${ras2_os}_${ras2_arch}.tgz" + if [[ -f "nulib2-${ras2_os}_${ras2_arch}.tgz" ]]; then + sudo tar Pzxf "nulib2-${ras2_os}_${ras2_arch}.tgz" + fi fi if ! hash nulib2 2> /dev/null; then