Skip to content

Commit

Permalink
sync to master, rescan nvme properly #81
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jun 18, 2020
2 parents 741744d + c0888da commit 3d9c4a4
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 328 deletions.
11 changes: 2 additions & 9 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,23 @@ name: debian-unstable

steps:
- name: debian-build
image: dankamongmen/unstable_builder:2020-02-05a
image: dankamongmen/unstable_builder:2020-05-27a
commands:
- apt-get update
- apt-get -y install git-buildpackage
- export LANG=en_US.UTF-8
- mk-build-deps --install -t'apt-get -y'
- autoreconf -fis
- ./configure
- make
- make test
---
kind: pipeline
type: docker
name: ubuntu-focal

steps:
- name: ubuntu-build
image: dankamongmen/focal:2020-02-05a
image: dankamongmen/focal:2020-05-27a
commands:
- apt-get update
- apt-get -y install git-buildpackage
- export LANG=en_US.UTF-8
- mk-build-deps --install -t'apt-get -y'
- autoreconf -fis
- ./configure
- make
- make test
11 changes: 2 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ AM_CPPFLAGS=-D_GNU_SOURCE

bin_PROGRAMS=growlight-readline
bin_PROGRAMS+=growlight
bin_PROGRAMS+=growlight-test

TESTS=growlight-test

common_SOURCES=src/growlight.c src/growlight.h src/mbr.c src/mbr.h \
src/libblkid.c src/libblkid.h src/apm.c src/apm.h src/ssd.h src/ssd.c \
Expand All @@ -51,12 +48,8 @@ growlight_SOURCES=$(common_SOURCES)
growlight_SOURCES+=src/notcurses.c src/notcurses.h src/notui-aggregate.h src/notui-aggregate.c
growlight_LDADD=@notcurses_LIBS@

growlight_test_SOURCES=$(common_SOURCES)
growlight_test_SOURCES+=test/growlight.c
growlight_test_LDADD=$(CUNIT_LIBS)

#XSLTARGS=--nonet /usr/share/xml/docbook/stylesheet/docbook-xsl
XSLTARGS=http://docbook.sourceforge.net/release/xsl/current
XSLTARGS=--nonet /usr/share/xml/docbook/stylesheet/docbook-xsl
#XSLTARGS=http://docbook.sourceforge.net/release/xsl/current

$(dist_man_MANS): %.8: $(doc_DIR)/man/man8/%.xml $(doc_DIR)/@[email protected]
$(XSLTPROC) --path $(doc_DIR) -o $@ $(XSLTARGS)/manpages/docbook.xsl $<
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ https://nick-black.com/dankwiki/index.php/Growlight

Dependencies:

- notcurses 1.1.6+
- notcurses 1.4.2+
- libudev 175+
- libblkid 2.20.1+
- libblkid 2.20.1

- libpci 3.1.9+
- libpciaccess 0.13.1+
- libdevmapper 1.02.74+
Expand All @@ -34,7 +35,6 @@ Build-only dependencies:
- docbook-xsl (tested with 4.5)
- autotools (tested with 1.11)
- pkg-config (tested with 0.29)
- cunit (tested with 2.1)
- autoconf-archive (tested with 2018+)

