Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pkgs/development/libraries/libblockdev/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, gtk-doc, libxslt, docbook_xsl
, python3, gobjectIntrospection, glib, libudev, kmod, parted, cryptsetup
, devicemapper, dmraid, utillinux, libbytesize, nss, volume_key
}:

let
version = "2.16";
in stdenv.mkDerivation rec {
name = "libblockdev-${version}";

src = fetchFromGitHub {
owner = "storaged-project";
repo = "libblockdev";
rev = "${version}-1";
sha256 = "02jdvafjbd280vz2mg5488xwdl595yyajaffrpfmfzbva513sxxc";
};

outputs = [ "out" "dev" "devdoc" ];
outputBin = "dev";

postPatch = ''
patchShebangs scripts
'';

nativeBuildInputs = [
autoreconfHook pkgconfig gtk-doc libxslt docbook_xsl python3 gobjectIntrospection
];

buildInputs = [
glib libudev kmod parted cryptsetup devicemapper dmraid utillinux libbytesize nss volume_key
];

meta = with stdenv.lib; {
description = "A library for manipulating block devices";
homepage = http://storaged.org/libblockdev/;
license = licenses.lgpl2Plus; # lgpl2Plus for the library, gpl2Plus for the utils
maintainers = with maintainers; [];
platforms = platforms.linux;
};
}
30 changes: 30 additions & 0 deletions pkgs/development/libraries/libbytesize/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, gettext, gtk-doc, libxslt, docbook_xsl
, python3, pcre, gmp, mpfr
}:

let
version = "1.2";
in stdenv.mkDerivation rec {
name = "libbytesize-${version}";

src = fetchFromGitHub {
owner = "storaged-project";
repo = "libbytesize";
rev = version;
sha256 = "0r71ml7qjfai08rr1hk61lmf5h3niwy9f1x5xq9k76ccls6gixmc";
};

outputs = [ "out" "dev" "devdoc" ];

nativeBuildInputs = [ autoreconfHook pkgconfig gettext gtk-doc libxslt docbook_xsl python3 ];

buildInputs = [ pcre gmp mpfr ];

meta = with stdenv.lib; {
description = "A tiny library providing a C “class” for working with arbitrary big sizes in bytes";
homepage = src.meta.homepage;
license = licenses.lgpl2Plus;
maintainers = with maintainers; [];
platforms = platforms.linux;
};
}
49 changes: 49 additions & 0 deletions pkgs/development/libraries/volume-key/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ stdenv, fetchgit, fetchpatch, autoreconfHook, pkgconfig, gettext, python2
, swig, glib, utillinux, cryptsetup, nss, gpgme
}:

