Catching up with current dev
This commit is contained in:
18
bin/reverse-copy
Normal file
18
bin/reverse-copy
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
if [ "$USER" != root ]; then
|
||||
sudo $0 $@
|
||||
exit 0
|
||||
fi
|
||||
|
||||
grep -A 2 copy: tasks/main.yml | tr '\n' ' ' | sed 's/--/\n/g' | while read copyline; do
|
||||
dest="$(echo "$copyline" | sed 's/ /\n/g' | grep src: | awk '{ print $2; }' )"
|
||||
src="$(echo "$copyline" | sed 's/ /\n/g' | grep dest: | awk '{ print $2; }' )"
|
||||
if [ -d "$src" ]; then
|
||||
cp -r "$src"/* files/"$dest"
|
||||
else
|
||||
cp -r "$src" files/"$dest"
|
||||
fi
|
||||
chown -R "$SUDO_USER": files/"$dest"
|
||||
done
|
Reference in New Issue
Block a user