[HN Gopher] Universal Install Script (2016)
       ___________________________________________________________________
        
       Universal Install Script (2016)
        
       Author : guessmyname
       Score  : 64 points
       Date   : 2023-04-14 18:51 UTC (4 hours ago)
        
 (HTM) web link (xkcd.com)
 (TXT) w3m dump (xkcd.com)
        
       | chriswarbo wrote:
       | Won't work at all without a `/bin/bash` executable. Maybe
       | `/bin/sh` is even more universal? I always use `/usr/bin/env
       | bash`, which looks in $PATH rather than relying on "global"
       | namespaces (/, /usr, /usr/local, etc.)
        
         | shiomiru wrote:
         | I prefer just /bin/sh too, it's portable and generally faster.
         | When I get to a point where I'd need bash extensions, it's a
         | sign that I should be using another language.
        
       | dpkirchner wrote:
       | Probably should add a "wait" to the end. Otherwise lgtm, go ahead
       | and ship.
        
       | mdaniel wrote:
       | According to the "Last-Modified" header on the png, and
       | https://news.ycombinator.com/item?id=11264755 and
       | https://news.ycombinator.com/item?id=11278013 this should have
       | (2016) on it
        
         | Arnavion wrote:
         | Or https://xkcd.com/1654/ -> https://explainxkcd.com/1654/ ->
         | 2016-03-11
        
         | dang wrote:
         | Added. Thanks! Related:
         | 
         |  _Universal Install Script by XKCD - Combat Test_ -
         | https://news.ycombinator.com/item?id=11522478 - April 2016 (17
         | comments)
         | 
         |  _Universal install script_ -
         | https://news.ycombinator.com/item?id=11278013 - March 2016 (1
         | comment)
         | 
         |  _Universal Install Script_ -
         | https://news.ycombinator.com/item?id=11264755 - March 2016 (4
         | comments)
        
       | _benj wrote:
       | The curl one made me chuckle!
       | 
       | Might there be a case in which the git one and curl one both
       | work?
        
         | divbzero wrote:
         | Seems unlikely it could work for both. GitHub does not allow .
         | in user or org name, so a $1 that works for GitHub would
         | generally not work as a hostname for curl.
        
         | [deleted]
        
       | Animats wrote:
       | I'm trying to build the same Rust program for Linux, Windows, and
       | MacOS. Cross-compiling isn't the hard part. Rust can make Windows
       | executables on Linux. Making an installer is. Most of the
       | installer builders only run on Windows and use Microsoft
       | components. "Inno", an ancient freeware program, will run under
       | Wine. But it outputs an old-style .exe installer, not a newer
       | .msi installer.
       | 
       | Packaging for Linux isn't much better. There's .deb, for which
       | you need a "repository". There are "snaps", which is Canonical's
       | scheme for getting developers under control of their App Store.
       | There was Flatpak, but Canonical is trying to kill that off.
       | There's AppImage, but the code to build those hasn't been updated
       | in two years. There's always .zip files.
       | 
       | Not sure how to package for MacOS yet.
        
         | z3t4 wrote:
         | * * *
        
       | samsquire wrote:
       | This reminds me of my package manager package manager
       | 
       | The idea you would chain together multiple package managers such
       | as this:                 mpm install
       | script/https://get.rvm.io \         rvm/1.9.3 \
       | script/git@github.com/rubygems/rubygems/setup.rb \
       | gem/rails \        apt/mysql-server \        apt/mysql-client \
       | bundle/http://typosphere.org/stable.tgz
       | 
       | https://github.com/samsquire/ideas#12-the-package-manager-pa...
        
       | asddubs wrote:
       | the github one got a laugh out of me
        
       | bhawks wrote:
       | The 2023 version of this just sends chatgpt a prompt saying
       | produce a bash script that installs $1 onto my machine.
       | 
       | The result of the prompt is evaluated by a root shell, naturally.
        
       | csours wrote:
       | Won't it break when one of the commands returns non-zero? I think
       | you can replace the & with ;
        
         | paulddraper wrote:
         | No, first because it's put in background.
         | 
         | Second because there's no `-e`.
        
         | ukuina wrote:
         | Definitely missing one & after the git clone, else the cd into
         | the directory after will fail, assuming the git clone takes
         | non-zero time to execute.
        
         | Linux-Fan wrote:
         | The script has single `&` which means the respective commands
         | will run in background (and in parallel!) which effectively
         | ignores their return codes.
        
         | 2OEH8eoCRo0 wrote:
         | && would
         | 
         | & detaches them essentially running them in parallel?
        
         | ketralnis wrote:
         | No, & isn't the same as && which I think is what you're
         | thinking.
         | 
         | & is for backgrounding:                   #!/bin/sh
         | date         sleep 5 &   # forks the command into the
         | background, we proceed immediately         date         wait
         | # pauses until the backgrounded sleep returns         date
         | 
         | has output                   Fri Apr 14 13:17:00 PDT 2023
         | Fri Apr 14 13:17:00 PDT 2023         Fri Apr 14 13:17:05 PDT
         | 2023
        
       | mdaniel wrote:
       | relevant: https://xkcd.com/1987/
        
       ___________________________________________________________________
       (page generated 2023-04-14 23:01 UTC)