diff options
Diffstat (limited to 'sbodl')
| -rwxr-xr-x | sbodl | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -177,7 +177,7 @@ CONTDISP="--content-disposition" # 20231205 bkw: fancy argument checking. note that getopt is part of # util-linux; do not confuse it with bash's built-in getopts (with an "s"). -OPTS=$( getopt -n 1.sh -o vmhafn -l help,man,doc,version,archive,force,no-content-disposition -- "$@" ) +OPTS=$( getopt -n $SELF -o vmhafnu -l help,man,doc,version,archive,force,no-content-disposition,update -- "$@" ) eval set -- "$OPTS" while true; do case "$1" in @@ -186,6 +186,7 @@ while true; do -v|--version) echo $VERSION ; exit 0 ;; -a|--archive) USEARCHIVE="yes" ; shift ; continue ;; -f|--force) FORCEDL="yes" ; shift ; continue ;; + -u|--update) UPDATE="yes" ; shift ; continue ;; -n) CONTDISP="--no-content-disposition" ; shift ; continue ;; --) shift; break ;; esac @@ -197,7 +198,8 @@ fi [ -d "$CACHEDIR/" ] || mkdir -p $CACHEDIR || die "Can't create $CACHEDIR" -source ./$( basename $( pwd ) ).info \ +INFOFILE="./$( basename $( pwd ) ).info" +source "$INFOFILE" \ || die "No .info file, are you sure this is a SBo directory? Try '$SELF --help'" # This stanza copied from the SBo template for 14.1: @@ -281,6 +283,10 @@ for dl in $DL; do echo -e "${RED}WARN: md5sum doesn't match${COLOR_OFF}\\n expected: $1\\n got: $GOTSUM" case "$FILE" in ?.cabal) echo -e "${YELLOW}HINT:${COLOR_OFF} for ?.cabal files: if the md5sum fails, retry with '$SELF -f'." ;; + *) if [ "$UPDATE" = "yes" ]; then + echo "Updating .info file with new md5sum" + sed -i "s,$1,$GOTSUM," $INFOFILE + fi ;; esac EXIT=1 else @@ -294,3 +300,4 @@ for dl in $DL; do done exit $EXIT + |
