-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup, updated license and dependencies (#4)
* License, cleanup, updated dependencies * Added CI build for Linux and FreeBSD, both for arm and amd64 * Fix for insecure strncpy * Increased version number
- Loading branch information
1 parent
480ef8f
commit 83e9d2a
Showing
25 changed files
with
527 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Multi-platform build | ||
|
||
on: | ||
push: | ||
branches: master | ||
tags: "*" | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
build-linux: | ||
uses: ./.github/workflows/linux.yml | ||
secrets: inherit | ||
build-freebsd: | ||
uses: ./.github/workflows/freebsd.yml | ||
secrets: inherit | ||
finalize: | ||
runs-on: ubuntu-22.04 | ||
needs: [build-linux, build-freebsd] | ||
steps: | ||
- name: Download artifact - FreeBSD x86-64 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: n2os_smb_client.bsd_x86-64 | ||
path: bin/ | ||
- name: Download artifact - FreeBSD arm64 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: n2os_smb_client.bsd_arm64 | ||
path: bin/ | ||
- name: Download artifact - Linux x86-64 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: n2os_smb_client.linux_x86-64 | ||
path: bin/ | ||
- name: Download artifact - Linux arm64 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: n2os_smb_client.linux_arm64 | ||
path: bin/ | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | ||
with: | ||
files: | | ||
bin/n2os_smb_client.bsd | ||
bin/n2os_smb_client.bsd_arm64 | ||
bin/n2os_smb_client.linux | ||
bin/n2os_smb_client.linux_arm64 | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: FreeBSD build | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
freebsdbuild: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-22.04 | ||
name: Build on FreeBSD | ||
strategy: | ||
matrix: | ||
arch: [x86-64, arm64] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Cross Platform Action | ||
uses: cross-platform-actions/action@v0.21.1 | ||
with: | ||
operating_system: freebsd | ||
version: "13.2" | ||
shell: bash | ||
sync_files: true | ||
architecture: ${{ matrix.arch }} | ||
run: | | ||
sudo pkg install -y cmake | ||
./build.bsd.sh | ||
- name: Store executable | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "n2os_smb_client.bsd_${{ matrix.arch }}" | ||
path: bin/n2os_smb_client.bsd* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Linux build | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
env: | ||
IMG_TAG: smblinux-builder:latest | ||
|
||
jobs: | ||
linuxsetup: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-22.04 | ||
name: Build on Linux | ||
strategy: | ||
matrix: | ||
arch: | ||
- name: x86-64 | ||
platform: linux/amd64 | ||
bin_name: n2os_smb_client.linux | ||
artifact: n2os_smb_client.linux_x86-64 | ||
env_arm: "" | ||
- name: arm64 | ||
platform: linux/arm64 | ||
bin_name: n2os_smb_client.linux_arm64 | ||
artifact: n2os_smb_client.linux_arm64 | ||
env_arm: "1" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: ${{ matrix.arch.platform }} | ||
- name: Build and export to Docker | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.arch.platform }} | ||
file: ./Dockerfile.linux | ||
target: builder | ||
load: true | ||
push: false | ||
tags: ${{ env.IMG_TAG }} | ||
build-args: ENV_ARM=${{ matrix.arch.env_arm }} | ||
- name: Fetch executable from the container | ||
run: | | ||
docker run --platform ${{ matrix.arch.platform }} --rm --volume "${PWD}/bin:/artifacts" ${{ env.IMG_TAG }} cp /usr/src/n2os-smb-client/bin/${{ matrix.arch.bin_name }} /artifacts | ||
- name: Store executable | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.arch.artifact }} | ||
path: bin/${{ matrix.arch.bin_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
cmake-build* | ||
cmake-build* | ||
bin/ | ||
.vscode | ||
build/ | ||
.cache/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"code-block-style": { | ||
"style": "fenced" | ||
}, | ||
"code-fence-style": { | ||
"style": "backtick" | ||
}, | ||
"emphasis-style": { | ||
"style": "asterisk" | ||
}, | ||
"fenced-code-language": { | ||
"allowed_languages": [ | ||
"bash", | ||
"html", | ||
"javascript", | ||
"json", | ||
"markdown", | ||
"text" | ||
], | ||
"language_only": true | ||
}, | ||
"heading-style": { | ||
"style": "atx" | ||
}, | ||
"hr-style": { | ||
"style": "---" | ||
}, | ||
"line-length": { | ||
"strict": false, | ||
"code_blocks": false | ||
}, | ||
"no-duplicate-heading": { | ||
"siblings_only": true | ||
}, | ||
"ol-prefix": { | ||
"style": "ordered" | ||
}, | ||
"proper-names": { | ||
"code_blocks": false, | ||
"names": [ | ||
"Cake.Markdownlint", | ||
"CommonMark", | ||
"JavaScript", | ||
"Markdown", | ||
"markdown-it", | ||
"markdownlint", | ||
"Node.js" | ||
] | ||
}, | ||
"reference-links-images": { | ||
"shortcut_syntax": true | ||
}, | ||
"strong-style": { | ||
"style": "asterisk" | ||
}, | ||
"ul-style": { | ||
"style": "dash" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
n2os-smb-client is released under the BSD 2-Clause License license. | ||
|
||
Included 3rd party software | ||
=========================== | ||
This software includes libsmb2 and json-c, with their original repositories linked | ||
as github modules. | ||
|
||
libsmb2 is released under LGPL 2.1 (or later) for what concerns lib and include directories, | ||
and the 2-Clause BSD License for its examples directory. | ||
Copyright (C) 2016 by Ronnie Sahlberg <ronniesahlberg@gmail.com> | ||
|
||
json-c is release under the MIT license. | ||
Copyright (c) 2009-2012 Eric Haszlakiewicz | ||
Copyright (c) 2004, 2005 Metaparadigm Pte Ltd | ||
|
||
See their respective subdirectories for detailed license information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Dockerfile for Linux | ||
# | ||
# Build: | ||
# docker build -t "smblinux:latest" -f Dockerfile.linux . | ||
# | ||
# Build with Kerberos support: | ||
# docker build --progress plain -t "smblinux:latest" --build-arg WITH_KERBEROS=1 -f Dockerfile.linux . | ||
# | ||
# Run with no options: | ||
# docker run --rm smblinux:latest | ||
# | ||
# Run a n2os-smb-client command directly: | ||
# docker run --env N2OS_SMB_PASSWORD=${N2OS_SMB_PASSWORD} --rm -v "$PWD/bin":/usr/src/n2os-smb-client/bin:Z smblinux:latest ls smb://media@192.168.1.100/_media | ||
# | ||
# Interactive shell on the container image: | ||
# docker run -ti --entrypoint /bin/bash smblinux:latest | ||
|
||
# FROM debian:bookworm-slim # no upx at the moment | ||
FROM debian:bullseye-slim AS builder | ||
|
||
ARG WITH_KERBEROS | ||
ENV WITH_KERBEROS=${WITH_KERBEROS} | ||
|
||
# Used in GHA workflow | ||
ARG ENV_ARM | ||
ENV ENV_ARM=${ENV_ARM} | ||
|
||
WORKDIR /usr/src/n2os-smb-client | ||
COPY . . | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends git build-essential upx-ucl cmake libssl-dev libkrb5-dev && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* && \ | ||
ldconfig && \ | ||
./build.linux.sh | ||
|
||
FROM debian:bullseye-slim | ||
|
||
RUN useradd -m nonroot | ||
|
||
COPY --from=builder /usr/src/n2os-smb-client/bin/n2os_smb_client.linux /usr/bin/n2os_smb_client.linux | ||
|
||
USER nonroot | ||
WORKDIR /home/nonroot | ||
|
||
ENTRYPOINT [ "/usr/bin/n2os_smb_client.linux" ] |
Oops, something went wrong.