FreeBSD/sync-pxe.sh

22 lines
809 B
Bash
Raw Permalink Normal View History

2021-04-18 01:07:42 -07:00
#!/usr/local/bin/bash
2022-04-19 13:46:35 -07:00
# Copyright (c) 2018-2022, diyIT.org
2021-04-18 01:07:42 -07:00
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
diff -ru /mnt/ship/pxe pxe | grep -v "Only in /" | grep "Only in" | sed 's/Only in // ; s/: /\//' | xargs -n1 echo WILL DELETE
2021-05-06 15:19:21 -07:00
read -p "Delete (y/N)? " RESP
2021-04-18 01:07:42 -07:00
if [ ! -z $RESP ] && [ $RESP == "y" ]; then
diff -ru /mnt/ship/pxe pxe | grep -v "Only in /" | grep "Only in" | sed 's/Only in // ; s/: /\//' | xargs -n1 rm
fi
diff -ru /mnt/ship/pxe pxe | grep -v "Only in /" | grep "diff -ru" | sed 's/diff -ru//' | xargs -n2 echo WILL COPY
2021-05-06 15:19:21 -07:00
read -p "Copy (y/N)? " RESP
2021-04-18 01:07:42 -07:00
if [ ! -z $RESP ] && [ $RESP == "y" ]; then
diff -ru /mnt/ship/pxe pxe | grep -v "Only in /" | grep "diff -ru" | sed 's/diff -ru//' | xargs -n2 cp
fi