I made this script to backup my systems and On Fbsd it is not copying over certian conf files leaving them empty. how to fix that, anyone?
using sudo for root permissions still does not work.
hcsecd.conf is the one that is not being copied over properly (for now).
Code:
#!/usr/bin/env bash
if [[ -f /etc/slackware-version ]] ; then
distroname=$(sed 's/Slackware /Slackware-/' /etc/slackware-version)
elif [[ "FreeBSD" =~ "$( awk 'NR==1{print $1}' /etc/*release | cut -d = -f2 | xargs)" ]] ; then
distroname="$(uname -a | awk '{print $1 "-" $3}')"
else
distroname=$( awk 'NR==1{print $1}' /etc/*release | cut -d = -f2 | xargs)
fi
sorce="$HOME"
dest="/media/storage/HomeBackUps/$distroname/"
if [[ -d /media/storage ]] ; then
mkdir -pv "$dest"
else
echo "directory /media/storage not present .. exiting..."
exit
fi
echo "$distroname
$dest"
if [[ "$distroname" =~ "FreeBSD" ]] ; then
mkdir -p $dest
mkdir -p $dest/boot
sudo cp -v /boot/loader.conf $dest/boot
sudo cp -v /boot/device.hints /$dest/boot
mkdir -p $dest/etc
sudo cp -v /etc/rc.conf $dest/etc
sudo cp -v /etc/sysctl.conf $dest/etc
mkdir -p $dest/usr/local/etc
sudo cp -v /usr/local/etc/sudoers $dest/usr/local/etc
mkdir -pv $dest/etc/bluetooth
sudo cp -v /etc/bluetooth/hcsecd.conf $dest/etc/bluetooth
sudo cp -v /etc/bluetooth/hosts $dest/etc/bluetooth
fi
rsync -a --info=progress --exclude="lost+found" --exclude=".cache" --exclude="snap" --exclude=".dbus" "$sorce" "$dest"
hcsecd.conf is the one that is not being copied over properly (for now).