Initial shellrc commit.
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/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 "$dest_file" ]; then
|
||||
echo "Missing external file: $dest_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$(dirname "$source_file")" ]; then
|
||||
mkdir -p "$(dirname "$source_file")"
|
||||
fi
|
||||
cp "${dest_file}" "${source_file}"
|
||||
|
||||
echo "Restored: $dest_file"
|
||||
done < "$MAP_FILE"
|
||||
|
||||
echo "Done syncing OUT"
|
||||
Reference in New Issue
Block a user