File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3217,13 +3217,15 @@ confWireGuard() {
32173217 fi
32183218
32193219 if [[ -d /etc/wireguard ]]; then
3220- # Backup the wireguard folder
3221- WIREGUARD_BACKUP=" wireguard_$( date +%Y-%m-%d-%H%M%S) .tar.gz"
3222- echo " ::: Backing up the wireguard folder to /etc/${WIREGUARD_BACKUP} "
3223- CURRENT_UMASK=" $( umask) "
3224- umask 0077
3225- ${SUDO} tar -czf " /etc/${WIREGUARD_BACKUP} " /etc/wireguard & > /dev/null
3226- umask " ${CURRENT_UMASK} "
3220+ if [[ -n " $( ls -A /etc/wireguard) " ]]; then
3221+ # Backup the wireguard folder
3222+ WIREGUARD_BACKUP=" wireguard_$( date +%Y-%m-%d-%H%M%S) .tar.gz"
3223+ echo " ::: Backing up the wireguard folder to /etc/${WIREGUARD_BACKUP} "
3224+ CURRENT_UMASK=" $( umask) "
3225+ umask 0077
3226+ ${SUDO} tar -czf " /etc/${WIREGUARD_BACKUP} " /etc/wireguard & > /dev/null
3227+ umask " ${CURRENT_UMASK} "
3228+ fi
32273229
32283230 if [[ -f /etc/wireguard/wg0.conf ]]; then
32293231 ${SUDO} rm /etc/wireguard/wg0.conf
You can’t perform that action at this time.
0 commit comments