. /usr/syno/bin/jsoncmd

SYNOVPN_CONFIG_DIR="${SYNOPKG_PKGPATH}/etc"
UPDATER_BIN="${SYNOPKG_PKGPATH}/target/bin/vpn_updater"

importPath=$(jget "${SYNOPKG_BKP_INPUT}" ".temp_path")
if [ $? -ne 0 ]; then
	jerr "Failed to get import path"
	exit 1
fi

if [ -d "${importPath}" ]; then
	cp -rf ${importPath}/* ${SYNOVPN_CONFIG_DIR}
fi

if [ -e ${UPDATER_BIN} ]; then
	${UPDATER_BIN} -v ${SYNOPKG_PKGVER_ORG}
fi

jout_begin
joutstr "app_data_version" "1.0"
jout_end

exit 0
