Skip to content

Commit

Permalink
core: rename DISTNAME to PLATFORM
Browse files Browse the repository at this point in the history
The DISTNAME contains a Bareos-specific short-name of the platform that
is built. As such it is not the DISTNAME itself, but the Bareos-specific
platform identifier.
This patch now renames DISTNAME to PLATFORM.
  • Loading branch information
arogge committed May 25, 2020
1 parent 2819106 commit 5b5aa28
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 67 deletions.
4 changes: 2 additions & 2 deletions core/CMakeLists.txt
Expand Up @@ -745,12 +745,12 @@ message(" ")
message("Configuration on ${NOW} : ")
message(" ")

message(" Host: ${host} -- ${DISTNAME} ${DISTVER} ")
message(" Host: ${host} -- ${PLATFORM} ${DISTVER} ")
message(
" Bareos version: ${BAREOS} ${BAREOS_FULL_VERSION} (${DATE}) "
)
message(
" Distribution: ${DISTNAME}"
" Build platform: ${PLATFORM}"
)
message(" Source code location: ${srcdir} ")
message(" Modify Debian Control file: ${GENERATE_DEBIAN_CONTROL} ")
Expand Down
2 changes: 1 addition & 1 deletion core/cmake/BareosGenerateDebianInfo.cmake
Expand Up @@ -45,7 +45,7 @@ if(GENERATE_DEBIAN_CONTROL)
DEBIAN_CONTROL_DIRECTOR_PYTHON_PLUGIN)
endif()

if(${DISTNAME} MATCHES "univention")
if(${PLATFORM} MATCHES "univention")
# only required for univention
file(READ ./debian/control.univention-bareos
DEBIAN_CONTROL_UNIVENTION_BAREOS)
Expand Down
7 changes: 2 additions & 5 deletions core/cmake/BareosGetDistInfo.cmake
Expand Up @@ -18,7 +18,7 @@
# 02110-1301, USA.

# get DIST info in format
# "$DISTNAME;$DISTVER"
# "$PLATFORM;$DISTVER"

execute_process(
COMMAND ${PROJECT_SOURCE_DIR}/cmake/distname.sh
Expand All @@ -30,11 +30,8 @@ set(DISTINFO ${DISTINFOTXT})

list(LENGTH DISTINFO DISTINFO_LENGTH)

list(GET DISTINFO 0 DISTNAME)
set(ENV{DISTNAME} ${DISTNAME})

list(GET DISTINFO 0 PLATFORM)
list(GET DISTINFO 1 DISTVER)
set(ENV{DISTVER} "${DISTVER}")

set(Host "${CMAKE_SYSTEM} ${LSB_RELEASE_DESCRIPTION}")
set(Distribution ${LSB_RELEASE_ID_SHORT})
90 changes: 45 additions & 45 deletions core/cmake/distname.sh
@@ -1,58 +1,58 @@
#!/bin/sh
# determine distname
# determine platform
# extracted from os.m4

if test "x$DISTNAME" != "x"
if test "x$PLATFORM" != "x"
then
echo "distname set to $DISTNAME"
echo "platform set to $PLATFORM"
else
which lsb_release > /dev/null 2>&1
if test $? = 0
then
LSB_DISTRIBUTOR=`lsb_release -i -s`
case ${LSB_DISTRIBUTOR} in
*SUSE*)
DISTNAME=suse
PLATFORM=suse
;;
CentOS)
DISTNAME=redhat
PLATFORM=redhat
;;
Fedora)
DISTNAME=redhat
PLATFORM=redhat
;;
RedHatEnterprise*)
DISTNAME=redhat
PLATFORM=redhat
;;
Oracle*)
DISTNAME=redhat
PLATFORM=redhat
;;
MandrivaLinux)
DISTNAME=mandrake
PLATFORM=mandrake
;;
Arch|archlinux|ManjaroLinux)
DISTNAME=archlinux
PLATFORM=archlinux
;;
LinuxMint)
DISTNAME=debian
PLATFORM=debian
;;
Debian)
DISTNAME=debian
PLATFORM=debian
;;
Ubuntu)
DISTNAME=ubuntu
PLATFORM=ubuntu
;;
Univention)
DISTNAME=univention
PLATFORM=univention
;;
*)
DISTNAME=""
PLATFORM=""
;;
esac

