Update AUTOYADMDIR to account for any location of the scripts
This commit is contained in:
parent
caf575e3ad
commit
7656a53bdf
2 changed files with 11 additions and 6 deletions
|
@ -7,6 +7,9 @@
|
||||||
|
|
||||||
AYE="AutoYADM Error:"
|
AYE="AutoYADM Error:"
|
||||||
AYM="AutoYADM:"
|
AYM="AutoYADM:"
|
||||||
|
# We get the absolute path to the script's parent directory.
|
||||||
|
AUTOYADMDIR="script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
# We check not to overwrite the user's env setting
|
# We check not to overwrite the user's env setting
|
||||||
if [ -z "$VAR" ]; then
|
if [ -z "$VAR" ]; then
|
||||||
AUTOYADMPUSH=0
|
AUTOYADMPUSH=0
|
||||||
|
@ -19,8 +22,8 @@ if [ -z "$HOST" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# First we read each path from "tracked"
|
# First we read each path from "tracked"
|
||||||
(while read -r path; do
|
(while read -r relpath; do
|
||||||
# we disable ignored warning for this subshell
|
path="$HOME/$relpath"
|
||||||
# Execute yadm add on each real file
|
# Execute yadm add on each real file
|
||||||
# if the path points to a directory
|
# if the path points to a directory
|
||||||
# This ensures symlinks are not added
|
# This ensures symlinks are not added
|
||||||
|
@ -34,7 +37,7 @@ fi
|
||||||
echo "$AYE Target must be a directory or a file!"
|
echo "$AYE Target must be a directory or a file!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done) <"$HOME/.config/yadm/tracked"
|
done) <"$AUTOYADMDIR/tracked"
|
||||||
|
|
||||||
# Define the location of the ssh-agent environment
|
# Define the location of the ssh-agent environment
|
||||||
sshenv="$HOME/.ssh/environment-$HOST"
|
sshenv="$HOME/.ssh/environment-$HOST"
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
# arguments and appends them to the "tracked"
|
# arguments and appends them to the "tracked"
|
||||||
# file, for use by autoyadm.sh
|
# file, for use by autoyadm.sh
|
||||||
|
|
||||||
YADMDIR="$HOME/.config/yadm"
|
# We get the absolute path to the script's parent directory.
|
||||||
|
AUTOYADMDIR="script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
AYE="AutoYADM Error:"
|
AYE="AutoYADM Error:"
|
||||||
AYM="AutoYADM:"
|
AYM="AutoYADM:"
|
||||||
|
|
||||||
|
@ -28,8 +30,8 @@ for arg in "$@"; do
|
||||||
# convert to path relative to ~
|
# convert to path relative to ~
|
||||||
rel=${abs#"$HOME/"}
|
rel=${abs#"$HOME/"}
|
||||||
# append to tracked file
|
# append to tracked file
|
||||||
echo "$HOME/$rel" >>"$YADMDIR/tracked"
|
echo "$rel" >>"$AUTOYADMDIR/tracked"
|
||||||
echo "$AYM Tracking $HOME/$rel"
|
echo "$AYM Tracking $HOME/$rel as '$rel'"
|
||||||
else
|
else
|
||||||
echo "$AYM Path must be inside the home directory."
|
echo "$AYM Path must be inside the home directory."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue