Skip to content

Commit

Permalink
Cleanup, rename and packaging fix (Windows Codes) (netdata#18455)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoftsm authored Sep 4, 2024
1 parent 11dd085 commit 6dda70f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 77 deletions.
88 changes: 15 additions & 73 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,10 @@ set(CLAIM_PLUGIN_FILES
)

set(CLAIM_WINDOWS_FILES
src/claim/netdata_claim.c
src/claim/netdata_claim.h
src/claim/netdata_claim_window.c
src/claim/netdata_claim_window.h
src/claim/main.c
src/claim/main.h
src/claim/ui.c
src/claim/ui.h
)

set(ACLK_ALWAYS_BUILD
Expand Down Expand Up @@ -2262,8 +2262,9 @@ add_executable(netdata
)

if(OS_WINDOWS)
add_executable(netdata_claim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
target_link_libraries(netdata_claim shell32;gdi32;msftedit)
add_executable(NetdataClaim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
target_link_libraries(NetdataClaim shell32;gdi32;msftedit)
target_compile_options(NetdataClaim PUBLIC -mwindows)
endif()

target_compile_definitions(netdata PRIVATE
Expand Down Expand Up @@ -2448,15 +2449,15 @@ set(varlibdir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
set(netdata_user_POST "${NETDATA_USER}")
set(netdata_group_POST "${NETDATA_USER}")

configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
install(PROGRAMS
${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
COMPONENT netdata
DESTINATION "${BINDIR}")

if(OS_WINDOWS)
if(NOT OS_WINDOWS)
configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
install(PROGRAMS
${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
COMPONENT netdata
DESTINATION "${BINDIR}")
else()
install(PROGRAMS
${CMAKE_BINARY_DIR}/netdata_claim.exe
${CMAKE_BINARY_DIR}/NetdataClaim.exe
COMPONENT netdata
DESTINATION "${BINDIR}")
endif()
Expand Down Expand Up @@ -3013,65 +3014,6 @@ if(NOT OS_WINDOWS)
endif()

if(OS_WINDOWS)
install(FILES /usr/bin/awk.exe
/usr/bin/bash.exe
/usr/bin/cat.exe
/usr/bin/chown.exe
/usr/bin/curl.exe
/usr/bin/env.exe
/usr/bin/grep.exe
/usr/bin/mkdir.exe
/usr/bin/openssl.exe
/usr/bin/rm.exe
/usr/bin/sed.exe
/usr/bin/sh.exe
/usr/bin/tail.exe
/usr/bin/tr.exe
/usr/bin/uuidgen.exe
/usr/bin/whoami.exe
DESTINATION "${BINDIR}")

install(FILES /usr/bin/msys-2.0.dll
/usr/bin/msys-asn1-8.dll
/usr/bin/msys-brotlicommon-1.dll
/usr/bin/msys-brotlidec-1.dll
/usr/bin/msys-brotlienc-1.dll
/usr/bin/msys-com_err-1.dll
/usr/bin/msys-crypt-2.dll
/usr/bin/msys-crypto-3.dll
/usr/bin/msys-curl-4.dll
/usr/bin/msys-gcc_s-seh-1.dll
/usr/bin/msys-gmp-10.dll
/usr/bin/msys-gssapi-3.dll
/usr/bin/msys-hcrypto-4.dll
/usr/bin/msys-heimbase-1.dll
/usr/bin/msys-heimntlm-0.dll
/usr/bin/msys-hx509-5.dll
/usr/bin/msys-iconv-2.dll
/usr/bin/msys-idn2-0.dll
/usr/bin/msys-intl-8.dll
/usr/bin/msys-krb5-26.dll
/usr/bin/msys-lz4-1.dll
/usr/bin/msys-mpfr-6.dll
/usr/bin/msys-ncursesw6.dll
/usr/bin/msys-nghttp2-14.dll
/usr/bin/msys-pcre-1.dll
/usr/bin/msys-protobuf-32.dll
/usr/bin/msys-psl-5.dll
/usr/bin/msys-readline8.dll
/usr/bin/msys-roken-18.dll
/usr/bin/msys-sqlite3-0.dll
/usr/bin/msys-ssh2-1.dll
/usr/bin/msys-ssl-3.dll
/usr/bin/msys-stdc++-6.dll
/usr/bin/msys-unistring-5.dll
/usr/bin/msys-uuid-1.dll
/usr/bin/msys-uv-1.dll
/usr/bin/msys-wind-0.dll
/usr/bin/msys-z.dll
/usr/bin/msys-zstd-1.dll
DESTINATION "${BINDIR}")

# Make bash & netdata happy
install(DIRECTORY DESTINATION tmp)

Expand Down
2 changes: 1 addition & 1 deletion packaging/windows/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Function NetdataConfigLeave

${If} $0 == 135
${AndIf} $1 >= 36
nsExec::ExecToLog '$INSTDIR\usr\bin\netdata_claim.exe /T $cloudToken /R $cloudRooms /P $proxy /I $insecure'
nsExec::ExecToLog '$INSTDIR\usr\bin\NetdataClaim.exe /T $cloudToken /R $cloudRooms /P $proxy /I $insecure'
pop $0
${Else}
MessageBox MB_OK "The Cloud information does not have the expected length."
Expand Down
10 changes: 10 additions & 0 deletions packaging/windows/package-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ fi

set -exu -o pipefail

# Regenerate keys everytime there is an update
if [ -d /opt/netdata/etc/pki/ ]; then
rm -rf /opt/netdata/etc/pki/
fi

# Remove previous installation of msys2 script
if [ -f /opt/netdata/usr/bin/bashbug ]; then
rm -rf /opt/netdata/usr/bin/bashbug
fi

${GITHUB_ACTIONS+echo "::group::Installing"}
cmake --install "${build}"
${GITHUB_ACTIONS+echo "::endgroup::"}
Expand Down
2 changes: 1 addition & 1 deletion src/claim/netdata_claim.c → src/claim/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <string.h>
#include <signal.h>

#include "netdata_claim.h"
#include "main.h"

LPWSTR token = NULL;
LPWSTR room = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/claim/netdata_claim.h → src/claim/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# define NETDATA_CLAIM_H_ 1

#include <wchar.h>
#include "netdata_claim_window.h"
#include "ui.h"

extern LPWSTR token;
extern LPWSTR room;
Expand Down
2 changes: 1 addition & 1 deletion src/claim/netdata_claim_window.c → src/claim/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <windows.h>
#include "richedit.h"
#include "tchar.h"
#include "netdata_claim.h"
#include "main.h"

static LPCTSTR szWindowClass = _T("DesktopApp");

Expand Down
File renamed without changes.

0 comments on commit 6dda70f

Please sign in to comment.