little workaround BSD abspaths

This commit is contained in:
ville rantanen
2019-04-12 13:46:41 +03:00
parent 5678c7e8f9
commit 93b02c5161
7 changed files with 12 additions and 5 deletions

1
bin/abs-path Symbolic link
View File

@@ -0,0 +1 @@
../files/abs-path

6
files/abs-path Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -e
case $OSTYPE in
darwin*) exec realpath "$1" ;;
*) exec readlink -f "$1" ;;
esac

View File

@@ -46,7 +46,7 @@ copy_dir() {
chmod --reference="$1" "$2" chmod --reference="$1" "$2"
chown --reference="$1" "$2" chown --reference="$1" "$2"
mysize=$( getsize "$1" ) mysize=$( getsize "$1" )
TGT_ABS=$( readlink -f "$2" ) TGT_ABS=$( abs-path "$2" )
pushd "$1" &> /dev/null pushd "$1" &> /dev/null
tar -c "." | pv -s $mysize | tar -x --strip-components=1 -C "$TGT_ABS" tar -c "." | pv -s $mysize | tar -x --strip-components=1 -C "$TGT_ABS"
popd &> /dev/null popd &> /dev/null

View File

@@ -41,7 +41,7 @@ mkdir -p "$SAFELOC"
now=$( date -Idate ) now=$( date -Idate )
for d in "${FOLDERS[@]}"; do for d in "${FOLDERS[@]}"; do
if [[ ! -e "$d" ]]; then continue; fi if [[ ! -e "$d" ]]; then continue; fi
path=$( readlink -f "$d" ) path=$( abs-path "$d" )
dir=$( dirname "$path" ) dir=$( dirname "$path" )
if [[ "$VERBOSE" -eq 1 ]]; then echo "$SAFELOC/$now/$path"; fi if [[ "$VERBOSE" -eq 1 ]]; then echo "$SAFELOC/$now/$path"; fi
if [[ -e "$SAFELOC/$now/$path" ]]; then file-version $QUIET "$SAFELOC/$now/$path"; fi if [[ -e "$SAFELOC/$now/$path" ]]; then file-version $QUIET "$SAFELOC/$now/$path"; fi

View File

@@ -15,7 +15,7 @@ for f in "$@"; do
echo "$f" does not exist echo "$f" does not exist
continue continue
} }
d=$( readlink -nf $( dirname "$f" ) )/.rm_bg.$$ d=$( abs-path $( dirname "$f" ) )/.rm_bg.$$
mkdir -p "$d" mkdir -p "$d"
mv "$f" "$d"/ mv "$f" "$d"/
tempfolders+=( "$d" ) tempfolders+=( "$d" )

View File

@@ -92,7 +92,7 @@ for (( i=1; i<=$#; i++ )); do
[[ "${!i}" = "-h" ]] && _help [[ "${!i}" = "-h" ]] && _help
[[ "${!i}" = *"help" ]] && _help [[ "${!i}" = *"help" ]] && _help
done done
SELF=$( dirname $( readlink -f "$0" ) ) SELF=$( dirname $( abs-path "$0" ) )
[[ "$1" == build ]] && _build "$2" "$3" [[ "$1" == build ]] && _build "$2" "$3"
[[ "$1" == autobuild ]] && _autobuild "$2" "$3" [[ "$1" == autobuild ]] && _autobuild "$2" "$3"

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
_qColVersion() { echo Version 2018.12.23.0; } _qColVersion() { echo Version 2019.04.12.0; }
_qColHelp() { _qColHelp() {
_qColVersion _qColVersion