Building from a git checkout:
Expand Down
7 changes: 2 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ([2.61])
AC_INIT([growlight], [1.2.0], [[email protected]], [growlight], [https://nick-black.com/dankwiki/index.php/Growlight])
AC_INIT([growlight], [1.2.5], [[email protected]], [growlight], [https://nick-black.com/dankwiki/index.php/Growlight])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([-Wall foreign dist-xz no-dist-gzip std-options subdir-objects nostdinc])
AC_CONFIG_HEADER([src/config.h])
Expand Down Expand Up @@ -62,9 +62,6 @@ AX_LIB_READLINE
AC_CHECK_LIB([readline], [main], [have_readline=yes],
[AC_MSG_ERROR([Cannot find libreadline.])])

# CUnit (unit testing)
PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes])

# Remaining dependencies are needed by all binaries.
AC_CHECK_LIB(pciaccess, pci_system_init, [have_pciaccess=yes],
[AC_MSG_ERROR([Cannot find libpciaccess.])])
Expand All @@ -75,7 +72,7 @@ AC_CHECK_LIB(pci, pci_get_dev, [have_libpci=yes],
LIBS+=" -lpci"

if test "x$notcurses" = "xtrue" ; then
PKG_CHECK_MODULES([notcurses], [notcurses >= 1.1.6])
PKG_CHECK_MODULES([notcurses], [notcurses >= 1.4.3])
notcurses_CFLAGS+=" $notcurses_CFLAGS"
notcurses_LIBS+=" $notcurses_LIBS"
fi
Expand Down
54 changes: 3 additions & 51 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,53 +1,5 @@
growlight (1.2.1-1) UNRELEASED; urgency=medium
growlight (1.2.5-1) unstable; urgency=medium

* Debian policy 4.5.0
* Update copyrights
* New upstream version

-- Nick Black <[email protected]> Wed, 22 Jan 2020 22:40:15 -0500

growlight (1.2.0-1) unstable; urgency=medium

* Swap out GUI for notcurses, add dep on notcurses

-- Nick Black <[email protected]> Thu, 12 Dec 2019 11:51:45 -0500

growlight (1.1.3.3-1) unstable; urgency=medium

* Reenable ZFS support; build-dep on libzfslinux-dev
* Require outcurses 0.0.7+

-- Nick Black <[email protected]> Sun, 17 Nov 2019 06:38:28 -0500

growlight (1.1.3-1) unstable; urgency=medium

* New upstream release, fixes assert()s in ncurses UI
* Compile with -D_FORTIFY_SOURCE=2

-- Nick Black <[email protected]> Sun, 27 Oct 2019 05:37:40 -0400

growlight (1.1.1.1-1) unstable; urgency=medium

* New upstream release
* Debian policy 4.4.1.1, no changes necessary
* Use liboutcurses-dev for enmetric()

-- Nick Black <[email protected]> Sat, 26 Oct 2019 14:12:15 -0400

growlight (1.1.1-1) unstable; urgency=medium

* New upstream release
* Debhelper 12

-- Nick Black <[email protected]> Thu, 19 Sep 2019 09:07:34 -0400

growlight (1.1.0.1-2) unstable; urgency=medium

* Debian standards -> 4.4.0.1

-- nick black <[email protected]> Sun, 25 Aug 2019 18:47:15 -0400

growlight (1.1.0.1-1) unstable; urgency=medium

* Initial debianization

-- nick black <[email protected]> Fri, 09 Aug 2019 01:03:03 -0400
-- Nick Black <[email protected]> Wed, 27 May 2020 19:52:13 -0400
1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

40 changes: 20 additions & 20 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
Source: growlight
Section: utils
Priority: optional
Maintainer: Nick Black <[email protected]>
Build-Depends:
autoconf-archive,
debhelper (>= 12),
docbook-xsl,
libatasmart-dev,
libblkid-dev,
libcryptsetup-dev,
libcunit1-ncurses-dev,
libdevmapper-dev,
libnotcurses-dev (>= 1.1.6),
libpci-dev,
libpciaccess-dev,
libreadline-dev,
libssl-dev,
libudev-dev,
libzfslinux-dev (>= 0.8.0),
pkg-config,
xsltproc,
Standards-Version: 4.5.0
Build-Depends: autoconf-archive,
debhelper (>= 13),
docbook-xsl,
libatasmart-dev,
libblkid-dev,
libcryptsetup-dev,
libdevmapper-dev,
libnotcurses-dev (>= 1.4.3),
libpci-dev,
libpciaccess-dev,
libreadline-dev,
libssl-dev,
libudev-dev,
libzfslinux-dev (>= 0.8.0),
pkg-config,
xsltproc
Section: utils
Standards-Version: 4.5.0.2
Rules-Requires-Root: no
Homepage: https://nick-black.com/dankwiki/index.php/Growlight
Vcs-Browser: https://github.com/dankamongmen/growlight
Vcs-Git: https://github.com/dankamongmen/growlight.git

Package: growlight
Architecture: any
Multi-Arch: foreign
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Disk manipulation and system preparation tool
Growlight can manipulate both real and virtual (mdadm, device-mapper, and ZFS)
Expand Down
23 changes: 4 additions & 19 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
dh $@


# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_configure:
dh_auto_configure -- --disable-zfs
7 changes: 0 additions & 7 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# Example watch control file for uscan
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# See uscan(1) for format

# Compulsory line, this is a version 4 file
version=4

opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%growlight-$1.tar.gz%" \
https://github.com/dankamongmen/growlight/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate
32 changes: 23 additions & 9 deletions src/growlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -2108,10 +2108,17 @@ int rescan_controller(controller *c){
diag("Can't rescan unknown/virtual controllers\n");
return -1;
}
if(snprintf(buf, sizeof(buf), "%s/device/rescan", c->sysfs) >= (int)sizeof(buf)){
diag("Name too long: %s\n", c->sysfs);
return -1;
}
if(c->transport == TRANSPORT_NVME){
if(snprintf(buf, sizeof(buf), "%s/device/rescan_controller", c->sysfs) >= (int)sizeof(buf)){
diag("Name too long: %s\n", c->sysfs);
return -1;
}
}else{
if(snprintf(buf, sizeof(buf), "%s/device/rescan", c->sysfs) >= (int)sizeof(buf)){
diag("Name too long: %s\n", c->sysfs);
return -1;
}
}
if(write_sysfs(buf, "1\n")){
return -1;
}
Expand Down Expand Up @@ -2159,12 +2166,19 @@ rescan_blockdev_internal(const device *d, int killedpart){
char buf[PATH_MAX];
int fd;

if(snprintf(buf, sizeof(buf), SYSROOT"/%s/device/rescan", d->name) >= (int)sizeof(buf)){
diag("Name too long: %s\n", d->name);
return -1;
}
if(d->c->transport == TRANSPORT_NVME){
if(snprintf(buf, sizeof(buf), "%s/rescan", d->c->sysfs) >= (int)sizeof(buf)){
diag("Name too long: %s\n", d->c->sysfs);
return -1;
}
}else{
if(snprintf(buf, sizeof(buf), SYSROOT"/%s/device/rescan", d->name) >= (int)sizeof(buf)){
diag("Name too long: %s\n", d->name);
return -1;
}
}
if(write_sysfs(buf, "1\n")){
diag("Failed writing to %s/rescan (%s?)\n", d->name, strerror(errno));
diag("Failed writing to %s (%s?)\n", buf, strerror(errno));
return -1;
}
diag("Wrote '1' to %s\n", buf);
Expand Down
2 changes: 1 addition & 1 deletion src/growlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <notcurses.h>
#include <notcurses/notcurses.h>

#include "gpt.h"
#include "stats.h"
Expand Down
Loading

0 comments on commit 3d9c4a4

Please sign in to comment.