Initial shellrc commit.
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
MAP_FILE=".sync-map"
|
||||
|
||||
if [ ! -f "$MAP_FILE" ]; then
|
||||
echo "No .sync-map found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Syncing external files INTO repo..."
|
||||
|
||||
while IFS=: read -r src dest
|
||||
do
|
||||
eval source_file="$src"
|
||||
eval dest_file="$dest"
|
||||
# skip empty or comment lines
|
||||
[ -z "$source_file" ] && continue
|
||||
case "$source_file" in \#*) continue ;; esac
|
||||
|
||||
if [ ! -f "$source_file" ]; then
|
||||
echo "Missing external file: $source_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$dest_file")"
|
||||
cp "${source_file}" "$dest_file"
|
||||
|
||||
git add "$dest_file"
|
||||
echo "Copied + staged: $dest_file"
|
||||
done < "$MAP_FILE"
|
||||
|
||||
echo "Done syncing IN"
|
||||
Reference in New Issue
Block a user