diff options
author | B. Watson <yalhcru@gmail.com> | 2019-12-22 08:49:06 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2019-12-22 08:49:06 -0500 |
commit | a94461e02fa0fd918e01bd80f9e65bc63e2c9d4e (patch) | |
tree | 4fe2b1b3336f808d4ee290cae8f62c472e5c0cda /sbodl | |
parent | 9004e3f6e43266c2fd23be6ff8c8bcc6805c1aa4 (diff) | |
download | sbostuff-a94461e02fa0fd918e01bd80f9e65bc63e2c9d4e.tar.gz |
handle broken symlinks, change cache dir
Diffstat (limited to 'sbodl')
-rwxr-xr-x | sbodl | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,17 +1,19 @@ #!/bin/bash -# sbodl, initial public release. +# sbodl, download slackbuilds.org source files +# 20191222 bkw: handle broken symlinks in current dir. +# change default cache dir. # 20170306 bkw: add caching SELF=$( basename $0 ) -CACHEDIR=/home/urchlay/slackbuilds +CACHEDIR=~/sbodl-cache usage() { cat <<EOF $SELF - download the sources for a slackbuilds.org build. -version 20170306, public release, with cachedir +version 20191222, public release, with cachedir (c) 2014 B. Watson (yalhcru at gmail dawt cawm) Licensed under the WTFPL: Do WTF you want with this. @@ -37,6 +39,8 @@ die() { exit 1 } +[ -d "$CACHEDIR/" ] || mkdir -p $CACHEDIR || die "Can't create $CACHEDIR" + # check for our one argument case "$1" in -h|-help|-\?|--help) usage ;; @@ -80,6 +84,10 @@ for dl in $DL; do esac FILE=$( echo "$dl" | sed 's,.*/,,' ) + + # ignore (rm) broken symlinks + [ -L "$FILE" ] && ! [ -e "$FILE" ] && FORCEDL=yes + [ "$FORCEDL" = "yes" ] && rm -f "$FILE" if [ -e "$FILE" ]; then |