3
0
Fork 0
forked from mirrors/nixpkgs

openafs_1_8: init at 1.8.0 (#41889)

- Introduce new "server" output holding the server binaries
 - Adapt tsmbac.patch to new build environment
 - Adapt openafs nixos server module accordingly
 - Update upstream CellServDB: 2017-03-14 -> 2018-05-14
 - Introduce package attributes to refer to the openafs packages to use for
   server, programs and kernel module
This commit is contained in:
spacefrogg 2018-06-30 00:34:35 +02:00 committed by xeji
parent c9362d595e
commit 37c999228b
13 changed files with 315 additions and 25 deletions

View file

@ -1,6 +1,7 @@
{ config, pkgs, lib, ... }:
{ config, lib, pkgs, ... }:
with import ./lib.nix { inherit lib; };
# openafsMod, openafsBin, mkCellServDB
with import ./lib.nix { inherit config lib pkgs; };
let
inherit (lib) getBin mkOption mkIf optionalString singleton types;
@ -8,8 +9,8 @@ let
cfg = config.services.openafsClient;
cellServDB = pkgs.fetchurl {
url = http://dl.central.org/dl/cellservdb/CellServDB.2017-03-14;
sha256 = "1197z6c5xrijgf66rhaymnm5cvyg2yiy1i20y4ah4mrzmjx0m7sc";
url = http://dl.central.org/dl/cellservdb/CellServDB.2018-05-14;
sha256 = "1wmjn6mmyy2r8p10nlbdzs4nrqxy8a9pjyrdciy5nmppg4053rk2";
};
clientServDB = pkgs.writeText "client-cellServDB-${cfg.cellName}" (mkCellServDB cfg.cellName cfg.cellServDB);
@ -21,8 +22,6 @@ let
echo "${cfg.mountPoint}:${cfg.cache.directory}:${toString cfg.cache.blocks}" > $out/cacheinfo
'';
openafsMod = config.boot.kernelPackages.openafs;
openafsBin = lib.getBin pkgs.openafs;
in
{
###### interface
@ -147,6 +146,19 @@ in
'';
};
packages = {
module = mkOption {
default = config.boot.kernelPackages.openafs;
type = types.package;
description = "OpenAFS kernel module package. MUST match the userland package!";
};
programs = mkOption {
default = getBin pkgs.openafs;
type = types.package;
description = "OpenAFS programs package. MUST match the kernel module package!";
};
};
sparse = mkOption {
default = true;
type = types.bool;
@ -180,7 +192,7 @@ in
}
];
environment.systemPackages = [ pkgs.openafs ];
environment.systemPackages = [ openafsBin ];
environment.etc = {
clientCellServDB = {

View file

@ -1,14 +1,15 @@
{ lib, ...}:
{ config, lib, pkgs, ...}:
let
inherit (lib) concatStringsSep mkOption types;
inherit (lib) concatStringsSep getBin mkOption types;
in rec {
mkCellServDB = cellName: db: ''
>${cellName}
'' + (concatStringsSep "\n" (map (dbm: if (dbm.ip != "" && dbm.dnsname != "") then dbm.ip + " #" + dbm.dnsname else "")
db));
db))
+ "\n";
# CellServDB configuration type
cellServDBConfig = {
@ -25,4 +26,8 @@ in rec {
description = "DNS full-qualified domain name of a database server";
};
};
openafsMod = config.services.openafsClient.packages.module;
openafsBin = config.services.openafsClient.packages.programs;
openafsSrv = config.services.openafsServer.package;
}

View file

