mirror of
https://git.sr.ht/~nabijaczleweli/tzpfms
synced 2025-04-03 09:00:01 +03:00
Scaffolding
This commit is contained in:
parent
dd97c41b08
commit
c6e322e2ba
17
.build.yml
Normal file
17
.build.yml
Normal file
@ -0,0 +1,17 @@
|
||||
image: debian/sid
|
||||
packages:
|
||||
- clang
|
||||
- pkg-config
|
||||
- ronn
|
||||
tasks:
|
||||
- get-zfs: |
|
||||
sudo sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
|
||||
sudo apt update
|
||||
sudo apt install -y libzfslinux-dev
|
||||
- build-gcc: |
|
||||
cd tzpfms
|
||||
make
|
||||
make clean
|
||||
- build-clang: |
|
||||
cd tzpfms
|
||||
CC=clang CXX=clang++ make
|
23
.clang-format
Normal file
23
.clang-format
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
Language : Cpp
|
||||
BasedOnStyle : LLVM
|
||||
AlignAfterOpenBracket : true
|
||||
AlignEscapedNewlinesLeft : true
|
||||
AlignConsecutiveAssignments : true
|
||||
AllowShortFunctionsOnASingleLine : Inline
|
||||
AlwaysBreakTemplateDeclarations : true
|
||||
ColumnLimit : 160
|
||||
ConstructorInitializerIndentWidth : 6
|
||||
IndentCaseLabels : true
|
||||
MaxEmptyLinesToKeep : 2
|
||||
KeepEmptyLinesAtTheStartOfBlocks : false
|
||||
NamespaceIndentation : All
|
||||
PointerAlignment : Middle
|
||||
SpacesBeforeTrailingComments : 2
|
||||
IndentWidth : 2
|
||||
TabWidth : 2
|
||||
UseTab : ForIndentation
|
||||
SpaceBeforeParens : Never
|
||||
FixNamespaceComments : false
|
||||
...
|
||||
|
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
*
|
||||
!.git*
|
||||
!.git*/**
|
||||
!.build.yml
|
||||
!.travis.yml
|
||||
!gh_rsa.enc
|
||||
!LICENSE
|
||||
!.clang-format
|
||||
!*Makefile
|
||||
!*.sublime-project
|
||||
!*.md
|
||||
!src
|
||||
!src/**
|
||||
!man
|
||||
!man/**
|
||||
!ext
|
||||
!ext/**
|
||||
!test
|
||||
!test/**
|
||||
!test-data
|
||||
!test-data/**
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 наб <nabijaczleweli@nabijaczleweli.xyz>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
75
Makefile
Normal file
75
Makefile
Normal file
@ -0,0 +1,75 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
# Copyright (c) 2020 наб <nabijaczleweli@nabijaczleweli.xyz>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
include configMakefile
|
||||
|
||||
|
||||
LDDLLS := rt $(OS_LD_LIBS)
|
||||
PKGS := libzfs libzfs_core
|
||||
LDAR := $(LNCXXAR) $(foreach l,,-L$(BLDDIR)$(l)) $(foreach dll,$(LDDLLS),-l$(dll)) $(shell pkg-config --libs $(PKGS))
|
||||
INCAR := $(foreach l,$(foreach l,,$(l)/include),-isystemext/$(l)) $(foreach l,,-isystem$(BLDDIR)$(l)/include) $(shell pkg-config --cflags $(PKGS))
|
||||
VERAR := $(foreach l,TZPFMS,-D$(l)_VERSION='$($(l)_VERSION)')
|
||||
BINARY_SOURCES := $(sort $(wildcard $(SRCDIR)bin/*.cpp $(SRCDIR)bin/**/*.cpp))
|
||||
COMMON_SOURCES := $(filter-out $(BINARY_SOURCES),$(sort $(wildcard $(SRCDIR)*.cpp $(SRCDIR)**/*.cpp $(SRCDIR)**/**/*.cpp $(SRCDIR)**/**/**/*.cpp)))
|
||||
# TEST_SOURCES := $(sort $(wildcard $(TSTDIR)*.cpp $(TSTDIR)**/*.cpp $(TSTDIR)**/**/*.cpp $(TSTDIR)**/**/**/*.cpp))
|
||||
MANPAGE_SOURCES := $(sort $(wildcard $(MANDIR)*.md $(MANDIR)**/*.md))
|
||||
|
||||
|
||||
.PHONY : all clean build build-test man
|
||||
.SECONDARY:
|
||||
|
||||
|
||||
all : build man # build-test test
|
||||
|
||||
#test: build-test
|
||||
# $(OUTDIR)tzpfms-test$(EXE)
|
||||
|
||||
clean :
|
||||
rm -rf $(OUTDIR)
|
||||
|
||||
build : $(subst $(SRCDIR)bin/,$(OUTDIR),$(subst .cpp,$(EXE),$(BINARY_SOURCES)))
|
||||
#build-test : $(OUTDIR)tzpfms-test$(EXE)
|
||||
man : $(subst $(MANDIR),$(OUTDIR)man/,$(MANPAGE_SOURCES))
|
||||
|
||||
|
||||
#$(OUTDIR)tzpfms-test$(EXE) : $(subst $(TSTDIR),$(BLDDIR)test/,$(subst .cpp,$(OBJ),$(TEST_SOURCES))) $(subst $(SRCDIR),$(OBJDIR),$(subst .cpp,$(OBJ),$(filter-out $(SRCDIR)main.cpp,$(SOURCES)))) $(patsubst ext/fmt/src/%.cc,$(BLDDIR)fmt/obj/%$(OBJ),$(wildcard ext/fmt/src/*.cc))
|
||||
# $(CXX) $(CXXAR) -o$@ $^ $(PIC) $(LDAR)
|
||||
|
||||
$(subst $(MANDIR),$(OUTDIR)man/,$(MANPAGE_SOURCES)) : $(MANDIR)index.txt $(MANPAGE_SOURCES)
|
||||
@rm -rf $(dir $@) && mkdir -p $(dir $@)
|
||||
cp $^ $(dir $@)
|
||||
ronn $@
|
||||
ronn -f $@
|
||||
|
||||
|
||||
$(OUTDIR)%$(EXE) : $(subst $(SRCDIR),$(OBJDIR),$(subst .cpp,$(OBJ),$(SRCDIR)bin/%.cpp $(COMMON_SOURCES)))
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXAR) -o$@ $^ $(PIC) $(LDAR)
|
||||
$(STRIP) $(STRIPAR) $@
|
||||
|
||||
$(OBJDIR)%$(OBJ) : $(SRCDIR)%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXAR) $(INCAR) $(VERAR) -c -o$@ $^
|
||||
|
||||
$(BLDDIR)test/%$(OBJ) : $(TSTDIR)%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXAR) $(INCAR) -I$(SRCDIR) $(VERAR) -c -o$@ $^
|
65
README.md
Normal file
65
README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# tzpfms [](https://builds.sr.ht/~nabijaczleweli/tzpfms) [](LICENSE)
|
||||
TPM-based encryption keys for ZFS datasets.
|
||||
|
||||
## [Manpage](//git.sr.ht/~nabijaczleweli/tzpfms-man#NAME)
|
||||
|
||||
### Why?
|
||||
|
||||
```
|
||||
T P M
|
||||
Z F S
|
||||
```
|
||||
|
||||
Plus it's a pretty good annoyed sigh onomatopoeia.
|
||||
|
||||
### Building
|
||||
|
||||
You'll need `pkg-config` and `libzfslinux-dev`<!-- , to initialise the submodules -->, and `make` should hopefully Just Work™ if you have a C++17-capable compiler.
|
||||
|
||||
### Installation
|
||||
|
||||
Copy `out/tzpfms` to `/sbin` and write a `/etc/tzpfms/{description,cmdline}`, as seen in the [manpage](//git.sr.ht/~nabijaczleweli/tzpfms/tree/trunk/man/tzpfms.md),
|
||||
|
||||
<!-- #### From Debian repository
|
||||
|
||||
The following line in `/etc/apt/sources.list` or equivalent:
|
||||
```apt
|
||||
deb https://debian.nabijaczleweli.xyz sid main
|
||||
```
|
||||
|
||||
With [my PGP key](//nabijaczleweli.xyz/pgp.txt) (the two URLs are interchangeable):
|
||||
```sh
|
||||
wget -O- https://debian.nabijaczleweli.xyz/nabijaczleweli.gpg.key | sudo apt-key add
|
||||
# or
|
||||
sudo wget -O/etc/apt/trusted.gpg.d/nabijaczleweli.asc //keybase.io/nabijaczleweli/pgp_keys.asc
|
||||
```
|
||||
|
||||
Then the usual
|
||||
```sh
|
||||
sudo apt update
|
||||
sudo apt install tzpfms
|
||||
```
|
||||
will work on amd64, x32, and i386.
|
||||
|
||||
See the [repository README](//debian.nabijaczleweli.xyz/README) for more information. -->
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
<!-- There's [the tracker](//todo.sr.ht/~nabijaczleweli/tzpfms), but also see the list below. -->
|
||||
|
||||
## Contributing
|
||||
|
||||
<!-- Send a patch inline, as an attachment, or a git link and a ref to pull from to
|
||||
[the list](//lists.sr.ht/~nabijaczleweli/tzpfms) ([~nabijaczleweli/tzpfms@lists.sr.ht](mailto:~nabijaczleweli/tzpfms)) or [me](mailto:nabijaczleweli@nabijaczleweli.xyz)
|
||||
directly. I'm not picky, just please include the repo name in the subject prefix. -->
|
||||
|
||||
## Discussion
|
||||
|
||||
Please use the tracker, the list, or [Twitter](//twitter.com/nabijaczleweli/status/1315137083380559873).
|
||||
|
||||
## Special thanks
|
||||
|
||||
To all who support further development on Patreon, in particular:
|
||||
|
||||
* ThePhD
|
||||
* Embark Studios
|
65
configMakefile
Normal file
65
configMakefile
Normal file
@ -0,0 +1,65 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
# Copyright (c) 2020 наб <nabijaczleweli@nabijaczleweli.xyz>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
EXE :=
|
||||
DLL := .so
|
||||
PIC := -fPIC
|
||||
OS_LD_LIBS :=
|
||||
|
||||
CXXVER := $(shell $(CXX) --version)
|
||||
ifneq "$(findstring clang,$(CXXVER))" ""
|
||||
# GCC doesn't have this granularity
|
||||
CXXSPECIFIC := -flto=full -pedantic -Wno-gnu-statement-expression -Wno-gnu-include-next
|
||||
else
|
||||
CXXSPECIFIC := -flto
|
||||
endif
|
||||
|
||||
|
||||
ifneq "$(ADDITIONAL_INCLUDE_DIR)" ""
|
||||
INCCXXAR := -isystem$(ADDITIONAL_INCLUDE_DIR)
|
||||
else
|
||||
INCCXXAR :=
|
||||
endif
|
||||
|
||||
ifneq "$(ADDITIONAL_LINK_DIR)" ""
|
||||
LNCXXAR := -L$(ADDITIONAL_LINK_DIR)
|
||||
else
|
||||
LNCXXAR :=
|
||||
endif
|
||||
|
||||
# TZPFMS_VERSION := "$(patsubst v%,%,$(shell git describe))"
|
||||
TZPFMS_VERSION := "0.0.0-$(shell git rev-list HEAD --count)"
|
||||
|
||||
INCCMAKEAR := CXXFLAGS="$(INCCXXAR)"
|
||||
LNCMAKEAR := LDFLAGS="$(LNCXXAR)"
|
||||
|
||||
OBJ := .o
|
||||
CXXAR := -O3 -std=c++17 -fno-exceptions -Wall -Wextra $(CXXSPECIFIC) -pipe $(INCCXXAR) $(PIC)
|
||||
STRIP ?= strip
|
||||
STRIPAR := --strip-all --remove-section=.comment --remove-section=.note
|
||||
|
||||
OUTDIR := out/
|
||||
BLDDIR := out/build/
|
||||
OBJDIR := $(BLDDIR)obj/
|
||||
SRCDIR := src/
|
||||
TSTDIR := test/
|
||||
MANDIR := man/
|
56
tzpfms.sublime-project
Normal file
56
tzpfms.sublime-project
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"build_systems":
|
||||
[
|
||||
{
|
||||
"working_dir": "$project_path",
|
||||
"shell_cmd": "make -j10",
|
||||
"name": "Build tzpfms",
|
||||
|
||||
"target": "ansi_color_build",
|
||||
"syntax": "Packages/ANSIescape/ANSI.sublime-syntax"
|
||||
},
|
||||
{
|
||||
"working_dir": "$project_path",
|
||||
"shell_cmd": "make clean",
|
||||
"name": "Clean tzpfms",
|
||||
|
||||
"target": "ansi_color_build",
|
||||
"syntax": "Packages/ANSIescape/ANSI.sublime-syntax"
|
||||
}
|
||||
],
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"name": "Source",
|
||||
"path": "src"
|
||||
},
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"name": "Test",
|
||||
"path": "test"
|
||||
},
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"name": "Test data",
|
||||
"path": "test-data"
|
||||
},
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"name": "External code",
|
||||
"path": "ext"
|
||||
},
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"name": "Manpages",
|
||||
"path": "man"
|
||||
},
|
||||
{
|
||||
"follow_symlinks": true,
|
||||
"name": "Build scripts",
|
||||
"path": ".",
|
||||
"file_include_patterns": [".build.yml", "*Makefile"],
|
||||
"folder_exclude_patterns": ["*"]
|
||||
},
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user