check file before copying

master
bedefaced 9 years ago committed by bedefaced
parent fdbd9899e1
commit 89a5584631
  1. 14
      ipsec/backup.sh
  2. 6
      pptp/backup.sh

@ -128,26 +128,40 @@ fi
# restore files
echo -e "echo \"Restoring configs...\"" >>$UNINSTALL_SCRIPT
if [[ -n "$(which pppd)" ]]; then
if [ -e "$DIR/options.xl2tpd" ]; then
echo -e "cp -i \"\$DIR/options.xl2tpd\" $PPPCONFIG" >>$UNINSTALL_SCRIPT
fi
if [ -e "$DIR/chap-secrets" ]; then
echo -e "cp -i \"\$DIR/chap-secrets\" $CHAPSECRETS" >>$UNINSTALL_SCRIPT
fi
fi
if [[ -n "$(which xl2tpd)" ]]; then
if [ -e "$DIR/xl2tpd.conf" ]; then
echo -e "cp -i \"\$DIR/xl2tpd.conf\" $XL2TPDCONFIG" >>$UNINSTALL_SCRIPT
fi
fi
if [ "$PLATFORM" == "$CENTOSPLATFORM" ]; then
if [[ -n "$(which strongswan)" ]]; then
if [ -e "$DIR/ipsec.secrets" ]; then
echo -e "cp -i \"\$DIR/ipsec.secrets\" $SECRETSFILE" >>$UNINSTALL_SCRIPT
fi
if [ -e "$DIR/ipsec.conf" ]; then
echo -e "cp -i \"\$DIR/ipsec.conf\" $IPSECCONFIG" >>$UNINSTALL_SCRIPT
fi
fi
fi
if [ "$PLATFORM" == "$DEBIANPLATFORM" ]; then
if [[ -n "$(which ipsec)" ]]; then
if [ -e "$DIR/ipsec.secrets" ]; then
echo -e "cp -i \"\$DIR/ipsec.secrets\" $SECRETSFILE" >>$UNINSTALL_SCRIPT
fi
if [ -e "$DIR/ipsec.conf" ]; then
echo -e "cp -i \"\$DIR/ipsec.conf\" $IPSECCONFIG" >>$UNINSTALL_SCRIPT
fi
fi
fi
# restore xl2tpd if necessary
if [ "$(systemctl status xl2tpd; echo $?)" == "0" ]; then

@ -115,12 +115,18 @@ fi
# restore files
echo -e "echo \"Restoring configs...\"" >>$UNINSTALL_SCRIPT
if [[ -n "$(which pptpd)" ]]; then
if [ -e "$DIR/pptpd.conf" ]; then
echo -e "cp -i \"\$DIR/pptpd.conf\" $PPTPDCONFIG" >>$UNINSTALL_SCRIPT
fi
fi
if [[ -n "$(which pppd)" ]]; then
if [ -e "$DIR/options.pptp" ]; then
echo -e "cp -i \"\$DIR/options.pptp\" $PPTPOPTIONS" >>$UNINSTALL_SCRIPT
fi
if [ -e "$DIR/chap-secrets" ]; then
echo -e "cp -i \"\$DIR/chap-secrets\" $CHAPSECRETS" >>$UNINSTALL_SCRIPT
fi
fi
# restore pptpd if necessary
if [ "$(systemctl status pptpd; echo $?)" == "0" ]; then

Loading…
Cancel
Save