added a FAKEROOT define allowing to use pacman in a fakeroot enivronment (for tests purpose)
This commit is contained in:
parent
cf94007aed
commit
2d08e902ef
14
configure.ac
14
configure.ac
|
@ -52,6 +52,11 @@ AC_ARG_ENABLE(debug,
|
||||||
AC_HELP_STRING([--disable-debug], [Disable debugging support]),
|
AC_HELP_STRING([--disable-debug], [Disable debugging support]),
|
||||||
[debug=$enableval], [debug=yes])
|
[debug=$enableval], [debug=yes])
|
||||||
|
|
||||||
|
dnl Help line for fakeroot
|
||||||
|
AC_ARG_ENABLE(fakeroot,
|
||||||
|
AC_HELP_STRING([--disable-fakeoot], [Disable fakeroot proof support]),
|
||||||
|
[fakeroot=$enableval], [fakeroot=yes])
|
||||||
|
|
||||||
dnl Check for man2html binary
|
dnl Check for man2html binary
|
||||||
AC_MSG_CHECKING(for support man2html)
|
AC_MSG_CHECKING(for support man2html)
|
||||||
if test x$wantman2html = xyes ; then
|
if test x$wantman2html = xyes ; then
|
||||||
|
@ -111,6 +116,15 @@ else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl Enable or disable fakeroot code
|
||||||
|
AC_MSG_CHECKING(for fakeroot proof support)
|
||||||
|
if test x$fakeroot = xyes ; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
else
|
||||||
|
CFLAGS="$CFLAGS -DFAKEROOT"
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl Check for zlib
|
dnl Check for zlib
|
||||||
AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
|
AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
|
||||||
if test -n "$LIBZ"; then
|
if test -n "$LIBZ"; then
|
||||||
|
|
|
@ -55,13 +55,19 @@ pmhandle_t *handle_new()
|
||||||
#ifndef CYGWIN
|
#ifndef CYGWIN
|
||||||
/* see if we're root or not */
|
/* see if we're root or not */
|
||||||
handle->uid = geteuid();
|
handle->uid = geteuid();
|
||||||
|
#ifndef FAKEROOT
|
||||||
if(!handle->uid && getenv("FAKEROOTKEY")) {
|
if(!handle->uid && getenv("FAKEROOTKEY")) {
|
||||||
/* fakeroot doesn't count, we're non-root */
|
/* fakeroot doesn't count, we're non-root */
|
||||||
handle->uid = 99;
|
handle->uid = 99;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* see if we're root or not (fakeroot does not count) */
|
/* see if we're root or not (fakeroot does not count) */
|
||||||
|
#ifndef FAKEROOT
|
||||||
if(handle->uid == 0 && !getenv("FAKEROOTKEY")) {
|
if(handle->uid == 0 && !getenv("FAKEROOTKEY")) {
|
||||||
|
#else
|
||||||
|
if(handle->uid == 0) {
|
||||||
|
#endif
|
||||||
handle->access = PM_ACCESS_RW;
|
handle->access = PM_ACCESS_RW;
|
||||||
} else {
|
} else {
|
||||||
handle->access = PM_ACCESS_RO;
|
handle->access = PM_ACCESS_RO;
|
||||||
|
|
|
@ -101,10 +101,12 @@ int main(int argc, char *argv[])
|
||||||
#ifndef CYGWIN
|
#ifndef CYGWIN
|
||||||
/* see if we're root or not */
|
/* see if we're root or not */
|
||||||
myuid = geteuid();
|
myuid = geteuid();
|
||||||
|
#ifndef FAKEROOT
|
||||||
if(!myuid && getenv("FAKEROOTKEY")) {
|
if(!myuid && getenv("FAKEROOTKEY")) {
|
||||||
/* fakeroot doesn't count, we're non-root */
|
/* fakeroot doesn't count, we're non-root */
|
||||||
myuid = 99;
|
myuid = 99;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* check if we have sufficient permission for the requested operation */
|
/* check if we have sufficient permission for the requested operation */
|
||||||
if(myuid > 0) {
|
if(myuid > 0) {
|
||||||
|
|
Loading…
Reference in New Issue