diff --git a/comms/aprsd/Makefile b/comms/aprsd/Makefile index 8b7e952c32ac..5a8f8937dd3c 100644 --- a/comms/aprsd/Makefile +++ b/comms/aprsd/Makefile @@ -1,57 +1,56 @@ PORTNAME= aprsd PORTVERSION= 2.2.515 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= comms hamradio MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/2.2.5-15 DISTNAME= aprsd-2.2.5-15 MAINTAINER= hamradio@FreeBSD.org COMMENT= Server daemon providing Internet access to APRS packet data WWW= https://sourceforge.net/projects/aprsd/ LICENSE= GPLv2 USE_CXXSTD= c++14 USE_RC_SUBR= aprsd GNU_CONFIGURE= yes SUB_FILES= pkg-message SUB_LIST= APRSD_RC_USER=${APRSD_RC_USER} \ APRSD_RC_GROUP=${APRSD_RC_GROUP} USERS= aprsd tnc GROUPS= aprsd dialer tnc APRSD_RC_USER= aprsd APRSD_RC_GROUP= aprsd OPTIONS_DEFINE= DOCS EXAMPLES post-patch: ${REINPLACE_CMD} -e 's|%%CONFPATH%%|${PREFIX}/etc/aprsd/|' \ -e 's|%%LOGPATH%%|/var/log/aprsd/|' \ ${WRKSRC}/src/aprsd.cpp ${REINPLACE_CMD} -e 's|%%LOGPATH%%|/var/log/aprsd/|' \ ${WRKSRC}/src/utils.cpp pre-install: ${MKDIR} ${STAGEDIR}${PREFIX}/etc/aprsd ${MKDIR} ${STAGEDIR}"/var/log/aprsd" post-install: - @cd ${WRKSRC}/admin .for f in INIT.TNC RESTORE.TNC aprsd.conf welcome.txt user.deny ${INSTALL_DATA} ${WRKSRC}/admin/$f ${STAGEDIR}${PREFIX}/etc/aprsd/$f.samp .endfor post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} ${CP} ${WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR} post-install-EXAMPLES-on: ${MKDIR} ${STAGEDIR}${EXAMPLESDIR} .for f in chkaprsd udp_example ${INSTALL_DATA} ${WRKSRC}/admin/$f ${STAGEDIR}${EXAMPLESDIR} .endfor .include diff --git a/comms/aprsd/files/patch-src_aprsd.cpp b/comms/aprsd/files/patch-src_aprsd.cpp index 8e4e26aa3830..51e2522345eb 100644 --- a/comms/aprsd/files/patch-src_aprsd.cpp +++ b/comms/aprsd/files/patch-src_aprsd.cpp @@ -1,41 +1,41 @@ --- src/aprsd.cpp.orig 2003-05-29 03:09:39 UTC +++ src/aprsd.cpp @@ -98,7 +98,8 @@ string szAprsPath; int msgsn; const string HOMEDIR("/home/aprsd2"); -const string CONFPATH(""); -+const string LOGPATH("/var/log/aprsd/"); -+const string CONFPATH("/usr/local/etc/aprsd/"); ++const string LOGPATH("%%LOGPATH%%"); ++const string CONFPATH("%%CONFPATH%%"); const string CONFFILE("aprsd.conf"); const string MAINLOG("aprsd.log"); const string STSMLOG("thirdparty.log"); @@ -126,7 +127,7 @@ void serverQuit(void) /* Invoked by console 'q' q WriteLog(string("Server Shutdown"), MAINLOG); tcsetattr(fileno(stdin),TCSANOW,&initial_settings); //restore terminal mode - string outFile = CONFPATH; + string outFile = LOGPATH; outFile += SAVE_HISTORY; int n = SaveHistory(outFile); @@ -872,8 +873,8 @@ int daemonInit(void) if (f.is_open()) { f.read(s, 10); xx = atoi(s); - kill(xx, SIGCHLD); // Meaningless kill to determine if pid is used - if (errno != ESRCH) { + kill(xx, 0); // Meaningless kill to determine if pid is used + if (errno == 0) { cout << "aprsd already running" << endl; cout << "PID: " << pid_file << endl; exit(1); @@ -977,7 +978,7 @@ int main(int argc, char *argv[]) //fdump = fopen("dump.txt","w+"); //debug - string histFile = CONFPATH; + string histFile = LOGPATH; histFile += SAVE_HISTORY; ReadHistory(histFile); diff --git a/comms/aprsd/files/patch-src_utils.cpp b/comms/aprsd/files/patch-src_utils.cpp index 05a5df9f834c..caab94eea28d 100644 --- a/comms/aprsd/files/patch-src_utils.cpp +++ b/comms/aprsd/files/patch-src_utils.cpp @@ -1,36 +1,36 @@ --- src/utils.cpp.orig 2003-10-01 16:58:27 UTC +++ src/utils.cpp @@ -41,6 +41,7 @@ int CountDefault = 7; //Max of 7 instances of one static RecursiveMutex pmtxLog; -+const string LOGPATH("/var/log/aprsd/"); ++const string LOGPATH("%%LOGPATH%%"); int WriteLog(const string& sp, const string& LogFile) { @@ -50,11 +51,12 @@ int WriteLog(const string& sp, const string& LogFile) static Lock locker(pmtxLog, false); locker.get(); + string pLogFile = LOGPATH + LogFile; - ofstream ofs(LogFile.c_str(), ios::out | ios::app); + ofstream ofs(pLogFile.c_str(), ios::out | ios::app); if (!ofs) - cerr << "File I/O Error: Unable to open/create file " << LogFile << endl; + cerr << "File I/O Error: Unable to open/create file " << pLogFile << endl; time(<ime); // Timestamp ctime_r(<ime, szTime); // "threadsafe" ctime @@ -91,8 +93,8 @@ int WriteLog(const char* pch, const char* LogFile) pthread_mutex_lock(pmtxLog); - char* pLogFile = new char[CONFPATH.length() + strlen(LogFile) +1]; - strcpy(pLogFile,CONFPATH.c_str()); + char* pLogFile = new char[LOGPATH.length() + strlen(LogFile) +1]; + strcpy(pLogFile,LOGPATH.c_str()); strcat(pLogFile, LogFile); f = fopen(pLogFile, "a");