AutoYADM commit: 2024-11-10 00:55:29
This commit is contained in:
parent
ea855f14d6
commit
3ab9d12743
3 changed files with 20 additions and 7 deletions
|
@ -7,12 +7,22 @@
|
||||||
|
|
||||||
AYE="AutoYADM Error:"
|
AYE="AutoYADM Error:"
|
||||||
AYM="AutoYADM:"
|
AYM="AutoYADM:"
|
||||||
|
|
||||||
|
# We check not to overwrite the user's env setting
|
||||||
|
if [ -z "$VAR" ]; then
|
||||||
|
AUTOYADMPUSH=0
|
||||||
|
fi
|
||||||
|
|
||||||
# Set hostname explicitly because it
|
# Set hostname explicitly because it
|
||||||
# may not be present in this shell environment
|
# may not be present in this shell environment
|
||||||
HOST="$(hostname)"
|
if [ -z "$HOST" ]; then
|
||||||
|
HOST="$(hostname)"
|
||||||
|
fi
|
||||||
|
|
||||||
# First we read each path from "tracked"
|
# First we read each path from "tracked"
|
||||||
while read -r path; do
|
(while read -r path; do
|
||||||
|
# we disable ignored warning for this subshell
|
||||||
|
yadm config advice.addIgnoredFile false
|
||||||
# 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
|
||||||
|
@ -26,22 +36,23 @@ while read -r path; do
|
||||||
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) <"$HOME/.config/yadm/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"
|
||||||
|
|
||||||
if [[ -n $(yadm status --porcelain) ]]; then
|
if [[ -n $(yadm status --porcelain) ]]; then
|
||||||
yadm commit -m "AutoYADM commit: $(date +'%Y-%m-%d %H:%M:%S')"
|
yadm commit -m "AutoYADM commit: $(date +'%Y-%m-%d %H:%M:%S')"
|
||||||
# Check if the ssh-agent env exists
|
# Check if the ssh-agent env exists
|
||||||
if [ -f "$sshenv" ]; then
|
if [[ -f "$sshenv" ]]; then
|
||||||
|
if ((!AUTOYADMPUSH)); then
|
||||||
|
echo "$AYM Pushing disabled, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# Directive to suppress shellcheck warning
|
# Directive to suppress shellcheck warning
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "$sshenv"
|
source "$sshenv"
|
||||||
yadm push
|
yadm push
|
||||||
else
|
else
|
||||||
echo "Host value is: '$HOST'"
|
|
||||||
echo "Expected SSH env file path: $sshenv"
|
|
||||||
echo "$AYE ssh-agent environment not found, aborting push..."
|
echo "$AYE ssh-agent environment not found, aborting push..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[pull]
|
[pull]
|
||||||
rebase = false
|
rebase = false
|
||||||
|
[advice]
|
||||||
|
addIgnoredFile = false
|
||||||
|
|
0
.config/yadm/testingfile
Normal file
0
.config/yadm/testingfile
Normal file
Loading…
Add table
Add a link
Reference in a new issue