let
version = "0.3.9";
in stdenv.mkDerivation rec {
name = "volume_key-${version}";

src = fetchgit {
url = https://pagure.io/volume_key.git;
rev = name;
sha256 = "1773432gd9vhwj7lfmk6bwybm7lkc3rmblp865gm0flkqlkhr537";
};

outputs = [ "out" "man" "dev" ];
outputBin = "dev";

nativeBuildInputs = [ autoreconfHook pkgconfig gettext python2 swig ];

buildInputs = [ glib cryptsetup nss utillinux gpgme ];

patches = [
# Do not include config.h in libvolume_key.h
(fetchpatch {
url = https://pagure.io/volume_key/c/8f8698aba19b501f01285e9eec5c18231fc6bcea.patch;
sha256 = "0jcrakjgzjb8zmzlyv40fiwkzr2j0ni8ksgg6633x9zkf4q5ay9n";
})
# Fix compatibility with cryptsetup 2.0
(fetchpatch {
url = https://pagure.io/volume_key/c/ecef526a51c5a276681472fd6df239570c9ce518.patch;
sha256 = "1cadn7hd2q05yjlvvnnwy6vdwxs8wvm48ab7jqrpby7l7jz4zmx2";
})
# Use pkg-config for locating Python.h
# https://pagure.io/volume_key/pull-request/12
(fetchpatch {
url = https://pagure.io/fork/cathay4t/volume_key/c/028106f408206dcabece6ee7cbe09ef3bb327988.patch;
sha256 = "1c82wilr5kxjq04740xcd9pmxzrk82g7mn2sicbz0g7x5c1qgs0b";
})
];

meta = with stdenv.lib; {
description = "A library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases, and the associated command-line tool";
homepage = https://pagure.io/volume_key/;
license = licenses.gpl2;
maintainers = with maintainers; [];
platforms = platforms.linux;
};
}
76 changes: 47 additions & 29 deletions pkgs/os-specific/linux/udisks/2-default.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
{ stdenv, fetchurl, pkgconfig, intltool, gnused
, expat, acl, systemd, glib, libatasmart, polkit
, libxslt, docbook_xsl, utillinux, mdadm, libgudev
, gobjectIntrospection
{ stdenv, fetchFromGitHub, substituteAll, libtool, pkgconfig, intltool, gnused
, gnome3, gtk-doc, acl, systemd, glib, libatasmart, polkit, coreutils, bash
, expat, libxslt, docbook_xsl, utillinux, mdadm, libgudev, libblockdev, parted
, gobjectIntrospection, docbook_xml_dtd_43
, libxfs, f2fs-tools, dosfstools, e2fsprogs, btrfs-progs, exfat, nilfs-utils, udftools, ntfs3g
}:

stdenv.mkDerivation rec {
name = "udisks-2.1.6";
let
version = "2.7.6";
in stdenv.mkDerivation rec {
name = "udisks-${version}";

src = fetchurl {
url = "http://udisks.freedesktop.org/releases/${name}.tar.bz2";
sha256 = "0spl155k0g2l2hvqf8xyjv08i68gfyhzpjva6cwlzxx0bz4gbify";
src = fetchFromGitHub {
owner = "storaged-project";
repo = "udisks";
rev = name;
sha256 = "16kf104vv2xbk8cdgaqygszcl69d7lz9gf3vmi7ggywn7nfbp2ks";
};

outputs = [ "out" "man" "dev" ];
outputs = [ "out" "man" "dev" "devdoc" ];

patches = [ ./force-path.patch ];
patches = [
(substituteAll {
src = ./fix-paths.patch;
bash = "${bash}/bin/bash";
blkid = "${utillinux}/bin/blkid";
false = "${coreutils}/bin/false";
mdadm = "${mdadm}/bin/mdadm";
sed = "${gnused}/bin/sed";
sh = "${bash}/bin/sh";
sleep = "${coreutils}/bin/sleep";
true = "${coreutils}/bin/true";
})
(substituteAll {
src = ./force-path.patch;
path = stdenv.lib.makeBinPath [ btrfs-progs coreutils dosfstools e2fsprogs exfat f2fs-tools nilfs-utils libxfs ntfs3g parted utillinux ];
})
];

# FIXME remove /var/run/current-system/sw/* references
# FIXME add references to parted, cryptsetup, etc (see the sources)
postPatch =
''
substituteInPlace src/main.c --replace \
"@path@" \
"${utillinux}/bin:${mdadm}/bin:/run/current-system/sw/bin"
substituteInPlace data/80-udisks2.rules \
--replace "/bin/sh" "${stdenv.shell}" \
--replace "/sbin/mdadm" "${mdadm}/bin/mdadm" \
--replace " sed " " ${gnused}/bin/sed "
'';
nativeBuildInputs = [
pkgconfig gnome3.gnome-common libtool intltool gobjectIntrospection
gtk-doc libxslt docbook_xml_dtd_43 docbook_xsl
];

nativeBuildInputs = [ pkgconfig intltool gobjectIntrospection ];
buildInputs = [
expat libgudev libblockdev acl systemd glib libatasmart polkit
];

buildInputs = [ libxslt docbook_xsl libgudev expat acl systemd glib libatasmart polkit ];
preConfigure = "./autogen.sh";

configureFlags = [
"--enable-gtk-doc"
"--localstatedir=/var"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
"--with-udevdir=$(out)/lib/udev"
Expand All @@ -44,9 +60,11 @@ stdenv.mkDerivation rec {
"INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0"
];

meta = {
homepage = http://www.freedesktop.org/wiki/Software/udisks;
description = "A daemon and command-line utility for querying and manipulating storage devices";
platforms = stdenv.lib.platforms.linux;
meta = with stdenv.lib; {
description = "A daemon, tools and libraries to access and manipulate disks, storage devices and technologies";
homepage = https://www.freedesktop.org/wiki/Software/udisks/;
license = licenses.gpl2Plus; # lgpl2Plus for the library, gpl2Plus for the tools & daemon
maintainers = with maintainers; [];
platforms = platforms.linux;
};
}
131 changes: 131 additions & 0 deletions pkgs/os-specific/linux/udisks/fix-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in

-SHELL = /bin/bash
+SHELL = @bash@
.SHELLFLAGS = -o pipefail -c

PYTHON ?= python3
--- a/data/80-udisks2.rules
+++ b/data/80-udisks2.rules
@@ -17,9 +17,9 @@
#
# TODO: file bug against mdadm(8) to have --export-prefix option that can be used with e.g. UDISKS_MD_MEMBER
#
-SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="raid", ENV{ID_FS_TYPE}=="linux_raid_member", ENV{UDISKS_MD_MEMBER_LEVEL}=="", IMPORT{program}="/bin/sh -c '/sbin/mdadm --examine --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_MEMBER_/g'"
+SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="raid", ENV{ID_FS_TYPE}=="linux_raid_member", ENV{UDISKS_MD_MEMBER_LEVEL}=="", IMPORT{program}="@sh@ -c '@mdadm@ --examine --export $tempnode | @sed@ s/^MD_/UDISKS_MD_MEMBER_/g'"

-SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="/bin/sh -c '/sbin/mdadm --detail --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_/g'"
+SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="@sh@ -c '@mdadm@ --detail --export $tempnode | @sed@ s/^MD_/UDISKS_MD_/g'"

LABEL="udisks_probe_end"

--- a/modules/zram/udiskslinuxmanagerzram.c
+++ b/modules/zram/udiskslinuxmanagerzram.c
@@ -250,7 +250,7 @@

g_snprintf (tmp, 255, "zram%" G_GUINT64_FORMAT, i);
filename = g_build_filename (PACKAGE_ZRAMCONF_DIR, tmp, NULL);
- contents = g_strdup_printf ("#!/bin/bash\n\n"
+ contents = g_strdup_printf ("#!@bash@\n\n"
"ZRAM_NUM_STR=%" G_GUINT64_FORMAT "\n"
"ZRAM_DEV_SIZE=%" G_GUINT64_FORMAT "\n"
"SWAP=n\n",
--- a/src/tests/install-udisks/runtest.sh
+++ b/src/tests/install-udisks/runtest.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!@bash@
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
--- a/src/tests/integration-test
+++ b/src/tests/integration-test
@@ -414,7 +414,7 @@
f.write('KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", '
'ATTRS{model}=="scsi_debug*", '
'ENV{ID_CDROM_MEDIA}=="?*", '
- 'IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"\n')
+ 'IMPORT{program}="@blkid@ -o udev -p -u noraid $tempnode"\n')
# reload udev
subprocess.call('sync; pkill --signal HUP udevd || '
'pkill --signal HUP systemd-udevd',
@@ -1079,7 +1079,7 @@
self.assertFalse(os.access(f, os.X_OK))

f = os.path.join(mount_point, 'simple.exe')
- shutil.copy('/bin/bash', f)
+ shutil.copy('@bash@', f)
self.assertTrue(os.access(f, os.R_OK))
self.assertTrue(os.access(f, os.W_OK))
self.assertTrue(os.access(f, os.X_OK))
@@ -1092,7 +1092,7 @@
self.assertFalse(os.access(f, os.X_OK))

f = os.path.join(mount_point, 'subdir', 'subdir.exe')
- shutil.copy('/bin/bash', f)
+ shutil.copy('@bash@', f)
self.assertTrue(os.access(f, os.R_OK))
self.assertTrue(os.access(f, os.W_OK))
self.assertTrue(os.access(f, os.X_OK))
--- a/src/tests/storadectl/runtest.sh
+++ b/src/tests/storadectl/runtest.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!@bash@
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -71,7 +71,7 @@
{
UDisksSpawnedJob *job;

- job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, NULL);
+ job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, NULL);
udisks_spawned_job_start (job);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_success), NULL);
g_object_unref (job);
@@ -84,10 +84,10 @@
{
UDisksSpawnedJob *job;

- job = udisks_spawned_job_new ("/bin/false", NULL, getuid (), geteuid (), NULL, NULL);
+ job = udisks_spawned_job_new ("@false@", NULL, getuid (), geteuid (), NULL, NULL);
udisks_spawned_job_start (job);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
- (gpointer) "Command-line `/bin/false' exited with non-zero exit status 1: ");
+ (gpointer) "Command-line `@false@' exited with non-zero exit status 1: ");
g_object_unref (job);
}

@@ -119,7 +119,7 @@

cancellable = g_cancellable_new ();
g_cancellable_cancel (cancellable);
- job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, cancellable);
+ job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, cancellable);
udisks_spawned_job_start (job);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
(gpointer) "Operation was cancelled (g-io-error-quark, 19)");
@@ -145,7 +145,7 @@
GCancellable *cancellable;

