1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Start moving hardcoded paths out of libalpm

Move the defaults for RootDir, CacheDir, DBPath, and LockFile into
pacman.conf, just as LogFile was done before. Add a section to
alpm_parse_config to look for a LockFile directive.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-06-04 10:19:28 -04:00
parent 029a8a9d44
commit a094deacf4
3 changed files with 11 additions and 14 deletions

View File

@ -13,6 +13,7 @@ MOSTLYCLEANFILES = $(dist_sysconf_DATA)
#### Taken from the autoconf scripts Makefile.am ####
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
@ -21,7 +22,8 @@ edit = sed \
-e 's|@CARCH[@]|$(CARCH)|g' \
-e 's|@CHOST[@]|$(CHOST)|g' \
-e 's|@ARCHSWITCH[@]|$(ARCHSWITCH)|g' \
-e 's|@CARCHFLAGS[@]|$(CARCHFLAGS)|g'
-e 's|@CARCHFLAGS[@]|$(CARCHFLAGS)|g' \
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
$(dist_sysconf_DATA): Makefile
rm -f $@ $@.tmp

View File

@ -7,7 +7,11 @@
# GENERAL OPTIONS
#
[options]
LogFile = /var/log/pacman.log
RootDir = @ROOTDIR@
DBPath = @localstatedir@/lib/pacman/
CacheDir = @localstatedir@/cache/pacman/pkg/
LockFile = @localstatedir@/run/pacman.lck
LogFile = @localstatedir@/log/pacman.log
HoldPkg = pacman glibc
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u

View File

@ -1025,29 +1025,20 @@ int SYMEXPORT alpm_parse_config(char *file, alpm_cb_db_register callback, const
alpm_option_add_holdpkg(p);
_alpm_log(PM_LOG_DEBUG, _("config: holdpkg: %s"), p);
} else if(strcmp(origkey, "DBPath") == 0 || strcmp(key, "DBPATH") == 0) {
/* shave off the leading slash, if there is one */
if(*ptr == '/') {
ptr++;
}
alpm_option_set_dbpath(ptr);
_alpm_log(PM_LOG_DEBUG, _("config: dbpath: %s"), ptr);
} else if(strcmp(origkey, "CacheDir") == 0 || strcmp(key, "CACHEDIR") == 0) {
/* shave off the leading slash, if there is one */
if(*ptr == '/') {
ptr++;
}
alpm_option_set_cachedir(ptr);
_alpm_log(PM_LOG_DEBUG, _("config: cachedir: %s"), ptr);
} else if(strcmp(origkey, "RootDir") == 0 || strcmp(key, "ROOTDIR") == 0) {
/* shave off the leading slash, if there is one */
if(*ptr == '/') {
ptr++;
}
alpm_option_set_root(ptr);
_alpm_log(PM_LOG_DEBUG, _("config: rootdir: %s"), ptr);
} else if (strcmp(origkey, "LogFile") == 0 || strcmp(key, "LOGFILE") == 0) {
alpm_option_set_logfile(ptr);
_alpm_log(PM_LOG_DEBUG, _("config: logfile: %s"), ptr);
} else if (strcmp(origkey, "LockFile") == 0 || strcmp(key, "LOCKFILE") == 0) {
alpm_option_set_lockfile(ptr);
_alpm_log(PM_LOG_DEBUG, _("config: lockfile: %s"), ptr);
} else if (strcmp(origkey, "XferCommand") == 0 || strcmp(key, "XFERCOMMAND") == 0) {
alpm_option_set_xfercommand(ptr);
_alpm_log(PM_LOG_DEBUG, _("config: xfercommand: %s"), ptr);