diff --git a/client/init.c b/client/init.c index f2319a84..b8c18c46 100644 --- a/client/init.c +++ b/client/init.c @@ -145,30 +145,17 @@ TDNFRefreshSack( if (nMetadataExpired) { - if (gEuid) - { - if (!pTdnf->pArgs->nCacheOnly) - { - pr_err("\ntdnf repo cache needs to be refreshed\n" - "You can use one of the below methods to workaround this\n" - "1. Login as root & refresh cache\n" - "2. Use -c (--config) option & create repo cache where you have access\n" - "3. Use -C (--cacheonly) & use existing cache in the system\n\n"); - } - goto cleanup; - } - dwError = TDNFRepoRemoveCache(pTdnf, pRepo); if (dwError == ERROR_TDNF_FILE_NOT_FOUND) { - dwError = 0;//Ignore non existent folders + dwError = 0; // ignore not existing folders } BAIL_ON_TDNF_ERROR(dwError); dwError = TDNFRemoveSolvCache(pTdnf, pRepo); if (dwError == ERROR_TDNF_FILE_NOT_FOUND) { - dwError = 0;//Ignore non existent folders + dwError = 0; // ignore not existing folders } BAIL_ON_TDNF_ERROR(dwError); } @@ -179,9 +166,11 @@ TDNFRefreshSack( } if (dwError && pRepo->nSkipIfUnavailable) { - pRepo->nEnabled = 0; - pr_info("Disabling Repo: '%s'\n", pRepo->pszName); - dwError = 0; + if (dwError != (ERROR_TDNF_SYSTEM_BASE + EACCES)) { + pRepo->nEnabled = 0; + pr_info("Disabling Repo: '%s'\n", pRepo->pszName); + dwError = 0; + } } BAIL_ON_TDNF_ERROR(dwError); } diff --git a/client/utils.c b/client/utils.c index 9bcff774..17941eb6 100644 --- a/client/utils.c +++ b/client/utils.c @@ -334,7 +334,7 @@ TDNFTouchFile( } old_mask = umask(022); - fd = creat(pszFile, S_IRUSR | S_IRGRP | S_IROTH); + fd = creat(pszFile, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { if (errno == EEXIST) diff --git a/tools/cli/lib/api.c b/tools/cli/lib/api.c index f2b0a162..a0c9e676 100644 --- a/tools/cli/lib/api.c +++ b/tools/cli/lib/api.c @@ -1303,7 +1303,19 @@ uint32_t TDNFCliRefresh( PTDNF_CLI_CONTEXT pContext) { - return TDNFRefresh(pContext->hTdnf); + uint32_t dwError = 0; + dwError = TDNFRefresh(pContext->hTdnf); + + if (dwError == ERROR_TDNF_SYSTEM_BASE + EACCES) { + if (geteuid()) { + pr_err("\ntdnf repo cache needs to be refreshed but you have insufficient permissions\n" + "You can use one of the below methods to workaround this\n" + "1. Login as root and refresh cache\n" + "2. Use -c (--config) with a configuration file that has 'cachedir' set to a directory where you have access\n" + "3. Use -C (--cacheonly) and use the existing cache in the system\n\n"); + } + } + return dwError; } static diff --git a/tools/cli/main.c b/tools/cli/main.c index 9aa58f15..3674177e 100644 --- a/tools/cli/main.c +++ b/tools/cli/main.c @@ -15,7 +15,7 @@ static TDNF_CLI_CMD_MAP arCmdMap[] = {"check", TDNFCliCheckCommand, false}, {"check-local", TDNFCliCheckLocalCommand, false}, {"check-update", TDNFCliCheckUpdateCommand, false}, - {"clean", TDNFCliCleanCommand, true}, + {"clean", TDNFCliCleanCommand, false}, {"count", TDNFCliCountCommand, false}, {"distro-sync", TDNFCliDistroSyncCommand, true}, {"downgrade", TDNFCliDowngradeCommand, true}, @@ -25,7 +25,7 @@ static TDNF_CLI_CMD_MAP arCmdMap[] = {"info", TDNFCliInfoCommand, false}, {"install", TDNFCliInstallCommand, true}, {"list", TDNFCliListCommand, false}, - {"makecache", TDNFCliMakeCacheCommand, true}, + {"makecache", TDNFCliMakeCacheCommand, false}, {"mark", TDNFCliMarkCommand, false}, {"provides", TDNFCliProvidesCommand, false}, {"whatprovides", TDNFCliProvidesCommand, false},