cancellable = g_cancellable_new ();
- job = udisks_spawned_job_new ("/bin/sleep 0.5", NULL, getuid (), geteuid (), NULL, cancellable);
+ job = udisks_spawned_job_new ("@sleep@ 0.5", NULL, getuid (), geteuid (), NULL, cancellable);
udisks_spawned_job_start (job);
g_timeout_add (10, on_timeout, cancellable); /* 10 msec */
g_main_loop_run (loop);
@@ -199,7 +199,7 @@
{
UDisksSpawnedJob *job;

- job = udisks_spawned_job_new ("/bin/sleep 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */);
+ job = udisks_spawned_job_new ("@sleep@ 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */);
udisks_spawned_job_start (job);
g_object_unref (job);
}
6 changes: 6 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5189,6 +5189,8 @@ with pkgs;

vobsub2srt = callPackage ../tools/cd-dvd/vobsub2srt { };

volume_key = callPackage ../development/libraries/volume-key { };

vorbisgain = callPackage ../tools/misc/vorbisgain { };

vpnc = callPackage ../tools/networking/vpnc { };
Expand Down Expand Up @@ -9435,6 +9437,8 @@ with pkgs;

libbdplus = callPackage ../development/libraries/libbdplus { };

libblockdev = callPackage ../development/libraries/libblockdev { };

libblocksruntime = callPackage ../development/libraries/libblocksruntime { };

libbluray = callPackage ../development/libraries/libbluray { };
Expand All @@ -9445,6 +9449,8 @@ with pkgs;

libburn = callPackage ../development/libraries/libburn { };

libbytesize= callPackage ../development/libraries/libbytesize{ };

libcaca = callPackage ../development/libraries/libcaca {
inherit (xlibs) libX11 libXext;
};
Expand Down