Skip to content

Commit

Permalink
bustype detection with smartctl works (again?)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggruber committed Oct 5, 2023
2 parents 44e72a1 + e17771b commit 1f3009e
Show file tree
Hide file tree
Showing 51 changed files with 95 additions and 8 deletions.
1 change: 1 addition & 0 deletions config.guess
1 change: 1 addition & 0 deletions config.sub
85 changes: 85 additions & 0 deletions configure.ac~
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.64])
AC_INIT([nwipe], [0.34], [[email protected]])
AM_INIT_AUTOMAKE(foreign subdir-objects)
AC_OUTPUT(Makefile src/Makefile man/Makefile)
AC_CONFIG_SRCDIR([src/nwipe.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC
PKG_PROG_PKG_CONFIG

# Checks for libraries.

PKG_CHECK_MODULES(
[PANEL],
[panel],
[
CFLAGS="${CFLAGS} ${PANEL_CFLAGS}"
LIBS="${LIBS} ${PANEL_LIBS}"
],
[AC_CHECK_LIB([panel], [main], [
LIBS="-lpanel $LIBS"
AC_CHECK_HEADERS(panel.h,, [
AC_CHECK_HEADERS(ncurses/panel.h, [
AC_DEFINE([PANEL_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses panel headers not found])])
])
], [AC_MSG_ERROR([ncurses panel library not found])])]
)

PKG_CHECK_MODULES(
[NCURSES],
[ncurses],
[
CFLAGS="${CFLAGS} ${NCURSES_CFLAGS}"
LIBS="${LIBS} ${NCURSES_LIBS}"
],
[AC_CHECK_LIB([ncurses], [delscreen], [
LIBS="-lncurses $LIBS"
AC_CHECK_HEADERS(ncurses.h,, [
AC_CHECK_HEADERS(ncurses/ncurses.h, [
AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses headers not found])])
])
], [AC_MSG_ERROR([ncurses development library not found])]
)]
)

PKG_CHECK_MODULES(
[LIBCONFIG],
[libconfig],
[
CFLAGS="${CFLAGS} ${LIBCONFIG_CFLAGS}"
LIBS="${LIBS} ${LIBCONFIG_LIBS}"
],
[AC_CHECK_LIB([libconfig], [main], [
LIBS="-llibconfig $LIBS"
AC_CHECK_HEADERS(libconfig.h,, [
AC_CHECK_HEADERS(libconfig.h, [
AC_DEFINE([LIBCONFIG_IN_SUBDIR], [libconfig/], [Look for libconfig headers in subdir])
], [AC_MSG_ERROR([libconfig headers not found])])
])
], [AC_MSG_ERROR([libconfig library not found])])]
)

AC_CHECK_LIB([intl], [libintl_dgettext]) # needed to statically link libparted, but not given in its pkgconfig file
AC_CHECK_LIB([uuid], [uuid_generate]) # needed to statically link libparted, but not given in its pkgconfig file
PKG_CHECK_MODULES([PARTED], [libparted], [libconfig])
AC_CHECK_LIB([pthread], [main], ,[AC_MSG_ERROR([pthread development library not found])])

# Checks for header files.
AC_CHECK_HEADERS([libconfig.h fcntl.h inttypes.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/ioctl.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_blksize])

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([fdatasync memset regcomp strdup strerror])

AC_OUTPUT
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 8 additions & 8 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,10 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c
{
/* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */
trim( &result[19] );
for( idx = 19; result[idx]; idx++ )
{
result[idx] = tolower( result[idx] );
}
for( idx = 19; result[idx]; idx++ )
{
result[idx] = tolower( result[idx] );
}

if( strncmp( &result[19], "sas", 3 ) == 0 )
{
Expand All @@ -792,10 +792,10 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c

/* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */
trim( &result[16] );
for( idx = 16; result[idx]; idx++ )
{
result[idx] = tolower( result[idx] );
}
for( idx = 16; result[idx]; idx++ )
{
result[idx] = tolower( result[idx] );
}

if( strncmp( &result[16], "sata", 4 ) == 0 )
{
Expand Down

0 comments on commit 1f3009e

Please sign in to comment.