Add a script for testing curl | zsh resilience and mention it in the README

This commit is contained in:
Danielle McLean 2016-10-04 23:38:41 +11:00
parent a324ca62c8
commit 5178802725
No known key found for this signature in database
GPG key ID: CC91589719027E94
3 changed files with 30 additions and 2 deletions

View file

@ -3,9 +3,18 @@
A fast and easy bootstrap for my dotfiles that also acts as a simple management script once installed. Bootstrapping is as simple as: A fast and easy bootstrap for my dotfiles that also acts as a simple management script once installed. Bootstrapping is as simple as:
```zsh ```zsh
curl 'https://dots.00dani.id.au' | zsh curl https://dots.00dani.id.au | zsh
``` ```
`dots` will then install itself, [GNU Stow](https://www.gnu.org/software/stow/) (if not already installed globally), and my configuration for [git](https://github.com/00dani/dot-git), [vim](https://github.com/00dani/dot-vim), and [zsh](https://github.com/00dani/dot-zsh). If you're wary about piping scripts into your shell - [you should be](https://www.seancassidy.me/dont-pipe-to-your-shell.html) - then feel free to download the script and check it out first. `dots` *is* [designed to crash harmlessly](https://dots.00dani.id.au/partial-dl-test) rather than run something dangerous if `curl` is interrupted, however.
```zsh
curl https://dots.00dani.id.au > dots
less dots
# reviewing ... looks okay!
zsh dots
```
When run through either of these methods, `dots` will install itself, [GNU Stow](https://www.gnu.org/software/stow/) (if not already installed globally), and my configuration for [git](https://github.com/00dani/dot-git), [vim](https://github.com/00dani/dot-vim), and [zsh](https://github.com/00dani/dot-zsh).
Packages are installed by `dots` to `~/dotfiles` and then linked into `~` using Stow. I'll be adding flags for customising these paths, as well as adjusting which packages the bootstrap immediately installs. Packages are installed by `dots` to `~/dotfiles` and then linked into `~` using Stow. I'll be adding flags for customising these paths, as well as adjusting which packages the bootstrap immediately installs.

12
_scripts/partial-dl-test Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
actualSize=$(wc -c < $1)
for (( size = 0; size < actualSize; size++ )); do
head -c$size $1 | env -i HOME=$HOME/test zsh 2>/dev/null
if [[ -d $HOME/test ]]; then
percent=$(( size * 100 / actualSize ))
echo "dots still ran with only $size bytes available, " \
"$percent% of its full $actualSize bytes!" 2>/dev/null
exit $size
fi
done

7
partial-dl-test.html Normal file
View file

@ -0,0 +1,7 @@
---
layout: page
permalink: /partial-dl-test
---
{% highlight zsh %}
{% include_relative _scripts/partial-dl-test %}
{% endhighlight %}