aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2020-03-03 12:39:46 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2020-03-03 12:39:46 -0500
commit5dd49fcc2c58be79437e7296bcd4f903e9faaf4c (patch)
tree6d5ff8418bd1d94dabca00b3ae2aaabf175f10cd /src
parent03e8c71963b6e0682ef5d87dd6b6a66a86c8c935 (diff)
downloadspmc-5dd49fcc2c58be79437e7296bcd4f903e9faaf4c.tar.gz
Improvements:
* Add a default package location (URL will change some day) * SPM_ROOT environment variable can change the default root from ~/spm_root to whatever you want
Diffstat (limited to 'src')
-rw-r--r--src/spm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/spm.c b/src/spm.c
index 099b3f8..7f153a8 100644
--- a/src/spm.c
+++ b/src/spm.c
@@ -174,8 +174,11 @@ int main(int argc, char *argv[], char *arge[]) {
}
}
+ // Apply some default manifest locations; unless the user passes -M|--override-manifests
if (override_manifests == 0) {
- // Place the default package location at the bottom of the list
+ // Remote package manifests have priority over the local package store
+ manifestlist_append(mf, "https://astroconda.org/spm");
+ // Add the local package store to the bottom
manifestlist_append(mf, SPM_GLOBAL.package_dir);
}
@@ -195,7 +198,13 @@ int main(int argc, char *argv[], char *arge[]) {
}
if (isempty(rootdir)) {
- sprintf(rootdir, "%s%c%s", getenv("HOME"), DIRSEP, "spm_root");
+ // No root directory defined so check if the environment variable was declared
+ char *global_root = getenv("SPM_ROOT");
+ if (global_root != NULL) {
+ strncpy(rootdir, global_root, PATH_MAX);
+ } else { // Nothing declared; fall back to user's home directory
+ sprintf(rootdir, "%s%c%s", getenv("HOME"), DIRSEP, "spm_root");
+ }
}
SPM_Hierarchy *rootfs = spm_hierarchy_init(rootdir);