Adds secret loading

This commit is contained in:
Michel Fedde 2025-09-27 15:15:30 +02:00
parent cbf899eb40
commit 63fcd502a8
5 changed files with 81 additions and 30 deletions

View file

@ -1,28 +1,32 @@
#!/bin/env sh
foundSymlinks=false
handleYadmSymlinks() {
foundSymlinks=false
for file in $(yadm diff --name-only --cached); do
lsResult=$(ls -1 -l "$file")
if [[ $lsResult != *"->"* ]]; then
continue
for file in $(yadm diff --name-only --cached); do
lsResult=$(ls -1 -l "$file")
if [[ $lsResult != *"->"* ]]; then
continue
fi
symlinkTarget=$(echo "$lsResult" | awk '{print $NF}')
if [[ $lsResult != *"##"* ]]; then
continue
fi
echo "$file is a YADM symlink. Telling git to ignore it..."
yadm restore --staged "$file"
echo "$file" >>~/.gitignore
foundSymlinks=true
done
if [ $foundSymlinks ]; then
echo "Symlinks found. Adding .gitignore to commit..."
yadm add ~/.gitignore
fi
}
symlinkTarget=$(echo "$lsResult" | awk '{print $NF}')
if [[ $lsResult != *"##"* ]]; then
continue
fi
echo "$file is a YADM symlink. Telling git to ignore it..."
yadm restore --staged "$file"
echo "$file" >>~/.gitignore
foundSymlinks=true
done
if [ $foundSymlinks ]; then
echo "Symlinks found. Adding .gitignore to commit..."
yadm add ~/.gitignore
fi
handleYadmSymlinks