Fix another annoying buildsys issue; add mini-setup script as a n aid to dev & testing

This commit is contained in:
Brian Cox 2019-09-20 05:58:34 +00:00
parent 1ca2b86ed1
commit e4a1a1666d
6 changed files with 83 additions and 3 deletions

72
mini-setup.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/sh
# Configures a minimal OST setup in the build directory, as a dev/test aid.
# This script isn't meant for use in production, and intentionally uses
# terrible hardcoded passphrases to try to discourage that.
cp src/mini-setup/twcfg.txt bin/twcfg.txt
cp src/mini-setup/twpol.txt bin/twpol.txt
chdir bin
if [ ! -f "l" ] || [ ! -f "s" ]; then
echo "***** Generating Keys *****"
if ./twadmin --generate-keys --site-keyfile s --local-keyfile l --site-passphrase s --local-passphrase l --verbose
then
echo "***** Keys Generated *****"
else
echo "***** Key Generation Failed *****"
exit 1
fi
else
echo "***** Keys already generated, skipping this step *****"
fi
if [ ! -f "tw.cfg" ]; then
echo "***** Creating Config File *****"
if ./twadmin --create-cfgfile --site-keyfile s --site-passphrase s --verbose --cfgfile ./tw.cfg ./twcfg.txt
then
echo "***** Config File Created *****"
else
echo "***** Config File Creation Failed *****"
exit 1
fi
else
echo "***** Config file already exists, skipping this step *****"
fi
if [ ! -f "test.pol" ]; then
echo "***** Creating Policy File *****"
if ./twadmin --create-polfile --site-passphrase s --verbose --cfgfile ./tw.cfg ./twpol.txt
then
echo "***** Policy File Created *****"
else
echo "***** Policy File Creation Failed *****"
exit 1
fi
else
echo "***** Policy file already exists, skipping this step *****"
fi
if [ ! -d "/tmp/tw-test" ]; then
mkdir /tmp/tw-test
fi
if [ ! -f "test.twd" ]; then
echo "***** Initializing Database *****"
if ./tripwire --init --local-passphrase l --verbose --cfgfile ./tw.cfg
then
echo "***** Database Initialized *****"
else
echo "***** Database Initialization Failed *****"
exit 1
fi
else
echo "***** Database already initialized, skipping this step *****"
fi
touch /tmp/tw-test/hello.txt
echo "***** Running a Check *****"
./tripwire --check --verbose --cfgfile ./tw.cfg
echo "***** Setup Completed *****"

View File

@ -51,7 +51,7 @@
#if defined(__VXWORKS__) || defined(__vxworks)
#undef HAVE__EXIT
#undef HAVE_CHOWN
#undef HAVE_EXEC
#undef HAVE_EXECVE
#undef HAVE_FORK
#undef HAVE_GETHOSTID
#undef HAVE_GETUID

View File

@ -99,7 +99,7 @@
#define setgid(x) sleep(0)
#endif
#if SUPPORTS_POSIX_FORK_EXEC
#if USES_MSYSTEM
/*
* signal type
*/

View File

@ -370,7 +370,7 @@
# define WCHAR_IS_32_BITS IS_UNIX
# define WCHAR_REP_IS_UCS2 IS_WIN32
# define SUPPORTS_POSIX_FORK_EXEC (HAVE_FORK && HAVE_EXEC)
# define SUPPORTS_POSIX_FORK_EXEC (HAVE_FORK && HAVE_EXECVE)
// msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why.
// TODO: Figure out why.
# define USES_MPOPEN (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE)

6
src/mini-setup/twcfg.txt Normal file
View File

@ -0,0 +1,6 @@
SITEKEYFILE=s
LOCALKEYFILE=l
POLFILE=test.pol
DBFILE=test.twd
REPORTFILE=test.twr

2
src/mini-setup/twpol.txt Normal file
View File

@ -0,0 +1,2 @@
/tmp/tw-test -> $(IgnoreNone);