tizen 2.0
[framework/base/util-linux-ng.git] / packaging / losetup-2.16.2.patch
1 diff -Naur util-linux-ng/configure.ac losetup-2.16.2/configure.ac
2 --- util-linux-ng/configure.ac  2012-07-23 15:26:57.000000000 +0530
3 +++ losetup-2.16.2/configure.ac 2012-07-23 15:47:41.000000000 +0530
4 @@ -17,20 +17,6 @@
5                                                | awk -F- '{print $1}')
6  PACKAGE_VERSION_RELEASE=0
7
8 -dnl libblkid version
9 -LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
10 -LIBBLKID_DATE="10-Feb-2009"
11 -LIBBLKID_LT_MAJOR=1
12 -LIBBLKID_LT_MINOR=1
13 -LIBBLKID_LT_MICRO=0
14 -LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
15 -
16 -dnl libuuid version
17 -LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
18 -LIBUUID_LT_MAJOR=1
19 -LIBUUID_LT_MINOR=3
20 -LIBUUID_LT_MICRO=0
21 -LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
22
23  # Check whether exec_prefix=/usr:
24  case $exec_prefix:$prefix in
25 @@ -256,177 +242,16 @@
26  AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
27
28
29 -AC_ARG_ENABLE([fsck],
30 -  AS_HELP_STRING([--disable-fsck], [do not build fsck]),
31 -  [], enable_fsck=yes
32 -)
33 -AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes)
34 -
35 -
36 -AC_ARG_ENABLE([libuuid],
37 -  AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
38 -  [], enable_libuuid=yes
39 -)
40 -AC_SUBST([LIBUUID_VERSION])
41 -AC_SUBST([LIBUUID_VERSION_INFO])
42 -AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes)
43 -have_uuid=yes
44 -
45 -if test "x$enable_libuuid" = xno; then
46 -  # Check for external (e2fsprogs) libuuid
47 -  PKG_CHECK_MODULES(UUID, uuid, [have_uuid=yes], [have_uuid=no])
48 -  if test "x$have_uuid" = xno; then
49 -    # system without pkg-config or so, try classic check
50 -    AC_CHECK_LIB(uuid, uuid_is_null, [have_uuid=yes], [have_uuid=no])
51 -  fi
52 -  if test "x$have_uuid" = xyes; then
53 -    UTIL_SET_FLAGS($UUID_CFLAGS, $UUID_CFLAGS, $UUID_LIBS)
54 -    AC_CHECK_HEADERS([uuid.h uuid/uuid.h], [break], [])
55 -    UTIL_RESTORE_FLAGS
56 -  fi
57 -else
58 -  # internal library
59 -  AC_DEFINE(HAVE_UUID_H, 1, [Define to 1 if you have the <uuid.h> header file.])
60 -fi
61 -
62 -if test "x$have_uuid" = xyes; then
63 -  AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
64 -else
65 -  AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
66 -fi
67 -AM_CONDITIONAL(HAVE_UUID, test "x$have_uuid" = xyes)
68 -# default
69 -: ${UUID_LIBS='-luuid'}
70 -
71 -
72 -AC_ARG_ENABLE([uuidd],
73 -  AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
74 -  [], enable_uuidd=auto
75 -)
76
77 -case "$enable_uuidd:$have_uuid" in
78 -yes:no)
79 -  AC_MSG_ERROR([cannot enable uuidd when libuuid is disabled]) ;;
80 -auto:*)
81 -  enable_uuidd=$have_uuid ;;
82 -esac
83 -if test "x$enable_uuidd" = xyes; then
84 -  AC_DEFINE(HAVE_UUIDD, 1, [Define to 1 if you want to use uuid daemon.])
85 -fi
86 -AM_CONDITIONAL(BUILD_UUIDD, test "x$enable_uuidd" = xyes)
87 -
88 -
89 -AC_ARG_ENABLE([libblkid],
90 -  AS_HELP_STRING([--disable-libblkid], [do not build libblkid and blkid utilities]),
91 -  [], enable_libblkid=yes
92 -)
93 -AC_SUBST([LIBBLKID_VERSION])
94 -AC_SUBST([LIBBLKID_VERSION_INFO])
95 -AM_CONDITIONAL(BUILD_LIBBLKID, test "x$enable_libblkid" = xyes)
96 -AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string])
97 -AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string])
98 -have_blkid=yes
99 -
100 -if test "x$enable_libblkid" = xno; then
101 -  if test "x$build_mount" = xyes || test "x$enable_fsck" = xyes; then
102 -    # Check for external (e2fsprogs) libblkid
103 -    PKG_CHECK_MODULES(BLKID, blkid, [have_blkid=yes], [have_blkid=no])
104 -    if test "x$have_blkid" = xno; then
105 -      # system without pkg-config or so, try classic check
106 -      AC_CHECK_LIB(blkid, blkid_get_cache, [have_blkid=yes], [have_blkid=no])
107 -    fi
108 -    if test "x$have_blkid" = xyes; then
109 -      UTIL_SET_FLAGS($BLKID_CFLAGS, $BLKID_CFLAGS, $BLKID_LIBS)
110 -      AC_CHECK_HEADERS([blkid.h blkid/blkid.h], [break], [])
111 -      UTIL_RESTORE_FLAGS
112 -    fi
113 -    if test -n "$enable_static_programs"; then
114 -      # TODO check only when mount of fsck are requested
115 -      UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid])
116 -    fi
117 -  fi
118 -else
119 -  # internal library
120 -  AC_DEFINE(HAVE_BLKID_H, 1, [Define to 1 if you have the <blkid.h> header file.])
121 -  AC_DEFINE(HAVE_BLKID_EVALUATE_TAG, 1, [Define to 1 if you have the blkid_evaluate_tag().])
122 -fi
123 -
124 -if test "x$have_blkid" = xyes; then
125 -  AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
126 -else
127 -  if test "x$build_mount" = xyes; then
128 -    AC_MSG_ERROR([libblkid is needed to build util-linux-ng mount])
129 -  fi
130 -  if test "x$enable_fsck" = xyes; then
131 -    AC_MSG_ERROR([libblkid is needed to build util-linux-ng fsck])
132 -  fi
133 -fi
134 -AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes)
135 -# default
136 -: ${BLKID_LIBS='-lblkid -luuid'}
137 -
138 -AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid])
139
140
141  UTIL_CHECK_LIB(util, openpty)
142  UTIL_CHECK_LIB(termcap, tgetnum)
143
144 -AM_GNU_GETTEXT_VERSION([0.14.1])
145 -AM_GNU_GETTEXT([external])
146 -if test -d "$srcdir/po"
147 -then
148 -    ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
149 -else
150 -    ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
151 -fi
152
153 -AC_ARG_WITH([ncurses],
154 -  AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
155 -                                    (--without-ncurses disables all ncurses(w) support)]),
156 -  [], with_ncurses=auto
157 -)
158 -AM_CONDITIONAL(HAVE_NCURSES, false)
159 -
160 -if test "x$with_ncurses" != xno; then
161 -  have_ncurses=no
162 -  AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
163 -    if test "x$with_ncurses" = xauto; then
164 -      UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
165 -      if test "x$have_ncurses" = xyes; then
166 -        NCURSES_LIBS="-lncursesw"
167 -      fi
168 -    fi
169 -    if test "x$have_ncurses" = xno; then
170 -      UTIL_CHECK_LIB(ncurses, initscr)
171 -      if test "x$have_ncurses" = xyes; then
172 -        NCURSES_LIBS="-lncurses"
173 -      fi
174 -    fi
175 -  ])
176 -  if test "x$have_ncurses" = xno; then
177 -    AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
178 -  fi
179 -fi
180 -AC_SUBST([NCURSES_LIBS])
181
182
183 -AC_ARG_WITH([slang],
184 -  AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
185 -  [], with_slang=no
186 -)
187
188 -have_tinfo=no
189 -AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
190 -AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
191 -
192 -use_slang=no
193 -if test "x$with_slang" = xyes; then
194 -  AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
195 -  if test "x$use_slang" = xno; then
196 -    AC_MSG_ERROR([slang selected but slcurses.h not found])
197 -  fi
198 -fi
199 -AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
200
201
202  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
203 @@ -634,244 +459,8 @@
204    [], enable_cramfs=check
205  )
206
207 -if test "x$enable_cramfs" = xno; then
208 -  build_cramfs=no
209 -else
210 -  build_cramfs=yes
211 -  dnl Trick: leave the third parameter empty to get the default action.
212 -  AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
213 -  case $enable_cramfs:$build_cramfs in
214 -  yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
215 -  esac
216 -fi
217 -AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
218 -
219 -
220 -AC_ARG_ENABLE([switch_root],
221 -  AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
222 -  [], enable_switch_root=check
223 -)
224 -
225 -if test "x$enable_switch_root" = xno; then
226 -  build_switch_root=no
227 -else
228 -  build_switch_root=yes
229 -  case $enable_switch_root:$linux_os in
230 -  yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
231 -  check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
232 -            build_switch_root=no;;
233 -  esac
234 -  if test "x$build_switch_root" = xyes; then
235 -    case $enable_switch_root:$have_openat in
236 -    yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
237 -    check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
238 -              build_switch_root=no;;
239 -    esac
240 -  fi
241 -fi
242 -AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
243 -
244 -
245 -AC_ARG_ENABLE([elvtune],
246 -  AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
247 -  [], enable_elvtune=no
248 -)
249 -AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
250 -
251 -
252 -AC_ARG_ENABLE([init],
253 -  AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
254 -  [], enable_init=no
255 -)
256 -AM_CONDITIONAL(BUILD_INIT, test "x$enable_init" = xyes)
257 -
258 -
259 -AC_ARG_ENABLE([kill],
260 -  AS_HELP_STRING([--enable-kill], [build kill]),
261 -  [], enable_kill=no
262 -)
263 -AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
264 -
265 -
266 -AC_ARG_ENABLE([last],
267 -  AS_HELP_STRING([--enable-last], [build last]),
268 -  [], enable_last=no
269 -)
270 -AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
271 -
272 -
273 -AC_ARG_ENABLE([mesg],
274 -  AS_HELP_STRING([--enable-mesg], [build mesg]),
275 -  [], enable_mesg=no
276 -)
277 -AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
278 -
279 -
280 -AC_ARG_ENABLE([partx],
281 -  AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
282 -  [], enable_partx=no
283 -)
284 -AM_CONDITIONAL(BUILD_PARTX, test "x$enable_partx" = xyes)
285 -
286 -
287 -AC_ARG_ENABLE([raw],
288 -  AS_HELP_STRING([--enable-raw], [build raw]),
289 -  [], enable_raw=no
290 -)
291 -AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
292 -
293 -
294 -AC_ARG_ENABLE([rdev],
295 -  AS_HELP_STRING([--enable-rdev], [build rdev on i386]),
296 -  [], enable_rdev=no
297 -)
298 -AM_CONDITIONAL(BUILD_RDEV, test "x$enable_rdev" = xyes)
299 -
300 -
301 -AC_ARG_ENABLE([rename],
302 -  AS_HELP_STRING([--disable-rename], [do not build rename]),
303 -  [], enable_rename=yes
304 -)
305 -AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
306 -
307 -
308 -AC_ARG_ENABLE([reset],
309 -  AS_HELP_STRING([--enable-reset], [build reset]),
310 -  [], enable_reset=no
311 -)
312 -AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
313 -
314 -
315 -AC_ARG_ENABLE([login-utils],
316 -  AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
317 -  [], enable_login_utils=no
318 -)
319 -AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
320 -
321 -AC_ARG_WITH([pam],
322 -  [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
323 -
324 -AM_CONDITIONAL(HAVE_PAM, false)
325 -if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
326 -  AC_CHECK_HEADERS([security/pam_misc.h],
327 -    [AM_CONDITIONAL(HAVE_PAM, true)],
328 -    [if test "x$with_pam" = xyes; then
329 -       AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
330 -     fi
331 -    ])
332 -fi
333 -
334 -AC_ARG_WITH([selinux],
335 -  AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
336 -  [], with_selinux=no
337 -)
338 -
339 -if test "x$with_selinux" = xno; then
340 -  AM_CONDITIONAL(HAVE_SELINUX, false)
341 -else
342 -  UTIL_CHECK_LIB(selinux, getprevcon)
343 -  case "$with_selinux:$have_selinux" in
344 -  yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
345 -  esac
346 -fi
347 -
348 -if test "x$have_selinux" = xyes; then
349 -  SELINUX_LIBS="-lselinux -lsepol"
350 -  SELINUX_LIBS_STATIC="-lselinux -lsepol"
351 -  old_LDFLAGS="$LDFLAGS"
352 -  LDFLAGS="$LDFLAGS $SELINUX_LIBS"
353 -  # This function is missing in old libselinux 1.xx versions
354 -  AC_CHECK_FUNCS([security_get_initial_context])
355 -  LDFLAGS="$old_LDFLAGS"
356 -fi
357 -AC_SUBST([SELINUX_LIBS])
358 -AC_SUBST([SELINUX_LIBS_STATIC])
359 -
360 -AC_ARG_WITH([audit],
361 -  AS_HELP_STRING([--with-audit], [compile with audit support]),
362 -  [], with_audit=no
363 -)
364 -
365 -if test "x$with_audit" = xno; then
366 -  AM_CONDITIONAL(HAVE_AUDIT, false)
367 -else
368 -  UTIL_CHECK_LIB(audit, audit_log_user_message)
369 -  case "$with_audit:$have_audit" in
370 -  yes:no)
371 -   AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
372 -   ;;
373 -  esac
374 -fi
375 -
376 -AC_ARG_ENABLE([schedutils],
377 -  AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
378 -  [], enable_schedutils=yes
379 -)
380 -AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
381 -
382 -
383 -AC_ARG_ENABLE([wall],
384 -  AS_HELP_STRING([--disable-wall], [do not build wall]),
385 -  [], enable_wall=yes
386 -)
387 -AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
388 -
389 -
390 -AC_ARG_ENABLE([write],
391 -  AS_HELP_STRING([--enable-write], [build write]),
392 -  [], enable_write=no
393 -)
394 -AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
395 -
396 -
397 -AC_ARG_ENABLE([chsh-only-listed],
398 -  AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
399 -  [], enable_chsh_only_listed=yes
400 -)
401 -
402 -if test "x$enable_chsh_only_listed" = xyes; then
403 -  AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
404 -fi
405 -
406
407 -AC_ARG_ENABLE([login-chown-vcs],
408 -  AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
409 -  [], enable_login_chown_vcs=no
410 -)
411
412 -if test "x$enable_login_chown_vcs" = xyes; then
413 -  AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
414 -fi
415 -
416 -
417 -AC_ARG_ENABLE([login-stat-mail],
418 -  AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
419 -  [], enable_login_stat_mail=no
420 -)
421 -
422 -if test "x$enable_login_stat_mail" = xyes; then
423 -  AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
424 -fi
425 -
426 -
427 -AC_ARG_ENABLE([pg-bell],
428 -  AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
429 -  [], enable_pg_bell=yes
430 -)
431 -
432 -if test "x$enable_pg_bell" = xyes; then
433 -  AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
434 -fi
435 -
436 -
437 -AC_ARG_ENABLE([require-password],
438 -  AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
439 -  [], enable_require_password=yes
440 -)
441 -
442 -if test "x$enable_require_password" = xyes; then
443 -  AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
444 -fi
445
446
447  AC_ARG_ENABLE([use-tty-group],
448 @@ -902,35 +491,8 @@
449  AC_CONFIG_HEADERS(config.h)
450
451  AC_CONFIG_FILES([
452 -disk-utils/Makefile
453 -fdisk/Makefile
454 -fsck/Makefile
455 -getopt/Makefile
456 -hwclock/Makefile
457 -include/Makefile
458 -lib/Makefile
459 -login-utils/Makefile
460  Makefile
461 -misc-utils/chkdupexe:misc-utils/chkdupexe.pl
462 -misc-utils/Makefile
463  mount/Makefile
464 -partx/Makefile
465 -po/Makefile.in
466 -schedutils/Makefile
467 -shlibs/blkid/blkid.pc
468 -shlibs/blkid/Makefile
469 -shlibs/blkid/src/Makefile
470 -shlibs/blkid/src/probers/Makefile
471 -shlibs/uuid/uuid.pc
472 -shlibs/uuid/Makefile
473 -shlibs/uuid/man/Makefile
474 -shlibs/uuid/src/Makefile
475 -shlibs/Makefile
476 -sys-utils/Makefile
477 -tests/commands.sh
478 -tests/helpers/Makefile
479 -tests/Makefile
480 -text-utils/Makefile
481  ])
482
483
484 diff -Naur util-linux-ng/Makefile.am losetup-2.16.2/Makefile.am
485 --- util-linux-ng/Makefile.am   2012-07-23 15:26:57.000000000 +0530
486 +++ losetup-2.16.2/Makefile.am  2012-07-23 15:47:23.000000000 +0530
487 @@ -1,37 +1,11 @@
488  include $(top_srcdir)/config/include-Makefile.am
489
490 -SUBDIRS = \
491 -       include \
492 -       disk-utils \
493 -       fdisk \
494 -       getopt \
495 -       lib \
496 -       shlibs \
497 -       login-utils \
498 -       misc-utils \
499 -       po \
500 -       schedutils \
501 -       sys-utils \
502 -       text-utils \
503 -       tests
504 +SUBDIRS = mount
505
506
507  RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
508                 -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
509
510 -if LINUX
511 -SUBDIRS += \
512 -       hwclock \
513 -       partx
514 -endif
515 -
516 -if BUILD_MOUNT
517 -SUBDIRS += mount
518 -endif
519 -
520 -if BUILD_FSCK
521 -SUBDIRS += fsck
522 -endif
523
524  ACLOCAL_AMFLAGS = -I m4
525
526 @@ -63,8 +37,5 @@
527                 | xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
528
529
530 -ENABLE_ALL = --enable-static-programs --with-fsprobe=builtin \
531 - --enable-elvtune --enable-init --enable-kill --enable-last \
532 - --enable-mesg --enable-partx --enable-raw --enable-rdev --enable-reset \
533 - --enable-login-utils --enable-write --enable-arch --enable-mount
534 +ENABLE_ALL = --enable-mount
535  DISTCHECK_CONFIGURE_FLAGS = --disable-use-tty-group $(ENABLE_ALL)
536 diff -Naur util-linux-ng/mount/lomount.c losetup-2.16.2/mount/lomount.c
537 --- util-linux-ng/mount/lomount.c       2012-07-23 15:26:57.000000000 +0530
538 +++ losetup-2.16.2/mount/lomount.c      2012-07-23 15:30:17.000000000 +0530
539 @@ -24,8 +24,6 @@
540  #include "xmalloc.h"
541  #include "pathnames.h"
542
543 -#define SIZE(a) (sizeof(a)/sizeof(a[0]))
544 -
545  #ifdef LOOP_SET_FD
546
547  static int is_associated(int dev, struct stat *file, unsigned long long offset, int isoff);
548 @@ -667,6 +665,162 @@
549   *     2       - error (EBUSY)
550   */
551  int
552 +set_loop1(const char *device, const char *file, unsigned long long offset,
553 +        unsigned long long sizelimit, const char *encryption, const char *pass, int *options) {
554 +       struct loop_info64 loopinfo64;
555 +       int fd, ffd, mode, i;
556 +       char *filename;
557 +
558 +       if (verbose) {
559 +               char *xdev = loopfile_used(file, offset);
560 +
561 +               if (xdev) {
562 +                       printf(_("warning: %s is already associated with %s\n"),
563 +                                       file, xdev);
564 +                       free(xdev);
565 +               }
566 +       }
567 +
568 +       mode = (*options & SETLOOP_RDONLY) ? O_RDONLY : O_RDWR;
569 +       if ((ffd = open(file, mode)) < 0) {
570 +               if (!(*options & SETLOOP_RDONLY) &&
571 +                   (errno == EROFS || errno == EACCES))
572 +                       ffd = open(file, mode = O_RDONLY);
573 +               if (ffd < 0) {
574 +                       perror(file);
575 +                       return 1;
576 +               }
577 +               if (verbose)
578 +                       printf(_("warning: %s: is write-protected, using read-only.\n"),
579 +                                       file);
580 +               *options |= SETLOOP_RDONLY;
581 +       }
582 +       if ((fd = open(device, mode)) < 0) {
583 +               perror (device);
584 +               close(ffd);
585 +               return 1;
586 +       }
587 +       memset(&loopinfo64, 0, sizeof(loopinfo64));
588 +
589 +       if (!(filename = canonicalize(file)))
590 +               filename = (char *) file;
591 +       xstrncpy((char *)loopinfo64.lo_file_name, filename, LO_NAME_SIZE);
592 +
593 +       if (encryption && *encryption) {
594 +               if (digits_only(encryption)) {
595 +                       loopinfo64.lo_encrypt_type = atoi(encryption);
596 +               } else {
597 +                       loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI;
598 +                       snprintf((char *)loopinfo64.lo_crypt_name, LO_NAME_SIZE,
599 +                                "%s", encryption);
600 +               }
601 +       }
602 +
603 +       loopinfo64.lo_offset = offset;
604 +       loopinfo64.lo_sizelimit = sizelimit;
605 +
606 +#ifdef MCL_FUTURE
607 +       /*
608 +        * Oh-oh, sensitive data coming up. Better lock into memory to prevent
609 +        * passwd etc being swapped out and left somewhere on disk.
610 +        */
611 +       if (loopinfo64.lo_encrypt_type != LO_CRYPT_NONE) {
612 +               if(mlockall(MCL_CURRENT | MCL_FUTURE)) {
613 +                       perror("memlock");
614 +                       fprintf(stderr, _("Couldn't lock into memory, exiting.\n"));
615 +                       exit(1);
616 +               }
617 +       }
618 +#endif
619 +
620 +       switch (loopinfo64.lo_encrypt_type) {
621 +       case LO_CRYPT_NONE:
622 +               loopinfo64.lo_encrypt_key_size = 0;
623 +               break;
624 +       case LO_CRYPT_XOR:
625 +               goto gotpass;
626 +       default:
627 +       gotpass:
628 +               memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE);
629 +               xstrncpy((char *)loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
630 +               loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
631 +       }
632 +
633 +       if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
634 +               int rc = 1;
635 +
636 +               if (errno == EBUSY) {
637 +                       if (verbose)
638 +                               printf(_("ioctl LOOP_SET_FD failed: %s\n"),
639 +                                                       strerror(errno));
640 +                       rc = 2;
641 +               } else
642 +                       perror("ioctl: LOOP_SET_FD");
643 +
644 +               close(fd);
645 +               close(ffd);
646 +               if (file != filename)
647 +                       free(filename);
648 +               return rc;
649 +       }
650 +       close (ffd);
651 +
652 +       if (*options & SETLOOP_AUTOCLEAR)
653 +               loopinfo64.lo_flags = LO_FLAGS_AUTOCLEAR;
654 +
655 +       i = ioctl(fd, LOOP_SET_STATUS64, &loopinfo64);
656 +       if (i) {
657 +               struct loop_info loopinfo;
658 +               int errsv = errno;
659 +
660 +               i = loop_info64_to_old(&loopinfo64, &loopinfo);
661 +               if (i) {
662 +                       errno = errsv;
663 +                       *options &= ~SETLOOP_AUTOCLEAR;
664 +                       perror("ioctl: LOOP_SET_STATUS64");
665 +               } else {
666 +                       i = ioctl(fd, LOOP_SET_STATUS, &loopinfo);
667 +                       if (i)
668 +                               perror("ioctl: LOOP_SET_STATUS");
669 +               }
670 +               memset(&loopinfo, 0, sizeof(loopinfo));
671 +       }
672 +
673 +       if ((*options & SETLOOP_AUTOCLEAR) && !is_loopfd_autoclear(fd))
674 +               /* kernel doesn't support loop auto-destruction */
675 +               *options &= ~SETLOOP_AUTOCLEAR;
676 +
677 +       memset(&loopinfo64, 0, sizeof(loopinfo64));
678 +
679 +       if (i) {
680 +               ioctl (fd, LOOP_CLR_FD, 0);
681 +               close (fd);
682 +               if (file != filename)
683 +                       free(filename);
684 +               return 1;
685 +       }
686 +
687 +       /*
688 +        * HACK: here we're leeking a file descriptor,
689 +        * but mount is a short-lived process anyway.
690 +        */
691 +       if (!(*options & SETLOOP_AUTOCLEAR))
692 +               close (fd);
693 +
694 +       if (verbose > 1)
695 +               printf(_("set_loop(%s,%s,%llu,%llu): success\n"),
696 +                      device, filename, offset, sizelimit);
697 +       if (file != filename)
698 +               free(filename);
699 +       return 0;
700 +}
701 +/*
702 + * return codes:
703 + *     0       - success
704 + *     1       - error
705 + *     2       - error (EBUSY)
706 + */
707 +int
708  set_loop(const char *device, const char *file, unsigned long long offset,
709          unsigned long long sizelimit, const char *encryption, int pfd, int *options) {
710         struct loop_info64 loopinfo64;
711 @@ -901,6 +1055,7 @@
712    " -o | --offset <num>      start at offset <num> into file\n"
713    "      --sizelimit <num>   loop limited to only <num> bytes of the file\n"
714    " -p | --pass-fd <num>     read passphrase from file descriptor <num>\n"
715 +  " -k | --passwd <passphrase>  get passphrase\n"
716    " -r | --read-only         setup read-only loop device\n"
717    "      --show              print device name (with -f <file>)\n"
718    " -v | --verbose           verbose mode\n\n"));
719 @@ -909,7 +1064,7 @@
720
721  int
722  main(int argc, char **argv) {
723 -       char *p, *offset, *sizelimit, *encryption, *passfd, *device, *file, *assoc;
724 +       char *p, *offset, *sizelimit, *encryption, *passfd, *device, *file, *assoc, *passwd;
725         int delete, find, c, all, capacity;
726         int res = 0;
727         int showdev = 0;
728 @@ -927,6 +1082,7 @@
729                 { "offset", 1, 0, 'o' },
730                 { "sizelimit", 1, 0, 128 },
731                 { "pass-fd", 1, 0, 'p' },
732 +               { "passwd", 1, 0, 'k'},
733                 { "read-only", 0, 0, 'r' },
734                 { "show", 0, 0, 's' },
735                 { "verbose", 0, 0, 'v' },
736 @@ -940,13 +1096,13 @@
737         capacity = delete = find = all = 0;
738         off = 0;
739          slimit = 0;
740 -       assoc = offset = sizelimit = encryption = passfd = NULL;
741 +       assoc = offset = sizelimit = encryption = passfd = passwd = NULL;
742
743         progname = argv[0];
744         if ((p = strrchr(progname, '/')) != NULL)
745                 progname = p+1;
746
747 -       while ((c = getopt_long(argc, argv, "acde:E:fhj:o:p:rsv",
748 +       while ((c = getopt_long(argc, argv, "acde:E:fhj:o:p:k:rsv",
749                                 longopts, NULL)) != -1) {
750                 switch (c) {
751                 case 'a':
752 @@ -974,6 +1130,9 @@
753                 case 'o':
754                         offset = optarg;
755                         break;
756 +               case 'k':
757 +                       passwd = optarg;
758 +                       break;
759                 case 'p':
760                         passfd = optarg;
761                         break;
762 @@ -1057,7 +1216,11 @@
763                 if (passfd && sscanf(passfd, "%d", &pfd) != 1)
764                         usage();
765                 do {
766 -                       res = set_loop(device, file, off, slimit, encryption, pfd, &ro);
767 +                       if (passwd){
768 +                               res = set_loop1(device, file, off, slimit, encryption, passwd, &ro);
769 +                       }else{
770 +                               res = set_loop(device, file, off, slimit, encryption, pfd, &ro);
771 +                       }
772                         if (res == 2 && find) {
773                                 if (verbose)
774                                         printf(_("stolen loop=%s...trying again\n"),
775 diff -Naur util-linux-ng/mount/lomount.h losetup-2.16.2/mount/lomount.h
776 --- util-linux-ng/mount/lomount.h       2012-07-23 15:26:57.000000000 +0530
777 +++ losetup-2.16.2/mount/lomount.h      2012-07-23 15:30:17.000000000 +0530
778 @@ -1,5 +1,7 @@
779  extern int set_loop(const char *, const char *, unsigned long long, unsigned long long,
780                     const char *, int, int *);
781 +extern int set_loop1(const char *, const char *, unsigned long long, unsigned long long,
782 +                   const char *, const char *, int *);
783  extern int del_loop(const char *);
784  extern int is_loop_device(const char *);
785  extern int is_loop_autoclear(const char *device);
786 diff -Naur util-linux-ng/mount/Makefile.am losetup-2.16.2/mount/Makefile.am
787 --- util-linux-ng/mount/Makefile.am     2012-07-23 15:26:57.000000000 +0530
788 +++ losetup-2.16.2/mount/Makefile.am    2012-07-23 15:48:00.000000000 +0530
789 @@ -1,96 +1,12 @@
790  include $(top_srcdir)/config/include-Makefile.am
791
792 -EXTRA_DIST = README.mount
793 -
794 -bin_PROGRAMS = mount umount
795 -sbin_PROGRAMS = losetup swapon
796 -dist_man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8
797 +bin_PROGRAMS = losetup
798
799  # generic sources for all programs (mount, umount, losetup)
800  srcs_common = sundries.c xmalloc.c ../lib/canonicalize.c sundries.h xmalloc.h
801
802 -# generic header for mount and umount
803 -hdrs_mount = fstab.h mount_mntent.h mount_constants.h \
804 -       lomount.h getusername.h loop.h
805 -
806 -# generic sources for mount and umount
807 -srcs_mount = fstab.c mount_mntent.c getusername.c lomount.c devname.c devname.h \
808 -       $(srcs_common) $(hdrs_mount) ../lib/env.c ../lib/linux_version.c \
809 -       ../lib/blkdev.c ../lib/fsprobe.c
810 -
811 -# generic flags for all programs (except losetup)
812 -# -- note that pkg-config autoconf macros (pkg.m4) does not differentiate
813 -#    between CFLAGS and CPPFLAGS, we follow this behaviour and use CFLAGS only.
814 -ldadd_common =
815 -ldadd_static =
816 -cflags_common =
817 -
818 -# generic libtool options for all static programs
819 -ldflags_static ="-all-static"
820 -
821 -mount_SOURCES = mount.c $(srcs_mount) ../lib/setproctitle.c
822 -mount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) $(cflags_common)
823 -mount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
824 -mount_LDADD = $(ldadd_common)
825 -
826 -umount_SOURCES = umount.c $(srcs_mount)
827 -umount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) $(cflags_common)
828 -umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
829 -umount_LDADD = $(ldadd_common)
830 -
831 -swapon_SOURCES = swapon.c swap_constants.h ../lib/linux_version.c \
832 -       ../lib/blkdev.c ../lib/fsprobe.c ../lib/canonicalize.c
833 -swapon_CFLAGS = $(cflags_common)
834 -swapon_LDADD = $(ldadd_common)
835 +ldflags_static = -all-static
836
837  losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h
838  losetup_CPPFLAGS = -DMAIN $(AM_CPPFLAGS)
839
840 -mount_static_LDADD =
841 -
842 -if HAVE_STATIC_MOUNT
843 -bin_PROGRAMS += mount.static
844 -mount_static_SOURCES = $(mount_SOURCES)
845 -mount_static_CFLAGS = $(cflags_common)
846 -mount_static_LDFLAGS = $(ldflags_static)
847 -mount_static_LDADD += $(ldadd_static)
848 -endif
849 -
850 -if HAVE_STATIC_UMOUNT
851 -bin_PROGRAMS += umount.static
852 -umount_static_SOURCES = $(umount_SOURCES)
853 -umount_static_CFLAGS = $(cflags_common)
854 -umount_static_LDFLAGS = $(ldflags_static)
855 -umount_static_LDADD = $(ldadd_static)
856 -endif
857 -
858 -if HAVE_STATIC_LOSETUP
859 -bin_PROGRAMS += losetup.static
860 -losetup_static_SOURCES = $(losetup_SOURCES)
861 -losetup_static_LDFLAGS = $(ldflags_static)
862 -losetup_static_CPPFLAGS = -DMAIN $(AM_CPPFLAGS)
863 -endif
864 -
865 -if BUILD_LIBBLKID
866 -ldadd_common += $(ul_libblkid_la)
867 -ldadd_static += $(ul_libblkid_la)
868 -cflags_common += -I$(ul_libblkid_srcdir)
869 -else
870 -ldadd_common += $(BLKID_LIBS)
871 -ldadd_static += $(BLKID_LIBS_STATIC)
872 -cflags_common += $(BLKID_CFLAGS)
873 -endif
874 -
875 -if HAVE_SELINUX
876 -mount_LDADD += $(SELINUX_LIBS)
877 -mount_static_LDADD += $(SELINUX_LIBS_STATIC)
878 -endif
879 -
880 -noinst_PROGRAMS = mtab_lock_test
881 -mtab_lock_test_SOURCES = fstab.c $(srcs_common) $(hdrs_mount)
882 -mtab_lock_test_CPPFLAGS = -DMAIN_TEST_MTABLOCK $(AM_CPPFLAGS)
883 -
884 -install-exec-hook:
885 -       chmod 4755 $(DESTDIR)$(bindir)/mount
886 -       chmod 4755 $(DESTDIR)$(bindir)/umount
887 -       cd $(DESTDIR)$(sbindir) && ln -sf swapon swapoff