@ -1,6 +1,7 @@
{ config, pkgs, lib, ... }:
{ config, lib, pkgs, ... }:
with import ./lib.nix { inherit lib; };
# openafsBin, openafsSrv, mkCellServDB
with import ./lib.nix { inherit config lib pkgs; };
let
inherit (lib) concatStringsSep intersperse mapAttrsToList mkForce mkIf mkMerge mkOption optionalString types;
@ -11,21 +12,21 @@ let
checkbintime 3 0 5 0 0
'' + (optionalString cfg.roles.database.enable ''
bnode simple vlserver 1
parm ${openafsBin}/libexec/openafs/vlserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} ${cfg.roles.database.vlserverArgs}
parm ${openafsSrv}/libexec/openafs/vlserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} ${cfg.roles.database.vlserverArgs}
end
bnode simple ptserver 1
parm ${openafsBin}/libexec/openafs/ptserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} ${cfg.roles.database.ptserverArgs}
parm ${openafsSrv}/libexec/openafs/ptserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} ${cfg.roles.database.ptserverArgs}
end
'') + (optionalString cfg.roles.fileserver.enable ''
bnode dafs dafs 1
parm ${openafsBin}/libexec/openafs/dafileserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} -udpsize ${udpSizeStr} ${cfg.roles.fileserver.fileserverArgs}
parm ${openafsBin}/libexec/openafs/davolserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} -udpsize ${udpSizeStr} ${cfg.roles.fileserver.volserverArgs}
parm ${openafsBin}/libexec/openafs/salvageserver ${cfg.roles.fileserver.salvageserverArgs}
parm ${openafsBin}/libexec/openafs/dasalvager ${cfg.roles.fileserver.salvagerArgs}
parm ${openafsSrv}/libexec/openafs/dafileserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} -udpsize ${udpSizeStr} ${cfg.roles.fileserver.fileserverArgs}
parm ${openafsSrv}/libexec/openafs/davolserver ${optionalString cfg.dottedPrincipals "-allow-dotted-principals"} -udpsize ${udpSizeStr} ${cfg.roles.fileserver.volserverArgs}
parm ${openafsSrv}/libexec/openafs/salvageserver ${cfg.roles.fileserver.salvageserverArgs}
parm ${openafsSrv}/libexec/openafs/dasalvager ${cfg.roles.fileserver.salvagerArgs}
end
'') + (optionalString (cfg.roles.database.enable && cfg.roles.backup.enable) ''
bnode simple buserver 1
parm ${openafsBin}/libexec/openafs/buserver ${cfg.roles.backup.buserverArgs} ${optionalString (cfg.roles.backup.cellServDB != []) "-cellservdb /etc/openafs/backup/"}
parm ${openafsSrv}/libexec/openafs/buserver ${cfg.roles.backup.buserverArgs} ${optionalString (cfg.roles.backup.cellServDB != []) "-cellservdb /etc/openafs/backup/"}
end
''));
@ -39,8 +40,6 @@ let
udpSizeStr = toString cfg.udpPacketSize;
openafsBin = lib.getBin pkgs.openafs;
in {
options = {
@ -79,6 +78,12 @@ in {
description = "Definition of all cell-local database server machines.";
};
package = mkOption {
default = pkgs.openafs.server or pkgs.openafs;
type = types.package;
description = "OpenAFS package for the server binaries";
};
roles = {
fileserver = {
enable = mkOption {
@ -213,7 +218,7 @@ in {
}
];
environment.systemPackages = [ pkgs.openafs ];
environment.systemPackages = [ openafsBin ];
environment.etc = {
bosConfig = {
@ -244,7 +249,10 @@ in {
after = [ "syslog.target" "network.target" ];
wantedBy = [ "multi-user.target" ];
restartIfChanged = false;
unitConfig.ConditionPathExists = [ "/etc/openafs/server/rxkad.keytab" ];
unitConfig.ConditionPathExists = [
"|/etc/openafs/server/rxkad.keytab"
"|/etc/openafs/server/KeyFileExt"
];
preStart = ''
mkdir -m 0755 -p /var/openafs
${optionalString (netInfo != null) "cp ${netInfo} /var/openafs/netInfo"}

View file

@ -0,0 +1,30 @@
diff -u openafs-1.8.0/src/bozo/bosserver.c /tmp/buffer-content-13110-gd
--- openafs-1.8.0/src/bozo/bosserver.c
+++ #<buffer bosserver.c>
@@ -244,24 +244,6 @@
static int
CreateDirs(const char *coredir)
{
- if ((!strncmp
- (AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
- strlen(AFSDIR_USR_DIRPATH)))
- ||
- (!strncmp
- (AFSDIR_USR_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
- strlen(AFSDIR_USR_DIRPATH)))) {
- if (MakeDir(AFSDIR_USR_DIRPATH))
- return errno;
- }
- if (!strncmp
- (AFSDIR_SERVER_AFS_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
- strlen(AFSDIR_SERVER_AFS_DIRPATH))) {
- if (MakeDir(AFSDIR_SERVER_AFS_DIRPATH))
- return errno;
- }
- if (MakeDir(AFSDIR_SERVER_BIN_DIRPATH))
- return errno;
if (MakeDir(AFSDIR_SERVER_ETC_DIRPATH))
return errno;
if (MakeDir(AFSDIR_SERVER_LOCAL_DIRPATH))
Diff finished. Fri Jun 29 15:45:46 2018

View file

@ -0,0 +1,97 @@
{ stdenv, fetchurl, fetchgit, which, autoconf, automake, flex, yacc
, glibc, perl, kerberos, libxslt, docbook_xsl, docbook_xml_dtd_43
, libtool_2, removeReferencesTo
, ncurses # Extra ncurses utilities. Only needed for debugging.
, tsmbac ? null # Tivoli Storage Manager Backup Client from IBM
}:
with (import ./srcs.nix { inherit fetchurl; });
stdenv.mkDerivation rec {
name = "openafs-${version}";
inherit version srcs;
nativeBuildInputs = [ autoconf automake flex libxslt libtool_2 perl
removeReferencesTo which yacc ];
buildInputs = [ kerberos ncurses ];
patches = [ ./bosserver.patch ] ++ stdenv.lib.optional (tsmbac != null) ./tsmbac.patch;
outputs = [ "out" "dev" "man" "doc" "server" ];
enableParallelBuilding = true;
setOutputFlags = false;
# Makefiles don't include install targets for all new shared libs, yet.
dontDisableStatic = true;
preConfigure = ''
patchShebangs .
for i in `grep -l -R '/usr/\(include\|src\)' .`; do
echo "Patch /usr/include and /usr/src in $i"
substituteInPlace $i \
--replace "/usr/include" "${glibc.dev}/include" \
--replace "/usr/src" "$TMP"
done
for i in ./doc/xml/{AdminGuide,QuickStartUnix,UserGuide}/*.xml; do
substituteInPlace "''${i}" --replace "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" \
"${docbook_xml_dtd_43}/xml/dtd/docbook/docbookx.dtd"
done
./regen.sh
configureFlagsArray=(
"--with-gssapi"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--disable-kernel-module"
"--disable-fuse-client"
"--with-html-xsl=${docbook_xsl}/share/xml/docbook-xsl/html/chunk.xsl"
${stdenv.lib.optionalString (tsmbac != null) "--enable-tivoli-tsm"}
${stdenv.lib.optionalString (ncurses == null) "--disable-gtx"}
"--disable-linux-d_splice-alias-extra-iput"
"--libexecdir=$server/libexec"
)
'' + stdenv.lib.optionalString (tsmbac != null) ''
export XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I${tsmbac}/lib64/sample -DXBSA_TSMLIB=\\\"${tsmbac}/lib64/libApiTSM64.so\\\""
export XBSA_XLIBS="-ldl"
'';
buildFlags = [ "all_nolibafs" ];
postBuild = ''
for d in doc/xml/{AdminGuide,QuickStartUnix,UserGuide}; do
make -C "''${d}" index.html
done
'';
postInstall = ''
mkdir -p $doc/share/doc/openafs/{AdminGuide,QuickStartUnix,UserGuide}
cp -r doc/{pdf,protocol,txt} README LICENSE $doc/share/doc/openafs
for d in AdminGuide QuickStartUnix UserGuide ; do
cp "doc/xml/''${d}"/*.html "$doc/share/doc/openafs/''${d}"
done
rm -r $out/lib/openafs
'';
# Avoid references to $TMPDIR by removing it and let patchelf cleanup the
# binaries.
preFixup = ''
rm -rf "$(pwd)" && mkdir "$(pwd)"
find $out -type f -exec remove-references-to -t $server '{}' '+'
'';
meta = with stdenv.lib; {
outputsToInstall = [ "out" "doc" "man" ];
description = "Open AFS client";
homepage = https://www.openafs.org;
license = licenses.ipl10;
platforms = platforms.linux;
maintainers = [ maintainers.z77z maintainers.spacefrogg ];
};
}

View file

@ -0,0 +1,60 @@
{ stdenv, fetchurl, which, autoconf, automake, flex, yacc
, kernel, glibc, perl, libtool_2, kerberos }:
with (import ./srcs.nix { inherit fetchurl; });
let
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/extra/openafs";
kernelBuildDir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
in stdenv.mkDerivation rec {
name = "openafs-${version}-${kernel.version}";
inherit version src;
nativeBuildInputs = [ autoconf automake flex libtool_2 perl which yacc ]
++ kernel.moduleBuildDependencies;
buildInputs = [ kerberos ];
hardeningDisable = [ "pic" ];
configureFlags = [
"--with-linux-kernel-build=${kernelBuildDir}"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-gssapi"
"--disable-linux-d_splice-alias-extra-iput"
];
preConfigure = ''
patchShebangs .
for i in `grep -l -R '/usr/\(include\|src\)' .`; do
echo "Patch /usr/include and /usr/src in $i"
substituteInPlace $i \
--replace "/usr/include" "${glibc.dev}/include" \
--replace "/usr/src" "${kernelBuildDir}"
done
./regen.sh -q
'';
buildPhase = ''
make V=1 only_libafs
'';
installPhase = ''
mkdir -p ${modDestDir}
cp src/libafs/MODLOAD-*/libafs-${kernel.version}.* ${modDestDir}/libafs.ko
xz -f ${modDestDir}/libafs.ko
'';
meta = with stdenv.lib; {
description = "Open AFS client kernel module";
homepage = https://www.openafs.org;
license = licenses.ipl10;
platforms = platforms.linux;
maintainers = [ maintainers.z77z maintainers.spacefrogg ];
broken = (versionOlder kernel.version "3.18") || stdenv.targetPlatform.isAarch64;
};
}

View file

@ -0,0 +1,14 @@
{ fetchurl }:
rec {
version = "1.8.0";
src = fetchurl {
url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-src.tar.bz2";
sha256 = "63fae6b3a4339e4a40945fae1afb9b99a5e7f8e8dbde668938ab8c4ff569fd7d";
};
srcs = [ src
(fetchurl {
url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-doc.tar.bz2";
sha256 = "e26f3bb399f524b4978543eb3ec169fd58f2d409cf4bc22c75c65fb9b09f12e8";
})];
}

View file

@ -0,0 +1,62 @@
diff -ru openafs-1.8.0/src/butc/afsxbsa.c openafs-1.8.0.new/src/butc/afsxbsa.c
--- openafs-1.8.0/src/butc/afsxbsa.c 2018-04-06 03:21:12.000000000 +0200
+++ openafs-1.8.0.new/src/butc/afsxbsa.c 2018-06-12 16:26:26.272522305 +0200
@@ -651,7 +651,7 @@
#if defined(AFS_AIX_ENV)
dynlib = dlopen("/usr/lib/libApiDS.a(dsmapish.o)", RTLD_NOW | RTLD_LOCAL | RTLD_MEMBER);
#elif defined (AFS_AMD64_LINUX26_ENV)
- dynlib = dlopen("/usr/lib64/libApiTSM64.so", RTLD_NOW | RTLD_LOCAL);
+ dynlib = dlopen(XBSA_TSMLIB, RTLD_NOW | RTLD_LOCAL);
#elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
dynlib = dlopen("/usr/lib/libApiDS.so", RTLD_NOW | RTLD_LOCAL);
#else
diff -ru openafs-1.8.0/src/cf/tivoli.m4 openafs-1.8.0.new/src/cf/tivoli.m4
--- openafs-1.8.0/src/cf/tivoli.m4 2018-04-06 03:21:12.000000000 +0200
+++ openafs-1.8.0.new/src/cf/tivoli.m4 2018-06-12 16:26:26.072522485 +0200
@@ -1,45 +1,7 @@
AC_DEFUN([OPENAFS_TIVOLI_TESTS],[
dnl check for tivoli
AC_MSG_CHECKING(for tivoli tsm butc support)
-XBSA_CFLAGS=""
-if test "$enable_tivoli_tsm" = "yes"; then
- XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
- XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
- XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample
- XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample
- XBSADIR5=/usr/tivoli/tsm/client/api/bin64/sample
- XBSADIR6=/opt/tivoli/tsm/client/api/bin64/sample
-
- if test -r "$XBSADIR3/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR4/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR5/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR5"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR6/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR6"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR1/xbsa.h"; then
- XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
- XBSA_XLIBS=""
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR2/xbsa.h"; then
- XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
- XBSA_XLIBS=""
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- else
- AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files])
- fi
-else
- AC_MSG_RESULT([no])
-fi
+AC_MSG_RESULT([yes])
AC_SUBST(XBSA_CFLAGS)
AC_SUBST(XBSA_XLIBS)
XLIBS="$XBSA_XLIBS $XLIBS"

View file

@ -12823,7 +12823,8 @@ with pkgs;
oauth2_proxy = callPackage ../servers/oauth2_proxy { };
openafs = callPackage ../servers/openafs { tsmbac = null; ncurses = null; };
openafs = callPackage ../servers/openafs/1.6 { tsmbac = null; ncurses = null; };
openafs_1_8 = callPackage ../servers/openafs/1.8 { tsmbac = null; ncurses = null; };
openresty = callPackage ../servers/http/openresty { };
@ -13837,7 +13838,8 @@ with pkgs;
rtlwifi_new = callPackage ../os-specific/linux/rtlwifi_new { };
openafs = callPackage ../servers/openafs/module.nix { };
openafs = callPackage ../servers/openafs/1.6/module.nix { };
openafs_1_8 = callPackage ../servers/openafs/1.8/module.nix { };
facetimehd = callPackage ../os-specific/linux/facetimehd { };