diff options
author | Mike Crute <mike@crute.us> | 2020-05-05 20:24:06 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2020-05-05 20:24:06 +0000 |
commit | 45620833450b53d153cb1a176322bafbc48e3689 (patch) | |
tree | f1d6cd8985d58c7be4f02d03dbb894df46b6580d /.bashrc_local_home | |
parent | 3eff895dfb39511bc7e57179984b5bbcd2098d62 (diff) | |
download | dotfiles-45620833450b53d153cb1a176322bafbc48e3689.tar.bz2 dotfiles-45620833450b53d153cb1a176322bafbc48e3689.tar.xz dotfiles-45620833450b53d153cb1a176322bafbc48e3689.zip |
Update alpine image occasionally
Diffstat (limited to '.bashrc_local_home')
-rw-r--r-- | .bashrc_local_home | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/.bashrc_local_home b/.bashrc_local_home index cafa8fb..073cb41 100644 --- a/.bashrc_local_home +++ b/.bashrc_local_home | |||
@@ -14,11 +14,26 @@ export -f mutt | |||
14 | 14 | ||
15 | function alpine-build | 15 | function alpine-build |
16 | { | 16 | { |
17 | local image_name="alpine:edge" | ||
18 | local update_file="$HOME/.cache/alpine-build-pull" | ||
19 | |||
20 | # Pull image if no image update timestamp file | ||
21 | if [ ! -f "$update_file" ]; then | ||
22 | touch "$update_file" | ||
23 | docker pull "$image_name" | ||
24 | fi | ||
25 | |||
26 | # Pull image if we haven't pulled it in at least 3 days | ||
27 | if [ $(( $(date +%s) - $(stat -c "%Y" "$update_file") )) -gt 259200 ]; then | ||
28 | touch "$update_file" | ||
29 | docker pull "$image_name" | ||
30 | fi | ||
31 | |||
17 | docker run -ti --rm --detach-keys=ctrl-@ \ | 32 | docker run -ti --rm --detach-keys=ctrl-@ \ |
18 | -v $HOME/bin:/opt/home-bin:ro \ | 33 | -v $HOME/bin:/opt/home-bin:ro \ |
19 | -v $HOME/.abuild:/abuild-keys:ro \ | 34 | -v $HOME/.abuild:/abuild-keys:ro \ |
20 | -v $HOME/repos/third_party/aports:/aports \ | 35 | -v $HOME/repos/third_party/aports:/aports \ |
21 | alpine:latest /opt/home-bin/aport-bootstrap.sh | 36 | "$image_name" /opt/home-bin/aport-bootstrap.sh |
22 | } | 37 | } |
23 | export -f alpine-build | 38 | export -f alpine-build |
24 | 39 | ||