Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the feed lock path configurable via cmake. #574

Merged
merged 2 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ if (NOT OPENVAS_RUN_DIR)
set (OPENVAS_RUN_DIR "${LOCALSTATEDIR}/run")
endif (NOT OPENVAS_RUN_DIR)

if (NOT OPENVAS_FEED_LOCK_PATH)
set (OPENVAS_FEED_LOCK_PATH "${OPENVAS_RUN_DIR}/feed-update.lock")
endif (NOT OPENVAS_FEED_LOCK_PATH)
add_definitions (-DOPENVAS_FEED_LOCK_PATH="${OPENVAS_FEED_LOCK_PATH}")

set (OPENVAS_DATA_DIR "${DATADIR}/openvas")
set (OPENVAS_STATE_DIR "${LOCALSTATEDIR}/lib/openvas")
if (NOT GVM_LOG_DIR)
Expand Down
10 changes: 5 additions & 5 deletions tools/greenbone-nvt-sync.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ PORT=24
OPENVAS_SYSCONF_DIR="@OPENVAS_SYSCONF_DIR@"

# Directory where the feed update lock file will be placed.
OPENVAS_RUN_DIR="@OPENVAS_RUN_DIR@"
OPENVAS_FEED_LOCK_PATH="@OPENVAS_FEED_LOCK_PATH@"

# Location of the GSF Access Key
ACCESS_KEY="@GVM_ACCESS_KEY_DIR@/gsf-access-key"
Expand Down Expand Up @@ -503,16 +503,16 @@ do_sync ()
log_write "Feed is already current, skipping synchronization."
else
(
chmod +660 $OPENVAS_RUN_DIR/feed-update.lock
chmod +660 $OPENVAS_FEED_LOCK_PATH
flock -n 9
if [ $? -eq 1 ] ; then
log_warning "Another process related to the feed update is already running"
exit 1
fi
date > $OPENVAS_RUN_DIR/feed-update.lock
date > $OPENVAS_FEED_LOCK_PATH
sync_nvts
echo -n $OPENVAS_RUN_DIR/feed-update.lock
)9>>$OPENVAS_RUN_DIR/feed-update.lock
echo -n $OPENVAS_FEED_LOCK_PATH
)9>>$OPENVAS_FEED_LOCK_PATH
fi
}

Expand Down