Add fuse-cryfs

CryFS encrypts your files, so you can safely store them anywhere.
It works well together with cloud services like Dropbox, iCloud, OneDrive
and others.

Doesn't work on netbsd yet
This commit is contained in:
coypu 2017-07-20 19:21:08 +03:00
parent 60aab2991e
commit 7b6d60323c
10 changed files with 174 additions and 0 deletions

3
fuse-cryfs/DESCR Normal file
View File

@ -0,0 +1,3 @@
CryFS encrypts your files, so you can safely store them anywhere.
It works well together with cloud services like Dropbox, iCloud, OneDrive
and others.

40
fuse-cryfs/Makefile Normal file
View File

@ -0,0 +1,40 @@
# $NetBSD: Makefile,v 1.13 2017/06/19 18:41:39 maya Exp $
#
DISTNAME= cryfs-0.9.7
PKGNAME= fuse-${DISTNAME}
CATEGORIES= filesystems
MASTER_SITES= ${MASTER_SITE_GITHUB:=cryfs/}
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://www.cryfs.org/
COMMENT= FUSE Encrypted Filesystem
LICENSE= gnu-lgpl-v3
EXTRACT_USING= bsdtar
GITHUB_PROJECT= cryfs
USE_TOOLS+= autoconf cmake pkg-config
USE_CMAKE= yes
USE_LANGUAGES= c c++
CONFIGURE_DIRS= ${WRKDIR}/build
CMAKE_ARG_PATH= ${WRKSRC}
#TEST_TARGET= test
REPLACE_PYTHON= src/gitversion/*.py
post-extract:
${RUN} mkdir -p ${WRKDIR}/build
CFLAGS+= -g -ggdb3 -fno-omit-frame-pointer
INSTALL_UNSTRIPPED= yes
.include "../../security/crypto++/buildlink3.mk"
.include "../../devel/boost-libs/buildlink3.mk"
.include "../../devel/boost-headers/buildlink3.mk"
.include "../../devel/libexecinfo/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../lang/python/application.mk"
.include "../../mk/bsd.pkg.mk"

2
fuse-cryfs/PLIST Normal file
View File

@ -0,0 +1,2 @@
@comment $NetBSD$
bin/cryfs

1
fuse-cryfs/TODO Normal file
View File

@ -0,0 +1 @@
Fails to run on netbsd

11
fuse-cryfs/distinfo Normal file
View File

@ -0,0 +1,11 @@
$NetBSD: distinfo,v 1.6 2017/06/19 18:41:39 maya Exp $
SHA1 (cryfs-0.9.7.tar.gz) = e7f048aa39e5f4f10d5bac7b5af91ed4a7350afd
RMD160 (cryfs-0.9.7.tar.gz) = 0a6e55586a331509caa13c095c7871a0ef63f77f
SHA512 (cryfs-0.9.7.tar.gz) = f3d2550665bd93d83f1368654193c81cc1a2a533c9a9fb7466a893756b43c288124a33d7f469a49185019274029f0f9aece737b14bfb415c5cd979facf075573
Size (cryfs-0.9.7.tar.gz) = 1719493 bytes
SHA1 (patch-src_cpp-utils_system_get__total__memory.cpp) = 7ab8f87cb957fa53f5d6b7329c00fca8a1fc3fba
SHA1 (patch-src_cryfs-cli_Cli.cpp) = 2ee0781118b3c9dcac7b1371f229841774b08eda
SHA1 (patch-src_fspp_CMakeLists.txt) = 53858c661bab14f7fe2e8187a700e4735b78fc62
SHA1 (patch-src_fspp_fuse_params.h) = a204161a7810f90502820d3889bec9e1ebb0cc5f
SHA1 (patch-vendor_spdlog_spdlog_details_os.h) = a904982dd2f6cb59dcdd1e5908239feb02a86310

View File

@ -0,0 +1,38 @@
$NetBSD$
Find total memory via sysctl for FreeBSD too. Add NetBSD case.
clean up a bit.
Linux case seems wrong.
--- src/cpp-utils/system/get_total_memory.cpp.orig 2017-02-11 12:34:50.000000000 +0000
+++ src/cpp-utils/system/get_total_memory.cpp
@@ -4,17 +4,25 @@
#include <unistd.h>
#include <stdexcept>
+#ifdef __APPLE__
+#define SYSCTL_MEMSIZE "hw.memsize"
+#elif __FreeBSD__
+#define SYSCTL_MEMSIZE "hw.physmem"
+#elif __NetBSD__
+#define SYSCTL_MEMSIZE "hw.physmem64"
+#endif
+
namespace cpputils{
namespace system {
uint64_t get_total_memory() {
uint64_t mem;
-#ifdef __APPLE__
+#ifdef SYSCTL_MEMSIZE
size_t size = sizeof(mem);
- int result = sysctlbyname("hw.memsize", &mem, &size, nullptr, 0);
+ int result = sysctlbyname(SYSCTL_MEMSIZE, &mem, &size, nullptr, 0);
if (0 != result) {
throw std::runtime_error("sysctlbyname syscall failed");
}
-#elif __linux__ || __FreeBSD__
+#elif __linux__
long numRAMPages = sysconf(_SC_PHYS_PAGES);
long pageSize = sysconf(_SC_PAGESIZE);
mem = numRAMPages * pageSize;

View File

@ -0,0 +1,14 @@
$NetBSD$
Awful hack to workaround the need to register_t type
--- src/cryfs-cli/Cli.cpp.orig 2017-02-11 12:34:50.000000000 +0000
+++ src/cryfs-cli/Cli.cpp
@@ -1,3 +1,7 @@
+#ifdef __NetBSD__ /* XXX awful hack */
+#define _KMEMUSER 1
+#endif
+
#include "Cli.h"
#include <blockstore/implementations/ondisk/OnDiskBlockStore.h>

