7 ms·
Universal Install Script (2016)
- asddubs 4y agothe github one got a laugh out of me
- csours 4y agoWon't it break when one of the commands returns non-zero? I think you can replace the & with ;
- Linux-Fan 4y agoThe script has single `&` which means the respective commands will run in background (and in parallel!) which effectively ignores their return codes.
- 2OEH8eoCRo0 4y ago&& would & detaches them essentially running them in parallel?
- ukuina 4y agoDefinitely 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.
- philsnow 4y agoyeah that one should definitely be more like { git clone ... ; cd "$1"; ./configure; make; make install } & to run the group command (I had to look up the term in man bash) all in the background. Using group commands can be kind of weird though because they're run in the environment of the running shell, so % mkdir -p /tmp/foo && cd /tmp/foo && pwd /tmp/foo % { mkdir bar; cd bar; echo $BASH_SUBSHELL ; } 0 % pwd /tmp/foo/bar but if you do the group command in the background, bash runs it in a subshell[0] and the current directory for your shell doesn't change: % mkdir -p /tmp/foo && cd /tmp/foo && pwd /tmp/foo % { mkdir bar; cd bar; echo $BASH_SUBSHELL ; } & 1 % pwd /tmp/foo [0] From man bash: If a command is terminated by the control operator &, the shell executes the command in the background in a subshell.
- paulddraper 4y agoNo, first because it's put in background. Second because there's no `-e`.
- ketralnis 4y agoNo, & 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
- _benj 4y agoThe curl one made me chuckle! Might there be a case in which the git one and curl one both work?
- deleted 4y ago[deleted]
- divbzero 4y agoSeems 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.
- samsquire 4y agoThis 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-package-manager https://github.com/samsquire/ideas#12-the-package-manager-pa...
- mdaniel 4y agorelevant: https://xkcd.com/1987/ https://xkcd.com/1987/
- chriswarbo 4y agoWon'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 4y agoI 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.
- bradknowles 4y agoExcept where /bin/sh is actually a link to the "ash" shell, and stuff suddenly doesn't work the right way anymore. I'm looking at you, Alpine Linux.
- mdaniel 4y agoAccording to the "Last-Modified" header on the png, and https://news.ycombinator.com/item?id=11264755 https://news.ycombinator.com/item?id=11264755 and https://news.ycombinator.com/item?id=11278013 https://news.ycombinator.com/item?id=11278013 this should have (2016) on it
- Arnavion 4y agoOr https://xkcd.com/1654/ https://xkcd.com/1654/ -> https://explainxkcd.com/1654/ https://explainxkcd.com/1654/ -> 2016-03-11
- dang 4y agoAdded. Thanks! Related: Universal Install Script by XKCD – Combat Test - https://news.ycombinator.com/item?id=11522478 https://news.ycombinator.com/item?id=11522478 - April 2016 (17 comments) Universal install script - https://news.ycombinator.com/item?id=11278013 https://news.ycombinator.com/item?id=11278013 - March 2016 (1 comment) Universal Install Script - https://news.ycombinator.com/item?id=11264755 https://news.ycombinator.com/item?id=11264755 - March 2016 (4 comments)
- dpkirchner 4y agoProbably should add a "wait" to the end. Otherwise lgtm, go ahead and ship.
- Animats 4y agoI'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 4y agoJust statically include everything in one executable. Or release the source and let others build & package it for their favourite OS.
- Animats 4y agoThis is an application for end users. Remember them?
- z3t4 4y agoUsing a single executable file will make their life easier. And some users will be "power" users and will know how to package something. Make use of your user community.
- Animats 4y agoThere's only one executable, with no .dll or .so files. It needs some text and image assets that don't need to be in memory all the time, so I don't want to nail them into the running executable. (You can do that in Rust, and I do it for a few minor icons such as arrows that aren't going to change. But not for big stuff.)
- seabass-labrax 4y ago
- bhawks 4y agoThe 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.
- Georgelemental 4y agoOnce you have it installations, you can keep it up-to-date with https://github.com/topgrade-rs/topgrade https://github.com/topgrade-rs/topgrade