#
# If we got a valid DISTNAME get the DISTVER from lsb_release too.
# If we got a valid PLATFORM get the DISTVER from lsb_release too.
#
if test "x$DISTNAME" != "x"
if test "x$PLATFORM" != "x"
then
DISTVER=`lsb_release -d -s | sed -e 's/"//g'`
fi
Expand All @@ -61,115 +61,115 @@ else
#
# If lsb_release gave us the wanted info we skip this fallback block.
#
if test "x$DISTNAME" = "x" -o "x$DISTVER" = "x"
if test "x$PLATFORM" = "x" -o "x$DISTVER" = "x"
then
if test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
then
DISTNAME=alpha
PLATFORM=alpha
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xAIX
then
DISTNAME=aix
PLATFORM=aix
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
then
DISTNAME=hpux
PLATFORM=hpux
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
then
DISTNAME=solaris
PLATFORM=solaris
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xGNU
then
DISTNAME=hurd
PLATFORM=hurd
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
then
DISTNAME=freebsd
PLATFORM=freebsd
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
then
DISTNAME=netbsd
PLATFORM=netbsd
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
then
DISTNAME=openbsd
PLATFORM=openbsd
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xIRIX
then
DISTNAME=irix
PLATFORM=irix
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
then
DISTNAME=bsdi
PLATFORM=bsdi
DISTVER=`uname -a | awk '{print $3}'`
elif test -f /etc/SuSE-release
then
DISTNAME=suse
PLATFORM=suse
DISTVER=`cat /etc/SuSE-release | \
grep VERSION | \
cut -f3 -d' '`
elif test -d /etc/SuSEconfig
then
DISTNAME=suse
PLATFORM=suse
DISTVER=5.x
elif test -f /etc/mandrake-release
then
DISTNAME=mandrake
PLATFORM=mandrake
DISTVER=`cat /etc/mandrake-release | \
grep release | \
cut -f5 -d' '`
elif test -f /etc/fedora-release
then
DISTNAME=redhat
PLATFORM=redhat
DISTVER="`cat /etc/fedora-release | cut -d' ' -f1,3`"
elif test -f /etc/whitebox-release
then
DISTNAME=redhat
PLATFORM=redhat
DISTVER=`cat /etc/whitebox-release | grep release`
elif test -f /etc/redhat-release
then
DISTNAME=redhat
PLATFORM=redhat
DISTVER=`cat /etc/redhat-release | grep release`
elif test -f /etc/gentoo-release
then
DISTNAME=gentoo
PLATFORM=gentoo
DISTVER=`awk '/version / { print $5 }' < /etc/gentoo-release`
elif test -f /etc/debian_version
then
if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
DISTNAME=ubuntu
PLATFORM=ubuntu
else
DISTNAME=debian
PLATFORM=debian
fi
DISTVER=`cat /etc/debian_version`
elif test -f /etc/slackware-version
then
DISTNAME=slackware
PLATFORM=slackware
DISTVER=`cat /etc/slackware-version`
elif test x$host_vendor = xapple
then
DISTNAME=osx
PLATFORM=osx
DISTVER=`uname -r`
elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
then
DISTNAME=darwin
PLATFORM=darwin
DISTVER=`uname -r`
elif test -f /etc/engarde-version
then
DISTNAME=engarde
PLATFORM=engarde
DISTVER=`uname -r`
elif test -f /etc/arch-release
then
DISTNAME=archlinux
PLATFORM=archlinux
elif test "$CYGWIN" = yes
then
DISTNAME=cygwin
PLATFORM=cygwin
else
DISTNAME=unknown
PLATFORM=unknown
DISTVER=unknown
fi
fi
fi

echo "$DISTNAME;$DISTVER"
echo "$PLATFORM;$DISTVER"
16 changes: 8 additions & 8 deletions core/platforms/CMakeLists.txt
Expand Up @@ -20,21 +20,21 @@
if(NOT HAVE_WIN32)

