Added Step that create parent dir in symlinking.
This commit is contained in:
parent
4c05d89590
commit
5b81a2827b
|
@ -1,17 +1,23 @@
|
||||||
#! env zsh
|
#! env zsh
|
||||||
# -*- sh -*-
|
# -*- sh -*-
|
||||||
|
|
||||||
REPORT=`dirname $0`/report
|
REPORT="`dirname $0`/report"
|
||||||
|
|
||||||
if [ -z "$1" ] || [ -z "$2" ] ; then
|
if [ -z "$1" ] || [ -z "$2" ] ; then
|
||||||
$REPORT error "ERROR: Both to and from string must be defined.\n source: $1 \n symlnk: $2"
|
"$REPORT" error "ERROR: Both to and from string must be defined.\n source: $1 \n symlnk: $2"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $2 ]] ; then
|
if [[ -e $2 ]] ; then
|
||||||
$REPORT warn "$2 already exist. Skipping."
|
"$REPORT" info "$2 already exist. Skipping."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$REPORT info "Symlinked `ln -svf $1 $2`"
|
parent=$(dirname "$2")
|
||||||
|
if [[ ! -e $parent ]] ; then
|
||||||
|
"$REPORT" warn "$parent doesn't exist. Creating."
|
||||||
|
mkdir -p $parent
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$REPORT" info "Symlinked `ln -svf $1 $2`"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user