dip

old school recipes for janitorial snafu.
git clone git://git.ricketyspace.net/dip.git
Log | Files | Refs

commit 2a8251f8a1e1677e4c2be00ac01d31acb2efcbd6
parent 70d8c401dde0664e3f3c7819ad4090ca72bdd03a
Author: rsiddharth <s@ricketyspace.net>
Date:   Fri,  2 Nov 2018 18:22:39 -0400

usr/local/bin/tball: Make it run on openbsd.

Diffstat:
usr/local/bin/tball | 26+++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/usr/local/bin/tball b/usr/local/bin/tball @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/local/bin/bash # # License: CC0-1.0 # @@ -59,7 +59,7 @@ file_updated() { local DEST=$2 # Get modified time for file - local FTIME=$(stat -t $SRC | cut -d ' ' -f 13) + local FTIME=$(stat -r $SRC | cut -d ' ' -f 11) # Get the last time source was tballed. local TBALLT=$(find $DEST -type f -name '.suffixes' -exec cat '{}' \; \ @@ -77,8 +77,8 @@ dir_updated() { local DEST=$2 # Get file that was last modified in this directory. - local F=$(find $SRC -type f -exec stat -t '{}' \; \ - | sort -r -k 13 | head -n 1 | cut -d ' ' -f 1); + local F=$(find $SRC -type f -exec stat -r '{}' \; \ + | sort -r -k 13 | head -n 1 | cut -d ' ' -f 15); return $(file_updated $F $DEST) } @@ -137,7 +137,7 @@ clean_ol_tbs() { fi # Get total timestamps. - local TOTT=$(wc -l $S | cut -f 1 -d ' ') + local TOTT=$(wc -l $S | sed -E 's/^ +//' | cut -f 1 -d ' ') if [ $TOTT -lt $MAX ]; then echo 'No old tballs to clean up [0]' @@ -152,7 +152,7 @@ clean_ol_tbs() { fi # Make temp dir. - local TMP_DIR=$(mktemp -d --suffix=-clean_tb) + local TMP_DIR=$(mktemp -d /tmp/clean_tb.XXXXXX) [[ $? == 1 ]] && exit 1 # Get timestamps to remove. @@ -208,29 +208,29 @@ tb() { local SUFFIX=$(date '+%s') # Make temp dir. - local TMP_DIR=$(mktemp -d --suffix=-tball) + local TMP_DIR=$(mktemp -d /tmp/tball.XXXXXX) [[ $? == 1 ]] && exit 1 # Make ball name - local BALL=$TMP_DIR/$BN.$SUFFIX.tar.xz + local BALL=$TMP_DIR/$BN.$SUFFIX.tar # Make ball. - echo 'Making '$BALL'...' + echo 'Making '$BALL'.xz...' if [ ${SRC: -6} == 'tar.xz' ]; then cp $SRC $BALL # SRC is already a tar ball else - tar cJvf $BALL $SRC + tar cvf $BALL $SRC && xz $BALL fi [[ $? == 1 ]] && clean_tmp $TMP_DIR && exit 1 # Enchive ball. - echo 'Enchiving '$BALL'...' - enchive archive $BALL + echo 'Enchiving '$BALL'.xz...' + enchive archive $BALL.xz [[ $? == 1 ]] && clean_tmp $TMP_DIR && exit 1 # Drop ball in destination. echo 'rsyncing '$BALL'.enchive to '$DEST'...' - rsync $BALL.enchive $DEST + rsync $BALL.xz.enchive $DEST [[ $? == 1 ]] && clean_tmp $TMP_DIR && exit 1 # Store suffix