# Add md5sum and delete this line to complete the PKGBUILD
pkgname=wimlib
-pkgver=@VERSION@
+pkgver=1.0.4
pkgrel=1
pkgdesc="A library to extract, create, and modify WIM files"
arch=("i686" "x86_64")
/* Define to 1 if you have the `ntfs-3g' library (-lntfs-3g). */
#undef HAVE_LIBNTFS_3G
+/* Define to 1 if you have the `lutimes' function. */
+#undef HAVE_LUTIMES
+
/* Define to 1 if you have the <machine/endian.h> header file. */
#undef HAVE_MACHINE_ENDIAN_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the `utime' function. */
+#undef HAVE_UTIME
+
/* Define to 1 if you have the `utimensat' function. */
#undef HAVE_UTIMENSAT
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
doc/imagex-split.1
doc/imagex-unmount.1
doc/mkwinpeimg.1
- rpm/wimlib.spec
- archlinux/PKGBUILD
])
AC_PROG_CC
AM_PROG_CC_C_O
-AC_CHECK_FUNCS([utimensat])
+AC_CHECK_FUNCS([utimensat lutimes utime])
AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
- errno.h attr/xattr.h])
+ errno.h attr/xattr.h utime.h])
AM_ICONV
--- /dev/null
+Summary: Library to extract, create, and modify WIM files
+Name: wimlib
+Version: 1.0.4
+Release: 1
+License: GPLv3+
+Group: System/Libraries
+URL: http://wimlib.sourceforge.net
+Packager: Eric Biggers <ebiggers3@gmail.com>
+Source: http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: libxml2, openssl
+BuildRequires: libxml2-devel, openssl-devel
+%description
+wimlib is a library that can be used to create, extract, and modify files in the
+Windows Imaging Format. These files are normally created by the 'imagex.exe'
+program on Windows, but this library provides a free implementation of 'imagex'
+for UNIX-based systems. wimlib supports mounting WIM files, just like
+imagex.exe.
+
+%package devel
+Summary: Development files for wimlib
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Development files for wimlib
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%configure --prefix=/usr \
+ --disable-rpath \
+ --with-libcrypto \
+ --without-ntfs-3g \
+ --without-fuse \
+ --disable-xattr \
+ --disable-verify-compression \
+ --disable-custom-memory-allocator \
+ --disable-assertions
+%__make %{?_smp_mflags}
+
+%check
+make check
+
+%install
+%__rm -rf %{buildroot}
+%__make DESTDIR=%{buildroot} install
+
+%clean
+%__rm -rf %{buildroot}
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-, root, root)
+%doc AUTHORS COPYING README TODO
+%{_bindir}/imagex
+%{_bindir}/mkwinpeimg
+%{_libdir}/libwim.so
+%{_libdir}/libwim.so.0
+%{_libdir}/libwim.so.0.0.0
+%doc %{_mandir}/man1/*.1.gz
+
+%files devel
+%defattr(-, root, root)
+%{_libdir}/libwim.a
+%{_libdir}/libwim.la
+%{_includedir}/wimlib.h
+%{_libdir}/pkgconfig/wimlib.pc
--- /dev/null
+Summary: Library to extract, create, and modify WIM files
+Name: wimlib
+Version: 1.0.4
+Release: 1
+License: GPLv3+
+Group: System/Libraries
+URL: http://wimlib.sourceforge.net
+Packager: Eric Biggers <ebiggers3@gmail.com>
+Source: http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: libxml2, fuse-libs, fuse, openssl
+BuildRequires: libxml2-devel, fuse-devel, openssl-devel, libattr-devel, fuse
+%description
+wimlib is a library that can be used to create, extract, and modify files in the
+Windows Imaging Format. These files are normally created by the 'imagex.exe'
+program on Windows, but this library provides a free implementation of 'imagex'
+for UNIX-based systems. wimlib supports mounting WIM files, just like
+imagex.exe.
+
+%package devel
+Summary: Development files for wimlib
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Development files for wimlib
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%configure --prefix=/usr \
+ --disable-rpath \
+ --with-libcrypto \
+ --without-ntfs-3g \
+ --enable-xattr \
+ --disable-verify-compression
+%__make %{?_smp_mflags}
+
+%check
+make check
+
+%install
+%__rm -rf %{buildroot}
+%__make DESTDIR=%{buildroot} install
+
+%clean
+%__rm -rf %{buildroot}
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-, root, root)
+%doc AUTHORS COPYING README TODO
+%{_bindir}/imagex
+%{_bindir}/mkwinpeimg
+%{_libdir}/libwim.so
+%{_libdir}/libwim.so.0
+%{_libdir}/libwim.so.0.0.0
+%doc %{_mandir}/man1/*.1.gz
+
+%files devel
+%defattr(-, root, root)
+%{_libdir}/libwim.a
+%{_libdir}/libwim.la
+%{_includedir}/wimlib.h
+%{_libdir}/pkgconfig/wimlib.pc
Summary: Library to extract, create, and modify WIM files
Name: wimlib
-Version: @VERSION@
+Version: 1.0.4
Release: 1
License: GPLv3+
Group: System/Libraries
Requires: libxml2, fuse-libs, fuse, openssl
Requires: ntfs-3g >= 2:2011.4.12
-BuildRequires: libxml2-devel, fuse-devel, openssl-devel, libattr-devel
+BuildRequires: libxml2-devel, fuse, fuse-devel, openssl-devel, libattr-devel
BuildRequires: ntfs-3g-devel >= 2:2011.4.12, ntfsprogs
%description
wimlib is a library that can be used to create, extract, and modify files in the
Development files for wimlib
%prep
-%setup -q -n %{name}-${version}
+%setup -q -n %{name}-%{version}
%build
%configure --prefix=/usr \
make check
%install
-%__rm -rf ${buildroot}
-%__make DESTDIR=${buildroot} install
+%__rm -rf %{buildroot}
+%__make DESTDIR=%{buildroot} install
%clean
-%__rm -rf ${buildroot}
+%__rm -rf %{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
*/
+#include "config.h"
+
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
+
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
#include <unistd.h>
-#include "config.h"
#include "dentry.h"
#include "lookup_table.h"
#include "timestamp.h"
struct extract_args *args = arg;
size_t len = strlen(args->output_dir);
char output_path[len + dentry->full_path_utf8_len + 1];
+ const struct inode *inode = dentry->d_inode;
+ int ret;
memcpy(output_path, args->output_dir, len);
memcpy(output_path + len, dentry->full_path_utf8, dentry->full_path_utf8_len);
output_path[len + dentry->full_path_utf8_len] = '\0';
struct timeval tv[2];
- wim_timestamp_to_timeval(dentry->d_inode->last_access_time, &tv[0]);
- wim_timestamp_to_timeval(dentry->d_inode->last_write_time, &tv[1]);
- if (lutimes(output_path, tv) != 0) {
+ wim_timestamp_to_timeval(inode->last_access_time, &tv[0]);
+ wim_timestamp_to_timeval(inode->last_write_time, &tv[1]);
+ #ifdef HAVE_LUTIMES
+ ret = lutimes(output_path, tv);
+ #else
+ ret = -1;
+ errno = ENOSYS;
+ #endif
+ if (ret != 0) {
+ #ifdef HAVE_UTIME
+ if (errno == ENOSYS) {
+ struct utimbuf buf;
+ buf.actime = wim_timestamp_to_unix(inode->last_access_time);
+ buf.modtime = wim_timestamp_to_unix(inode->last_write_time);
+ if (utime(output_path, &buf) == 0)
+ return 0;
+ }
+ #endif
if (errno != ENOSYS || args->num_lutimes_warnings < 10) {
WARNING("Failed to set timestamp on file `%s': %s",
output_path, strerror(errno));
{
struct dentry *dentry;
struct inode *inode;
+ WIMStruct *w = wimfs_get_WIMStruct();
+
dentry = get_dentry(w, path);
if (!dentry)
return -ENOENT;
if (lte_ret)
*lte_ret = lte;
return 0;
-out_free_lte:
- if (lte != existing_lte)
- FREE(lte);
out_free_symlink_buf:
FREE(symlink_buf);
return ret;
srcdir=`pwd`
cd tests
+if [ ! -r /dev/fuse ]; then
+ echo "WARNING: /dev/fuse is not readable."
+ echo "Skipping WIM mounting checks"
+ exit 0
+fi
+
imagex() {
echo "imagex $@"
../imagex $@ > /dev/null
}
error() {
- echo "**********************************************"
- echo " Test failure "
- echo $*
- echo "**********************************************"
+ echo "****************************************************************"
+ echo " Test failure "
+ while [ $# -gt 0 ]; do
+ echo $1
+ shift
+ done
+ echo "****************************************************************"
exit 1
}
fi
mkdir tmp
if ! imagex mount dir.wim dir tmp; then
- error "Failde to mount test WIM read-only"
+ error "Failed to mount test WIM read-only" \
+ "Please read any error messages above before reporting this test failure."\
+ "Perhaps you don't have FUSE installed, or the FUSE kernel module isn't" \
+ "loaded, or you aren't a member of the FUSE group?"
fi
echo "Testing extracting file from mounted read-only WIM"
if ! cp tmp/lz.c lz.c; then