View File

@ -0,0 +1,20 @@
$NetBSD$
Recognise netbsd librefuse
--- src/fspp/CMakeLists.txt.orig 2017-02-11 12:34:50.000000000 +0000
+++ src/fspp/CMakeLists.txt
@@ -18,9 +18,11 @@ target_activate_cpp14(${PROJECT_NAME})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_FIND_FRAMEWORK LAST)
set(FUSE_LIB_NAME "osxfuse")
-else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
+ set(FUSE_LIB_NAME "refuse")
+else()
set(FUSE_LIB_NAME "fuse")
-endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+endif()
find_library_with_path(FUSE ${FUSE_LIB_NAME} FUSE_LIB_PATH)
target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})

View File

@ -0,0 +1,20 @@
$NetBSD$
NetBSD provides fuse.h for compat.
--- src/fspp/fuse/params.h.orig 2017-02-11 12:34:50.000000000 +0000
+++ src/fspp/fuse/params.h
@@ -3,7 +3,12 @@
#define MESSMER_FSPP_FUSE_PARAMS_H_
#define FUSE_USE_VERSION 26
-#ifdef __linux__
+
+#ifdef __NetBSD__
+#define _KMEMUSER 1
+#endif
+
+#if defined(__linux__) || defined(__NetBSD__)
#include <fuse.h>
#elif __APPLE__
#include <osxfuse/fuse.h>

View File

@ -0,0 +1,25 @@
$NetBSD$
NetBSD is POSIXy.
NetBSD has no need for 64 suffix to structs and functions.
--- vendor/spdlog/spdlog/details/os.h.orig 2017-02-11 12:34:50.000000000 +0000
+++ vendor/spdlog/spdlog/details/os.h
@@ -212,7 +212,7 @@ inline size_t filesize(FILE *f)
#else // unix
int fd = fileno(f);
//64 bits(but not in osx, where fstat64 is deprecated)
-#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__))
+#if !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__))
struct stat64 st;
if (fstat64(fd, &st) == 0)
return st.st_size;
@@ -343,7 +343,7 @@ inline std::string errno_str(int err_num
return "Unkown error";
#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(ANDROID) || \
- ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) // posix version
+ defined(__NetBSD__) || ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) // posix version
if (strerror_r(err_num, buf, buf_size) == 0)
return std::string(buf);