aboutsummaryrefslogtreecommitdiff
path: root/sbodl
diff options
context:
space:
mode:
Diffstat (limited to 'sbodl')
-rwxr-xr-xsbodl14
1 files changed, 11 insertions, 3 deletions
diff --git a/sbodl b/sbodl
index def7c7e..3d1e4e0 100755
--- a/sbodl
+++ b/sbodl
@@ -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