diff options
Diffstat (limited to 'pkgs/tools/backup/tsm-client/default.nix')
-rw-r--r-- | pkgs/tools/backup/tsm-client/default.nix | 112 |
1 files changed, 76 insertions, 36 deletions
diff --git a/pkgs/tools/backup/tsm-client/default.nix b/pkgs/tools/backup/tsm-client/default.nix index e298751facab9..c684b34ec4e56 100644 --- a/pkgs/tools/backup/tsm-client/default.nix +++ b/pkgs/tools/backup/tsm-client/default.nix @@ -1,15 +1,20 @@ { lib +, callPackage +, nixosTests , stdenv +, fetchurl , autoPatchelfHook +, rpmextract +, openssl +, zlib +, lvm2 # LVM image backup and restore functions (optional) +, acl # EXT2/EXT3/XFS ACL support (optional) +, gnugrep +, procps +, jdk8 # Java GUI (needed for `enableGui`) , buildEnv -, fetchurl , makeWrapper -, procps -, zlib -# optional packages that enable certain features -, acl ? null # EXT2/EXT3/XFS ACL support -, jdk8 ? null # Java GUI -, lvm2 ? null # LVM image backup and restore functions +, enableGui ? false # enables Java GUI `dsmj` # path to `dsm.sys` configuration files , dsmSysCli ? "/etc/tsm-client/cli.dsm.sys" , dsmSysApi ? "/etc/tsm-client/api.dsm.sys" @@ -18,7 +23,7 @@ # For an explanation of optional packages # (features provided by them, version limits), see -# https://www-01.ibm.com/support/docview.wss?uid=swg21052223#Version%208.1 +# https://www.ibm.com/support/pages/node/660813#Version%208.1 # IBM Tivoli Storage Manager Client uses a system-wide @@ -40,22 +45,33 @@ # point to this derivations `/dsmi_dir` directory symlink. # Other environment variables might be necessary, # depending on local configuration or usage; see: -# https://www.ibm.com/support/knowledgecenter/en/SSEQVQ_8.1.8/client/c_cfg_sapiunix.html - - -# The newest version of TSM client should be discoverable -# by going the the `downloadPage` (see `meta` below), -# there to "Client Latest Downloads", -# "IBM Spectrum Protect Client Downloads and READMEs", -# then to "Linux x86_64 Ubuntu client" (as of 2019-07-15). +# https://www.ibm.com/docs/en/spectrum-protect/8.1.13?topic=solaris-set-api-environment-variables + + +# The newest version of TSM client should be discoverable by +# going to the `downloadPage` (see `meta` below). +# Find the "Backup-archive client" table on that page. +# Look for "Download Documents" of the latest release. +# Here, two links must be checked: +# * "IBM Spectrum Protect Client ... Downloads and READMEs": +# In the table at the page's bottom, +# check the date of the "Linux x86_64 client" +# * "IBM Spectrum Protect BA client ... interim fix downloads" +# Look for the "Linux x86_64 client" rows +# in the table # at the bottom of each page. +# Follow the "HTTPS" link of the row with the latest date stamp. +# In the directory listing to show up, pick the big `.tar` file. +# +# (as of 2021-12-18) let meta = { - homepage = "https://www.ibm.com/us-en/marketplace/data-protection-and-recovery"; - downloadPage = "https://www-01.ibm.com/support/docview.wss?uid=swg21239415"; + homepage = "https://www.ibm.com/products/data-protection-and-recovery"; + downloadPage = "https://www.ibm.com/support/pages/ibm-spectrum-protect-downloads-latest-fix-packs-and-interim-fixes"; platforms = [ "x86_64-linux" ]; + mainProgram = "dsmc"; license = lib.licenses.unfree; maintainers = [ lib.maintainers.yarny ]; description = "IBM Spectrum Protect (Tivoli Storage Manager) CLI and API"; @@ -74,34 +90,53 @@ let ''; }; + passthru.tests = { + test-cli = callPackage ./test-cli.nix {}; + test-gui = nixosTests.tsm-client-gui; + }; + + mkSrcUrl = version: + let + major = lib.versions.major version; + minor = lib.versions.minor version; + patch = lib.versions.patch version; + fixup = lib.lists.elemAt (lib.versions.splitVersion version) 3; + in + "https://public.dhe.ibm.com/storage/tivoli-storage-management/${if fixup=="0" then "maintenance" else "patches"}/client/v${major}r${minor}/Linux/LinuxX86/BA/v${major}${minor}${patch}/${version}-TIV-TSMBAC-LinuxX86.tar"; + unwrapped = stdenv.mkDerivation rec { name = "tsm-client-${version}-unwrapped"; - version = "8.1.8.0"; + version = "8.1.13.3"; src = fetchurl { - url = "ftp://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/LinuxX86_DEB/BA/v818/${version}-TIV-TSMBAC-LinuxX86_DEB.tar"; - sha256 = "0c1d0jm0i7qjd314nhj2vj8fs7sncm1x2n4d6dg4049jniyvjhpk"; + url = mkSrcUrl version; + sha256 = "1dwczf236drdaf4jcfzz5154vdwvxf5zraxhrhiddl6n80hnvbcd"; }; - inherit meta; + inherit meta passthru; nativeBuildInputs = [ autoPatchelfHook + rpmextract ]; buildInputs = [ + openssl stdenv.cc.cc zlib ]; runtimeDependencies = [ - lvm2 + (lib.attrsets.getLib lvm2) ]; sourceRoot = "."; postUnpack = '' - for debfile in *.deb - do - ar -x "$debfile" - tar --xz --extract --file=data.tar.xz - rm data.tar.xz - done + rpmextract TIVsm-API64.x86_64.rpm + rpmextract TIVsm-APIcit.x86_64.rpm + rpmextract TIVsm-BA.x86_64.rpm + rpmextract TIVsm-BAcit.x86_64.rpm + rpmextract TIVsm-BAhdw.x86_64.rpm + rpmextract TIVsm-JBB.x86_64.rpm + # use globbing so that version updates don't break the build: + rpmextract gskcrypt64-*.linux.x86_64.rpm + rpmextract gskssl64-*.linux.x86_64.rpm ''; installPhase = '' @@ -113,7 +148,7 @@ let # Fix relative symlinks after `/usr` was moved up one level preFixup = '' - for link in $out/lib/* $out/bin/* + for link in $out/lib{,64}/* $out/bin/* do target=$(readlink "$link") if [ "$(cut -b -6 <<< "$target")" != "../../" ] @@ -126,14 +161,19 @@ let ''; }; + binPath = lib.makeBinPath ([ acl gnugrep procps ] + ++ lib.optional enableGui jdk8); + in buildEnv { name = "tsm-client-${unwrapped.version}"; - inherit meta; - passthru = { inherit unwrapped; }; + meta = meta // lib.attrsets.optionalAttrs enableGui { + mainProgram = "dsmj"; + }; + passthru = passthru // { inherit unwrapped; }; paths = [ unwrapped ]; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; pathsToLink = [ "/" "/bin" @@ -144,7 +184,7 @@ buildEnv { # to the so-called "installation directories" # * Add symlinks to the "installation directories" # that point to the `dsm.sys` configuration files - # * Drop the Java GUI executable unless `jdk` is present + # * Drop the Java GUI executable unless `enableGui` is set # * Create wrappers for the command-line interface to # prepare `PATH` and `DSM_DIR` environment variables postBuild = '' @@ -152,13 +192,13 @@ buildEnv { ln --symbolic --no-target-directory opt/tivoli/tsm/client/api/bin64 $out/dsmi_dir ln --symbolic --no-target-directory "${dsmSysCli}" $out/dsm_dir/dsm.sys ln --symbolic --no-target-directory "${dsmSysApi}" $out/dsmi_dir/dsm.sys - ${lib.optionalString (jdk8==null) "rm $out/bin/dsmj"} + ${lib.optionalString (!enableGui) "rm $out/bin/dsmj"} for bin in $out/bin/* do target=$(readlink "$bin") rm "$bin" makeWrapper "$target" "$bin" \ - --prefix PATH : "$out/dsm_dir:${lib.strings.makeBinPath [ procps acl jdk8 ]}" \ + --prefix PATH : "$out/dsm_dir:${binPath}" \ --set DSM_DIR $out/dsm_dir done ''; |