check file before copying

This commit is contained in:
bedefaced 2017-08-30 14:11:51 +03:00 committed by bedefaced
parent fdbd9899e1
commit 89a5584631
2 changed files with 30 additions and 10 deletions

View File

@ -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

View File

@ -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