message(STATUS "UNITDIR: " ${UNITDIR})
message(STATUS "DISTNAME: " ${DISTNAME})
message(STATUS "PLATFORM: " ${PLATFORM})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
if(${DISTNAME} STREQUAL ubuntu)
if(${PLATFORM} STREQUAL ubuntu)
add_subdirectory(debian)
elseif(${DISTNAME} STREQUAL univention)
elseif(${PLATFORM} STREQUAL univention)
message(STATUS "adding subdirectories debian and univention")
add_subdirectory(debian)
add_subdirectory(univention)
elseif(${DISTNAME} STREQUAL hpux)
message(STATUS "DISTNAME: " ${DISTNAME})
elseif(${DISTNAME} STREQUAL archlinux)
message(STATUS "DISTNAME: " ${DISTNAME})
elseif(${PLATFORM} STREQUAL hpux)
message(STATUS "PLATFORM: " ${PLATFORM})
elseif(${PLATFORM} STREQUAL archlinux)
message(STATUS "PLATFORM: " ${PLATFORM})
else()
add_subdirectory(${DISTNAME})
add_subdirectory(${PLATFORM})
endif()

if(${systemd})
Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/ua_cmds.cc
Expand Up @@ -2814,7 +2814,7 @@ static bool VersionCmd(UaContext* ua, const char* cmd)
"%s ");
ua->send->ObjectKeyValue("bdate", kBareosVersionStrings.Date, "(%s) ");
ua->send->ObjectKeyValue("operatingsystem", HOST_OS, "%s ");
ua->send->ObjectKeyValue("distname", DISTNAME, "%s ");
ua->send->ObjectKeyValue("distname", PLATFORM, "%s ");
ua->send->ObjectKeyValue("distversion", DISTVER, "%s ");
ua->send->ObjectKeyValue("CustomVersionId", NPRTB(me->verid), "%s\n");
ua->send->ObjectEnd("version");
Expand Down
2 changes: 1 addition & 1 deletion core/src/filed/dir_cmd.cc
Expand Up @@ -1005,7 +1005,7 @@ static bool job_cmd(JobControlRecord* jcr)
* uname and will update the client's catalog record with that value.
*/
return dir->fsend(OKjob, kBareosVersionStrings.Full,
kBareosVersionStrings.ShortDate, os_version, DISTNAME,
kBareosVersionStrings.ShortDate, os_version, PLATFORM,
DISTVER);
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/include/config.h.in
Expand Up @@ -36,7 +36,7 @@
# include "mingwconfig.h"
extern char win_os[];
# define HOST_OS "Linux"
# define DISTNAME "Cross-compile"
# define PLATFORM "Cross-compile"
# if defined(_WIN64)
# define DISTVER "Win64"
# else
Expand All @@ -47,7 +47,7 @@ extern char win_os[];
extern char WIN_VERSION_LONG[];
extern char WIN_VERSION[];
# define HOST_OS WIN_VERSION_LONG
# define DISTNAME "MVS"
# define PLATFORM "MVS"
# define DISTVER WIN_VERSION
# endif
#else
Expand Down Expand Up @@ -583,7 +583,7 @@ extern char WIN_VERSION[];
#cmakedefine PATH_BAREOS_WORKINGDIR @PATH_BAREOS_WORKINGDIR@

#define HOST_OS "@host@@post_host@"
#define DISTNAME "@DISTNAME@"
#define PLATFORM "@PLATFORM@"
#define DISTVER "@DISTVER@"

#endif /* defined(WIN32) */
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib/message.cc
Expand Up @@ -53,7 +53,7 @@ int debug_level = 0; /* debug level */
bool dbg_timestamp = false; /* print timestamp in debug output */
bool prt_kaboom = false; /* Print kaboom output */
utime_t daemon_start_time = 0; /* Daemon start time */
const char* dist_name = DISTNAME " " DISTVER;
const char* dist_name = PLATFORM " " DISTVER;
char my_name[128] = {0}; /* daemon name is stored here */
char host_name[256] = {0}; /* host machine name */
char* exepath = (char*)NULL;
Expand Down

0 comments on commit 5b5aa28

Please sign in to comment.