Add a configure flag to specify the lockfile path
authorpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 28 Dec 2009 09:05:33 +0000 (09:05 +0000)
committerpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 28 Dec 2009 09:05:33 +0000 (09:05 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@511 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

configure.ac
libopkg/Makefile.am
libopkg/opkg_conf.c

index e7c78311d7005372f98e506863e55961590f94a1..3a4000491d2c11a4c2d4930f46ebf42daab6779f 100644 (file)
@@ -243,6 +243,22 @@ if test x$opkgetcdir = x; then
         opkgetcdir=/etc
 fi
 
+opkglockfile=
+AC_ARG_WITH(opkglockfile,
+[  --with-opkglockfile=FILE specifies the file used to make sure there is only
+                           one instance of opkg runnning.
+                           Defaults to ${opkglibdir}/opkg/lock, i.e.
+                           /usr/lib/opkg/lock ],
+[case "${withval}" in
+yes)    AC_MSG_ERROR(bad value ${withval} given for opkg lock file ) ;;
+no)     ;;
+*)      opkglockfile=$with_opkglockfile ;;
+esac])
+
+# Default if empty
+if test x$opkglockfile = x; then
+        opkglockfile=${opkglibdir}/opkg/lock
+fi
 
 dnl Some special cases for the wow64 build
 if test "x$want_gpgme" = "xyes"
@@ -258,6 +274,7 @@ fi
 
 AC_SUBST(opkglibdir)
 AC_SUBST(opkgetcdir)
+AC_SUBST(opkglockfile)
 
 # Setup output beautifier.
 SHAVE_INIT([shave], [enable])
index 524df5cb0a5c7e814f3dc79d5899c60fab2cc059..6be44adaec6693d719c7e9f0c0f3c0b2cab9d1c9 100644 (file)
@@ -1,5 +1,5 @@
 
-AM_CFLAGS=-Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
+AM_CFLAGS=-Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DOPKGLOCKFILE=\"@opkglockfile@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
 
 libopkg_includedir=$(includedir)/libopkg
 libopkg_include_HEADERS= *.h
index 49944aa9821b0c1f20a4acd829fda0a88f74913b..9c02cbd4927ea0ec0246c32b3ed7d1d7b7c2a932 100644 (file)
@@ -473,9 +473,9 @@ opkg_conf_init(void)
        globfree(&globbuf);
 
        if (conf->offline_root)
-               sprintf_alloc (&lock_file, "%s/%s/lock", conf->offline_root, OPKG_STATE_DIR_PREFIX);
+               sprintf_alloc (&lock_file, "%s/%s", conf->offline_root, OPKGLOCKFILE);
        else
-               sprintf_alloc (&lock_file, "%s/lock", OPKG_STATE_DIR_PREFIX);
+               sprintf_alloc (&lock_file, "%s", OPKGLOCKFILE);
 
        lock_fd = creat(lock_file, S_IRUSR | S_IWUSR | S_IRGRP);
        if (lock_fd == -1) {